From 338cf736009da1d25929b4c1a7f9dcc56c6c2727 Mon Sep 17 00:00:00 2001 From: Prachi Naigaonkar <150342469+v-prachin@users.noreply.github.com> Date: Mon, 1 Apr 2024 18:07:56 +0530 Subject: [PATCH] chore: Typescript Cleanup Part 2 of 3 for selector, isEnabled, requirementLink, leftNavLinkBuilder & height:0 (#7276) #### Details Typescript Cleanup Part 2 of 3 We have total 140 errors in 104 files. Thus, targeting each error and fixing it. ##### Motivation Errors observed in below files observed after removing deprecated properties from tsconfig file: 1 **renderRequirementDescription: requirementLink =>** src/assessments/automated-checks/build-test-steps-from-rules.tsx No. Of Error: 1 Removed this property based on this PR: https://github.com/microsoft/accessibility-insights-web/pull/3163 2.**selector: selector** src/background/assessment-data-converter.ts No. Of Error: 1 Added the property in the interface 3.**selector: selectorStub** src/tests/unit/tests/background/assessment-data-converter.test.ts No. Of Error: 3 Added the property in the interface 4.**isEnabled: true** src/assessments/cognitive/assessment src/assessments/headings/assessment.tsx src/assessments/parsing/assessment.tsx No. Of Error: 3 Added the property in the interface. 5.**leftNavLinkBuilder: leftNavLinkBuilderMock.object** src/tests/unit/tests/DetailsView/components/left-nav/assessment-left-nav.test.tsx No. Of Error: 1 6.**leftNavLinkBuilder: leftNavLinkBuilderMock.object** src/tests/unit/tests/DetailsView/components/left-nav/quick-assess-left-nav.test.tsx No. Of Error: 1 7.**leftNavLinkBuilder: leftNavLinkBuilderMock.object** src/tests/unit/tests/DetailsView/components/left-nav/visualization-based-left-nav.test.tsx No. Of Error: 1 8.**height: 0** src/tests/unit/tests/DetailsView/components/narrow-mode-detector.test.tsx No. Of Error: 1 This property is not present in the main file, thus removed it from the test file. Thus, total number of errors covered as part of this user story: **12** ##### Context #### Pull request checklist - [x] Addresses an existing issue: #(https://github.com/microsoft/accessibility-insights-web/pull/6611) - [x] Ran `yarn fastpass` - [x] Added/updated relevant unit test(s) (and ran `yarn test`) - [x] Verified code coverage for the changes made. Check coverage report at: `/test-results/unit/coverage` - [x] PR title *AND* final merge commit title both start with a semantic tag (`fix:`, `chore:`, `feat(feature-name):`, `refactor:`). See `CONTRIBUTING.md`. - [n/a] (UI changes only) Added screenshots/GIFs to description above - [n/a] (UI changes only) Verified usability with NVDA/JAWS --- .../automated-checks/build-test-steps-from-rules.tsx | 2 -- src/assessments/types/iassessment.ts | 1 + src/common/types/store-data/assessment-result-data.ts | 1 + .../components/left-nav/assessment-left-nav.test.tsx | 3 --- .../components/left-nav/quick-assess-left-nav.test.tsx | 1 - .../components/left-nav/visualization-based-left-nav.test.tsx | 1 - .../tests/DetailsView/components/narrow-mode-detector.test.tsx | 1 - 7 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/assessments/automated-checks/build-test-steps-from-rules.tsx b/src/assessments/automated-checks/build-test-steps-from-rules.tsx index dcb22d53362..28985ee569f 100644 --- a/src/assessments/automated-checks/build-test-steps-from-rules.tsx +++ b/src/assessments/automated-checks/build-test-steps-from-rules.tsx @@ -52,8 +52,6 @@ function buildAutomatedCheckStep(rule: ScannerRuleInfo): Requirement { getInstanceStatus: getInstanceStatus, getInstanceStatusColumns: () => [], instanceTableHeaderType: 'none', - renderRequirementDescription: requirementLink => - requirementLink.renderRequirementDescriptionWithoutIndex(), getDefaultMessage: defaultMessageGenerator => defaultMessageGenerator.getNoFailingInstanceMessage, getVisualHelperToggle: props => , diff --git a/src/assessments/types/iassessment.ts b/src/assessments/types/iassessment.ts index 06bf39e77c5..0b1e982716b 100644 --- a/src/assessments/types/iassessment.ts +++ b/src/assessments/types/iassessment.ts @@ -23,6 +23,7 @@ interface BaseAssessment { extensions?: AnyExtension[]; initialDataCreator?: InitialDataCreator; isNonCollapsible?: boolean; + isEnabled?: boolean; } export interface ManualAssessment extends BaseAssessment {} diff --git a/src/common/types/store-data/assessment-result-data.ts b/src/common/types/store-data/assessment-result-data.ts index 443712a43a0..c5bd8badd47 100644 --- a/src/common/types/store-data/assessment-result-data.ts +++ b/src/common/types/store-data/assessment-result-data.ts @@ -55,6 +55,7 @@ export interface GeneratedAssessmentInstance { html: string; testStepResults: AssessmentResultType; propertyBag?: T; + selector?: string; } export interface TestStepResult { diff --git a/src/tests/unit/tests/DetailsView/components/left-nav/assessment-left-nav.test.tsx b/src/tests/unit/tests/DetailsView/components/left-nav/assessment-left-nav.test.tsx index efaf006c6e1..8d444430fd9 100644 --- a/src/tests/unit/tests/DetailsView/components/left-nav/assessment-left-nav.test.tsx +++ b/src/tests/unit/tests/DetailsView/components/left-nav/assessment-left-nav.test.tsx @@ -65,15 +65,12 @@ describe(AssessmentLeftNav.displayName, () => { props = { deps, selectedKey: 'some key', - leftNavLinkBuilder: leftNavLinkBuilderMock.object, assessmentsProvider: assessmentsProviderStub, assessmentsData: assessmentsDataStub, featureFlagStoreData: {}, expandedTest, onRightPanelContentSwitch, setNavComponentRef, - getAssessmentSummaryModelFromProviderAndStatusData: - getAssessmentSummaryModelFromProviderAndStatusDataMock.object, }; leftNavLinkBuilderMock diff --git a/src/tests/unit/tests/DetailsView/components/left-nav/quick-assess-left-nav.test.tsx b/src/tests/unit/tests/DetailsView/components/left-nav/quick-assess-left-nav.test.tsx index 47626e4078a..c312d7c8e28 100644 --- a/src/tests/unit/tests/DetailsView/components/left-nav/quick-assess-left-nav.test.tsx +++ b/src/tests/unit/tests/DetailsView/components/left-nav/quick-assess-left-nav.test.tsx @@ -71,7 +71,6 @@ describe(QuickAssessLeftNav.displayName, () => { props = { deps, selectedKey: 'some key', - leftNavLinkBuilder: leftNavLinkBuilderMock.object, assessmentsProvider: assessmentsProviderStub, assessmentsData: assessmentsDataStub, featureFlagStoreData: {}, diff --git a/src/tests/unit/tests/DetailsView/components/left-nav/visualization-based-left-nav.test.tsx b/src/tests/unit/tests/DetailsView/components/left-nav/visualization-based-left-nav.test.tsx index e9887ffcd1e..b42dca6a001 100644 --- a/src/tests/unit/tests/DetailsView/components/left-nav/visualization-based-left-nav.test.tsx +++ b/src/tests/unit/tests/DetailsView/components/left-nav/visualization-based-left-nav.test.tsx @@ -56,7 +56,6 @@ describe('VisualizationBasedLeftNav', () => { props = { deps, selectedKey: 'some key', - leftNavLinkBuilder: leftNavLinkBuilderMock.object, onLinkClick: onLinkClickStub, visualizations: visualizationsStub, onRightPanelContentSwitch, diff --git a/src/tests/unit/tests/DetailsView/components/narrow-mode-detector.test.tsx b/src/tests/unit/tests/DetailsView/components/narrow-mode-detector.test.tsx index dfa3171ead9..fc5b1a7ecdf 100644 --- a/src/tests/unit/tests/DetailsView/components/narrow-mode-detector.test.tsx +++ b/src/tests/unit/tests/DetailsView/components/narrow-mode-detector.test.tsx @@ -207,7 +207,6 @@ describe(NarrowModeDetector, () => { expect( renderFunc({ width: narrowModeThresholds.collapseHeaderAndNavThreshold - 1, - height: 0, }), ).toMatchSnapshot('All narrow mode status values should be false'); });