From e27e9e6b874a3eaf31b6040c761dcca0fa281fcf Mon Sep 17 00:00:00 2001 From: Sebastien Romain Date: Thu, 27 Jul 2023 10:35:11 +0200 Subject: [PATCH] update for tests --- .../SubHeaderBar/SubHeaderBar.component.js | 1 + .../src/SubHeaderBar/SubHeaderBar.test.js | 2 +- .../__snapshots__/SubHeaderBar.test.js.snap | 20 +++++++++---------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/components/src/SubHeaderBar/SubHeaderBar.component.js b/packages/components/src/SubHeaderBar/SubHeaderBar.component.js index 2715f7673c1..8867d49b76e 100644 --- a/packages/components/src/SubHeaderBar/SubHeaderBar.component.js +++ b/packages/components/src/SubHeaderBar/SubHeaderBar.component.js @@ -120,6 +120,7 @@ function SubHeaderBar({ size="M" onClick={onGoBack} id="backArrow" + data-testid="tc-subheader-backArrow" data-feature={goBackDataFeature} > {t('BACK_ARROW_TOOLTIP', { defaultValue: 'Go back' })} diff --git a/packages/components/src/SubHeaderBar/SubHeaderBar.test.js b/packages/components/src/SubHeaderBar/SubHeaderBar.test.js index 3b03e8bd9c0..8cef5a144ee 100644 --- a/packages/components/src/SubHeaderBar/SubHeaderBar.test.js +++ b/packages/components/src/SubHeaderBar/SubHeaderBar.test.js @@ -200,7 +200,7 @@ describe('SubHeaderBar', () => { }; render(); expect(screen.getByText('myTitle')).toBeVisible(); - expect(screen.getByLabelText('Go back')).toBeVisible(); + expect(screen.getByTestId('tc-subheader-backArrow')).toBeVisible(); }); it('Should render SubHeader component if right actions are in loading state', () => { diff --git a/packages/components/src/SubHeaderBar/__snapshots__/SubHeaderBar.test.js.snap b/packages/components/src/SubHeaderBar/__snapshots__/SubHeaderBar.test.js.snap index fedea6d22a4..cc58823123f 100644 --- a/packages/components/src/SubHeaderBar/__snapshots__/SubHeaderBar.test.js.snap +++ b/packages/components/src/SubHeaderBar/__snapshots__/SubHeaderBar.test.js.snap @@ -13,18 +13,18 @@ exports[`SubHeaderBar should render 1`] = `