-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: [PE-996] Accessibility for CGN loading component (#6754)
## Short description This pull request is improving accessibility for `CgnActivationLoadingScreen` to its loading state ## List of changes proposed in this pull request - Added a `useRef` hook and `useOnFirstRender` to set accessibility focus on the `SafeAreaView` component when the `LoadingComponent` is first rendered ## How to test - Using a real device 📱, start the `CGN` card onboarding - Turn on the TalkBack accessibility tool - Press on `Attiva Carta Giovani Nazionale` - Ensure that, when the loading state is appearing, the screen reader is now reading the loading state
- Loading branch information
1 parent
e88f105
commit c72ba19
Showing
2 changed files
with
72 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
ts/features/bonus/cgn/screens/activation/__tests__/CgnActivationLoadingScreen.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { createStore } from "redux"; | ||
import I18n from "../../../../../../i18n"; | ||
import { applicationChangeState } from "../../../../../../store/actions/application"; | ||
import { Store } from "../../../../../../store/actions/types"; | ||
import { appReducer } from "../../../../../../store/reducers"; | ||
import { GlobalState } from "../../../../../../store/reducers/types"; | ||
import { renderScreenWithNavigationStoreContext } from "../../../../../../utils/testWrapper"; | ||
import CGN_ROUTES from "../../../navigation/routes"; | ||
import { cgnRequestActivation } from "../../../store/actions/activation"; | ||
import CgnActivationLoadingScreen from "../CgnActivationLoadingScreen"; | ||
|
||
const renderComponent = (store: Store) => | ||
renderScreenWithNavigationStoreContext<GlobalState>( | ||
() => <CgnActivationLoadingScreen />, | ||
CGN_ROUTES.ACTIVATION.LOADING, | ||
{}, | ||
store | ||
); | ||
|
||
describe("CgnActivationLoadingScreen", () => { | ||
it("renders LoadingComponent when isLoading is true", () => { | ||
const globalState = appReducer(undefined, applicationChangeState("active")); | ||
const store = createStore(appReducer, globalState as any); | ||
|
||
const { getByText, getByA11yRole } = renderComponent(store); | ||
|
||
store.dispatch(cgnRequestActivation()); | ||
expect(getByA11yRole("header")).toBeTruthy(); | ||
expect( | ||
getByText(I18n.t("bonus.cgn.activation.loading.caption")) | ||
).toBeTruthy(); | ||
expect( | ||
getByText(I18n.t("bonus.cgn.activation.loading.subCaption")) | ||
).toBeTruthy(); | ||
}); | ||
}); |