From f4f34a16f632b6b1546da2da81451312900357be Mon Sep 17 00:00:00 2001 From: Alexandre COIN Date: Wed, 27 Nov 2024 17:12:53 +0100 Subject: [PATCH] fix(certif): improve subcategory display test in report field --- ...-certification-issue-report-fields-test.js | 115 ++++++++---------- 1 file changed, 51 insertions(+), 64 deletions(-) diff --git a/certif/tests/integration/components/issue-report-modal/in-challenge-certification-issue-report-fields-test.js b/certif/tests/integration/components/issue-report-modal/in-challenge-certification-issue-report-fields-test.js index 62ed042b55b..f67967bb63c 100644 --- a/certif/tests/integration/components/issue-report-modal/in-challenge-certification-issue-report-fields-test.js +++ b/certif/tests/integration/components/issue-report-modal/in-challenge-certification-issue-report-fields-test.js @@ -47,76 +47,63 @@ module('Integration | Component | in-challenge-certification-issue-report-fields assert.ok(toggleOnCategory.calledOnceWith(inChallengeCategory)); }); - [ - `${subcategoryToCode[certificationIssueReportSubcategories.IMAGE_NOT_DISPLAYING]} ${ - subcategoryToLabel[certificationIssueReportSubcategories.IMAGE_NOT_DISPLAYING] - }`, - `${subcategoryToCode[certificationIssueReportSubcategories.EMBED_NOT_WORKING]} ${ - subcategoryToLabel[certificationIssueReportSubcategories.EMBED_NOT_WORKING] - }`, - `${subcategoryToCode[certificationIssueReportSubcategories.FILE_NOT_OPENING]} ${ - subcategoryToLabel[certificationIssueReportSubcategories.FILE_NOT_OPENING] - }`, - `${subcategoryToCode[certificationIssueReportSubcategories.WEBSITE_UNAVAILABLE]} ${ - subcategoryToLabel[certificationIssueReportSubcategories.WEBSITE_UNAVAILABLE] - }`, - `${subcategoryToCode[certificationIssueReportSubcategories.WEBSITE_BLOCKED]} ${ - subcategoryToLabel[certificationIssueReportSubcategories.WEBSITE_BLOCKED] - }`, - `${subcategoryToCode[certificationIssueReportSubcategories.EXTRA_TIME_EXCEEDED]} ${ - subcategoryToLabel[certificationIssueReportSubcategories.EXTRA_TIME_EXCEEDED] - }`, - `${subcategoryToCode[certificationIssueReportSubcategories.SOFTWARE_NOT_WORKING]} ${ - subcategoryToLabel[certificationIssueReportSubcategories.SOFTWARE_NOT_WORKING] - }`, - `${subcategoryToCode[certificationIssueReportSubcategories.UNINTENTIONAL_FOCUS_OUT]} ${ - subcategoryToLabel[certificationIssueReportSubcategories.UNINTENTIONAL_FOCUS_OUT] - }`, - `${subcategoryToCode[certificationIssueReportSubcategories.SKIP_ON_OOPS]} ${ - subcategoryToLabel[certificationIssueReportSubcategories.SKIP_ON_OOPS] - }`, - `${subcategoryToCode[certificationIssueReportSubcategories.ACCESSIBILITY_ISSUE]} ${ - subcategoryToLabel[certificationIssueReportSubcategories.ACCESSIBILITY_ISSUE] - }`, - ].forEach(function (subcategory) { - test(`it should select the subcategory: ${subcategory} when category is checked`, async function (assert) { - // given - const toggleOnCategory = sinon.stub(); - const [subcategoryCode, subcategoryLabel] = subcategory.split(' '); - const intl = this.owner.lookup('service:intl'); - const inChallengeCategory = new RadioButtonCategoryWithSubcategoryAndQuestionNumber({ - name: 'IN_CHALLENGE', - isChecked: true, - intl, - }); - this.set('toggleOnCategory', toggleOnCategory); - this.set('inChallengeCategory', inChallengeCategory); - - // when - const screen = await render(hbs``); - await click(screen.getByLabelText(t('pages.session-finalization.add-issue-modal.actions.select-subcategory'))); + await click(screen.getByLabelText(t('pages.session-finalization.add-issue-modal.actions.select-subcategory'))); - await screen.findByRole('listbox'); - await click( - await screen.findByRole('option', { - name: `${subcategoryCode} ${t(subcategoryLabel)}`, - }), - ); - - // then - assert - .dom( - screen.getByRole('option', { - selected: true, - name: `${subcategoryCode} ${t(subcategoryLabel)}`, - }), - ) - .exists(); + await screen.findByRole('listbox'); + + [ + `${subcategoryToCode[certificationIssueReportSubcategories.IMAGE_NOT_DISPLAYING]} ${ + subcategoryToLabel[certificationIssueReportSubcategories.IMAGE_NOT_DISPLAYING] + }`, + `${subcategoryToCode[certificationIssueReportSubcategories.EMBED_NOT_WORKING]} ${ + subcategoryToLabel[certificationIssueReportSubcategories.EMBED_NOT_WORKING] + }`, + `${subcategoryToCode[certificationIssueReportSubcategories.FILE_NOT_OPENING]} ${ + subcategoryToLabel[certificationIssueReportSubcategories.FILE_NOT_OPENING] + }`, + `${subcategoryToCode[certificationIssueReportSubcategories.WEBSITE_UNAVAILABLE]} ${ + subcategoryToLabel[certificationIssueReportSubcategories.WEBSITE_UNAVAILABLE] + }`, + `${subcategoryToCode[certificationIssueReportSubcategories.WEBSITE_BLOCKED]} ${ + subcategoryToLabel[certificationIssueReportSubcategories.WEBSITE_BLOCKED] + }`, + `${subcategoryToCode[certificationIssueReportSubcategories.EXTRA_TIME_EXCEEDED]} ${ + subcategoryToLabel[certificationIssueReportSubcategories.EXTRA_TIME_EXCEEDED] + }`, + `${subcategoryToCode[certificationIssueReportSubcategories.SOFTWARE_NOT_WORKING]} ${ + subcategoryToLabel[certificationIssueReportSubcategories.SOFTWARE_NOT_WORKING] + }`, + `${subcategoryToCode[certificationIssueReportSubcategories.UNINTENTIONAL_FOCUS_OUT]} ${ + subcategoryToLabel[certificationIssueReportSubcategories.UNINTENTIONAL_FOCUS_OUT] + }`, + `${subcategoryToCode[certificationIssueReportSubcategories.SKIP_ON_OOPS]} ${ + subcategoryToLabel[certificationIssueReportSubcategories.SKIP_ON_OOPS] + }`, + `${subcategoryToCode[certificationIssueReportSubcategories.ACCESSIBILITY_ISSUE]} ${ + subcategoryToLabel[certificationIssueReportSubcategories.ACCESSIBILITY_ISSUE] + }`, + ].forEach(function (subcategory) { + const [subcategoryCode, subcategoryLabel] = subcategory.split(' '); + assert.dom(screen.getByRole('option', { name: `${subcategoryCode} ${t(subcategoryLabel)}` })).exists(); }); });