From 46941658cd152da0a98d8f0ef42be3d5cb860b8f Mon Sep 17 00:00:00 2001
From: Anjali Singh <150343275+v-singhanjal@users.noreply.github.com>
Date: Tue, 5 Mar 2024 10:56:11 +0530
Subject: [PATCH] chore: Enzyme replacement in test files- PR 1 of 6 for part 3
of 3 (#7232)
#### Details
Enzyme replacement in files under src/tests/unit/tests/DetailsView/
##### Motivation
Existing story: [User Story
2142857](https://dev.azure.com/mseng/1ES/_workitems/edit/2142857)
Replaced the use of Enzyme in the below files:
1. src/tests/unit/tests/DetailsView/components/status-icon.test.tsx
2. src/tests/unit/tests/DetailsView/components/switcher.test.tsx
3.
src/tests/unit/tests/DetailsView/components/tab-stops-failed-instance-section.test.tsx
4.
src/tests/unit/tests/DetailsView/components/tab-stops-minimal-requirement-header.test.tsx
5.
src/tests/unit/tests/DetailsView/components/tab-stops-requirement-instances-collapsible-content.test.tsx
6.
src/tests/unit/tests/DetailsView/components/tab-stops-requirements-with-instances.test.tsx
7.
src/tests/unit/tests/DetailsView/components/target-change-dialog.test.tsx
8.
src/tests/unit/tests/DetailsView/components/target-page-changed-view.test.tsx
9.
src/tests/unit/tests/DetailsView/components/target-page-hidden-bar.test.tsx
10.
src/tests/unit/tests/DetailsView/components/test-status-choice-group.test.tsx
11.
src/tests/unit/tests/DetailsView/components/test-view-container.test.tsx
12.
src/tests/unit/tests/DetailsView/components/transfer-to-assessment-button.test.tsx
13. src/tests/unit/tests/DetailsView/details-view-body.test.tsx
14. src/tests/unit/tests/DetailsView/details-view-container.test.tsx
15. src/tests/unit/tests/DetailsView/details-view-content.test.tsx
##### Context
#### Pull request checklist
- [x] Addresses an existing issue: [User Story
2142857](https://dev.azure.com/mseng/1ES/_workitems/edit/2142857)
- [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
---------
Co-authored-by: Prachi Naigaonkar
---
.../details-view-body.test.tsx.snap | 2312 +++++++++++------
.../details-view-container.test.tsx.snap | 170 +-
.../details-view-content.test.tsx.snap | 1022 ++++----
.../__snapshots__/status-icon.test.tsx.snap | 70 +-
.../__snapshots__/switcher.test.tsx.snap | 25 +-
...tops-failed-instance-section.test.tsx.snap | 133 +-
...s-minimal-requirement-header.test.tsx.snap | 54 +-
...nstances-collapsible-content.test.tsx.snap | 81 +-
...-requirements-with-instances.test.tsx.snap | 42 +-
.../target-change-dialog.test.tsx.snap | 531 ++--
.../target-page-changed-view.test.tsx.snap | 98 +-
.../target-page-hidden-bar.test.tsx.snap | 11 +-
.../test-status-choice-group.test.tsx.snap | 132 +-
...ransfer-to-assessment-button.test.tsx.snap | 30 +-
.../components/status-icon.test.tsx | 27 +-
.../DetailsView/components/switcher.test.tsx | 78 +-
...tab-stops-failed-instance-section.test.tsx | 31 +-
...-stops-minimal-requirement-header.test.tsx | 10 +-
...ent-instances-collapsible-content.test.tsx | 38 +-
...stops-requirements-with-instances.test.tsx | 32 +-
.../components/target-change-dialog.test.tsx | 98 +-
.../target-page-changed-view.test.tsx | 10 +-
.../target-page-hidden-bar.test.tsx | 14 +-
.../test-status-choice-group.test.tsx | 58 +-
.../components/test-view-container.test.tsx | 8 +-
.../transfer-to-assessment-button.test.tsx | 16 +-
.../DetailsView/details-view-body.test.tsx | 45 +-
.../details-view-container.test.tsx | 39 +-
.../DetailsView/details-view-content.test.tsx | 27 +-
29 files changed, 3144 insertions(+), 2098 deletions(-)
diff --git a/src/tests/unit/tests/DetailsView/__snapshots__/details-view-body.test.tsx.snap b/src/tests/unit/tests/DetailsView/__snapshots__/details-view-body.test.tsx.snap
index ef06af01a59..5f3846a2dd2 100644
--- a/src/tests/unit/tests/DetailsView/__snapshots__/details-view-body.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/__snapshots__/details-view-body.test.tsx.snap
@@ -1,796 +1,1280 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DetailsViewBody render render 1`] = `
-
+
+`;
+
+exports[`DetailsViewBody render render: FluentSideNav props 1`] = `
+{
+ "assessmentStoreData": {
+ "assessmentNavState": {
+ "selectedTestSubview": "sample test step",
+ },
+ "assessments": {
+ "assessment": {
+ "fullAxeResultsMap": {},
+ "generatedAssessmentInstancesMap": {},
+ "manualTestStepResultMap": {},
+ "testStepStatus": {
+ "step-1": {
+ "isStepScanned": false,
+ "stepFinalResult": 1,
},
- "assessments": {
- "assessment": {
- "fullAxeResultsMap": {},
- "generatedAssessmentInstancesMap": {},
- "manualTestStepResultMap": {},
- "testStepStatus": {
- "step-1": {
- "isStepScanned": false,
- "stepFinalResult": 1,
+ },
+ },
+ },
+ "persistedTabInfo": {},
+ "resultDescription": "",
+ },
+ "automatedChecksCardsViewData": {
+ "allCardsCollapsed": true,
+ "cards": {
+ "fail": [
+ {
+ "description": "sample-description",
+ "guidance": [
+ {
+ "href": "sample-guidance-href",
+ "text": "sample-guidance-text",
+ },
+ ],
+ "id": "some-rule",
+ "nodes": [
+ {
+ "descriptors": {
+ "snippet": "this is a sample snippet",
+ },
+ "identifiers": {
+ "conciseName": "body img",
+ "css-selector": "body img",
+ "identifier": "body img",
+ },
+ "resolution": {
+ "how-to-fix-web": {
+ "all": [],
+ "any": [
+ "Element does not have an alt attribute",
+ "aria-label attribute does not exist or is empty",
+ "aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty",
+ ],
+ "none": [],
+ },
+ "howToFixSummary": "sample how to fix summary",
+ },
+ "ruleId": "image-alt",
+ "status": "fail",
+ "uid": "some-guid-here",
+ },
+ ],
+ "url": "sample-url",
+ },
+ ],
+ "inapplicable": [],
+ "pass": [],
+ "unknown": [],
+ },
+ "visualHelperEnabled": true,
+ },
+ "clickHandlerFactory": {},
+ "dataTransferViewStoreData": {
+ "showQuickAssessToAssessmentConfirmDialog": true,
+ },
+ "deps": {
+ "detailsViewActionMessageCreator": {},
+ },
+ "detailsViewStoreData": {
+ "detailsViewRightContentPanel": "Overview",
+ },
+ "featureFlagStoreData": {},
+ "isSideNavOpen": false,
+ "narrowModeStatus": {
+ "isHeaderAndNavCollapsed": false,
+ },
+ "onRightPanelContentSwitch": [Function],
+ "rightPanelConfiguration": {
+ "RightPanel": [Function],
+ },
+ "scanMetadata": {
+ "targetAppInfo": {
+ "name": "name",
+ "url": "url",
+ },
+ },
+ "selectedPivot": 0,
+ "selectedTest": -1,
+ "setSideNavOpen": [Function],
+ "switcherNavConfiguration": {
+ "CommandBar": [MockFunction] {
+ "calls": [
+ [
+ {
+ "assessmentStoreData": {
+ "assessmentNavState": {
+ "selectedTestSubview": "sample test step",
+ },
+ "assessments": {
+ "assessment": {
+ "fullAxeResultsMap": {},
+ "generatedAssessmentInstancesMap": {},
+ "manualTestStepResultMap": {},
+ "testStepStatus": {
+ "step-1": {
+ "isStepScanned": false,
+ "stepFinalResult": 1,
+ },
+ },
+ },
+ },
+ "persistedTabInfo": {},
+ "resultDescription": "",
+ },
+ "automatedChecksCardsViewData": {
+ "allCardsCollapsed": true,
+ "cards": {
+ "fail": [
+ {
+ "description": "sample-description",
+ "guidance": [
+ {
+ "href": "sample-guidance-href",
+ "text": "sample-guidance-text",
+ },
+ ],
+ "id": "some-rule",
+ "nodes": [
+ {
+ "descriptors": {
+ "snippet": "this is a sample snippet",
+ },
+ "identifiers": {
+ "conciseName": "body img",
+ "css-selector": "body img",
+ "identifier": "body img",
+ },
+ "resolution": {
+ "how-to-fix-web": {
+ "all": [],
+ "any": [
+ "Element does not have an alt attribute",
+ "aria-label attribute does not exist or is empty",
+ "aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty",
+ ],
+ "none": [],
+ },
+ "howToFixSummary": "sample how to fix summary",
+ },
+ "ruleId": "image-alt",
+ "status": "fail",
+ "uid": "some-guid-here",
+ },
+ ],
+ "url": "sample-url",
+ },
+ ],
+ "inapplicable": [],
+ "pass": [],
+ "unknown": [],
+ },
+ "visualHelperEnabled": true,
+ },
+ "clickHandlerFactory": {},
+ "dataTransferViewStoreData": {
+ "showQuickAssessToAssessmentConfirmDialog": true,
+ },
+ "deps": {
+ "detailsViewActionMessageCreator": {},
+ },
+ "detailsViewStoreData": {
+ "detailsViewRightContentPanel": "Overview",
+ },
+ "featureFlagStoreData": {},
+ "isSideNavOpen": false,
+ "narrowModeStatus": {
+ "isHeaderAndNavCollapsed": false,
+ },
+ "rightPanelConfiguration": {
+ "RightPanel": [Function],
+ },
+ "scanMetadata": {
+ "targetAppInfo": {
+ "name": "name",
+ "url": "url",
+ },
+ },
+ "selectedTest": -1,
+ "setSideNavOpen": [Function],
+ "switcherNavConfiguration": [Circular],
+ "tabStopsViewStoreData": {
+ "failureInstanceState": {},
+ },
+ "tabStoreData": {
+ "isChanged": false,
+ "isClosed": false,
+ "isOriginChanged": false,
+ "isPageHidden": false,
+ },
+ "visualizationConfigurationFactory": {},
+ "visualizationScanResultData": {
+ "accessibleNames": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "color": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "headings": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "issues": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "landmarks": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "needsReview": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "tabStops": {
+ "needToCollectTabbingResults": true,
+ "requirements": {
+ "focus-indicator": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "input-focus": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "keyboard-navigation": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "keyboard-traps": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "tab-order": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ },
+ "tabbedElements": null,
+ "tabbingCompleted": false,
+ },
+ },
+ "visualizationStoreData": {
+ "focusedTarget": null,
+ "injectingState": "notInjecting",
+ "scanning": null,
+ "selectedAdhocDetailsView": 1,
+ "selectedDetailsViewPivot": 0,
+ "selectedFastPassDetailsView": 1,
+ "tests": {
+ "adhoc": {
+ "accessibleNames": {
+ "enabled": false,
+ },
+ "color": {
+ "enabled": false,
+ },
+ "headings": {
+ "enabled": false,
+ },
+ "issues": {
+ "enabled": false,
+ },
+ "landmarks": {
+ "enabled": false,
+ },
+ "needsReview": {
+ "enabled": false,
+ },
+ "tabStops": {
+ "enabled": false,
+ },
+ },
+ "assessments": {
+ "audioVideoOnly": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "automated-checks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "cognitive": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "color": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "contrast": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "customWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "errors": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "headings": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "images": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "keyboardInteraction": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "landmarks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "language": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "linksAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "liveMultimedia": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "nativeWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "page": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "parsing": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "pointerMotion": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "prerecordedMultimedia": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "repetitiveContent": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "semanticsAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "sequence": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "textLegibility": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "timedEvents": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "visibleFocusOrder": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ },
+ "quickAssess": {
+ "automated-checks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "contrast": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "headings": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "images": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "keyboardInteraction": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "linksAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "nativeWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "repetitiveContent": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "textLegibility": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "visibleFocusOrder": {
+ "enabled": false,
+ "stepStatus": {},
+ },
},
},
},
},
- "persistedTabInfo": {},
- "resultDescription": "",
- }
- }
- automatedChecksCardsViewData={
+ {},
+ ],
+ ],
+ "results": [
{
- "allCardsCollapsed": true,
- "cards": {
- "fail": [
+ "type": "return",
+ "value": ,
+ },
+ ],
+ },
+ "LeftNav": [Function],
+ "ReportExportDialogFactory": [Function],
+ "StartOverComponentFactory": {},
+ },
+ "tabStopsViewStoreData": {
+ "failureInstanceState": {},
+ },
+ "tabStoreData": {
+ "isChanged": false,
+ "isClosed": false,
+ "isOriginChanged": false,
+ "isPageHidden": false,
+ },
+ "visualizationConfigurationFactory": {},
+ "visualizationScanResultData": {
+ "accessibleNames": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "color": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "headings": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "issues": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "landmarks": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "needsReview": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "tabStops": {
+ "needToCollectTabbingResults": true,
+ "requirements": {
+ "focus-indicator": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "input-focus": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "keyboard-navigation": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "keyboard-traps": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "tab-order": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ },
+ "tabbedElements": null,
+ "tabbingCompleted": false,
+ },
+ },
+ "visualizationStoreData": {
+ "focusedTarget": null,
+ "injectingState": "notInjecting",
+ "scanning": null,
+ "selectedAdhocDetailsView": 1,
+ "selectedDetailsViewPivot": 0,
+ "selectedFastPassDetailsView": 1,
+ "tests": {
+ "adhoc": {
+ "accessibleNames": {
+ "enabled": false,
+ },
+ "color": {
+ "enabled": false,
+ },
+ "headings": {
+ "enabled": false,
+ },
+ "issues": {
+ "enabled": false,
+ },
+ "landmarks": {
+ "enabled": false,
+ },
+ "needsReview": {
+ "enabled": false,
+ },
+ "tabStops": {
+ "enabled": false,
+ },
+ },
+ "assessments": {
+ "audioVideoOnly": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "automated-checks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "cognitive": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "color": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "contrast": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "customWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "errors": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "headings": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "images": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "keyboardInteraction": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "landmarks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "language": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "linksAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "liveMultimedia": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "nativeWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "page": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "parsing": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "pointerMotion": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "prerecordedMultimedia": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "repetitiveContent": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "semanticsAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "sequence": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "textLegibility": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "timedEvents": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "visibleFocusOrder": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ },
+ "quickAssess": {
+ "automated-checks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "contrast": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "headings": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "images": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "keyboardInteraction": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "linksAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "nativeWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "repetitiveContent": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "textLegibility": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "visibleFocusOrder": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ },
+ },
+ },
+}
+`;
+
+exports[`DetailsViewBody render render: QuickAssessCommandBar props 1`] = `
+{
+ "assessmentStoreData": {
+ "assessmentNavState": {
+ "selectedTestSubview": "sample test step",
+ },
+ "assessments": {
+ "assessment": {
+ "fullAxeResultsMap": {},
+ "generatedAssessmentInstancesMap": {},
+ "manualTestStepResultMap": {},
+ "testStepStatus": {
+ "step-1": {
+ "isStepScanned": false,
+ "stepFinalResult": 1,
},
- }
- }
- visualizationStoreData={
+ },
+ },
+ },
+ "persistedTabInfo": {},
+ "resultDescription": "",
+ },
+ "automatedChecksCardsViewData": {
+ "allCardsCollapsed": true,
+ "cards": {
+ "fail": [
{
- "focusedTarget": null,
- "injectingState": "notInjecting",
- "scanning": null,
- "selectedAdhocDetailsView": 1,
- "selectedDetailsViewPivot": 0,
- "selectedFastPassDetailsView": 1,
- "tests": {
- "adhoc": {
- "accessibleNames": {
- "enabled": false,
- },
- "color": {
- "enabled": false,
- },
- "headings": {
- "enabled": false,
- },
- "issues": {
- "enabled": false,
- },
- "landmarks": {
- "enabled": false,
- },
- "needsReview": {
- "enabled": false,
- },
- "tabStops": {
- "enabled": false,
- },
- },
- "assessments": {
- "audioVideoOnly": {
- "enabled": false,
- "stepStatus": {},
- },
- "automated-checks": {
- "enabled": false,
- "stepStatus": {},
- },
- "cognitive": {
- "enabled": false,
- "stepStatus": {},
- },
- "color": {
- "enabled": false,
- "stepStatus": {},
- },
- "contrast": {
- "enabled": false,
- "stepStatus": {},
- },
- "customWidgets": {
- "enabled": false,
- "stepStatus": {},
- },
- "errors": {
- "enabled": false,
- "stepStatus": {},
- },
- "headings": {
- "enabled": false,
- "stepStatus": {},
- },
- "images": {
- "enabled": false,
- "stepStatus": {},
- },
- "keyboardInteraction": {
- "enabled": false,
- "stepStatus": {},
- },
- "landmarks": {
- "enabled": false,
- "stepStatus": {},
- },
- "language": {
- "enabled": false,
- "stepStatus": {},
- },
- "linksAssessment": {
- "enabled": false,
- "stepStatus": {},
- },
- "liveMultimedia": {
- "enabled": false,
- "stepStatus": {},
- },
- "nativeWidgets": {
- "enabled": false,
- "stepStatus": {},
- },
- "page": {
- "enabled": false,
- "stepStatus": {},
- },
- "parsing": {
- "enabled": false,
- "stepStatus": {},
- },
- "pointerMotion": {
- "enabled": false,
- "stepStatus": {},
- },
- "prerecordedMultimedia": {
- "enabled": false,
- "stepStatus": {},
- },
- "repetitiveContent": {
- "enabled": false,
- "stepStatus": {},
- },
- "semanticsAssessment": {
- "enabled": false,
- "stepStatus": {},
- },
- "sequence": {
- "enabled": false,
- "stepStatus": {},
- },
- "textLegibility": {
- "enabled": false,
- "stepStatus": {},
- },
- "timedEvents": {
- "enabled": false,
- "stepStatus": {},
- },
- "visibleFocusOrder": {
- "enabled": false,
- "stepStatus": {},
- },
+ "description": "sample-description",
+ "guidance": [
+ {
+ "href": "sample-guidance-href",
+ "text": "sample-guidance-text",
},
- "quickAssess": {
- "automated-checks": {
- "enabled": false,
- "stepStatus": {},
- },
- "contrast": {
- "enabled": false,
- "stepStatus": {},
- },
- "headings": {
- "enabled": false,
- "stepStatus": {},
- },
- "images": {
- "enabled": false,
- "stepStatus": {},
- },
- "keyboardInteraction": {
- "enabled": false,
- "stepStatus": {},
- },
- "linksAssessment": {
- "enabled": false,
- "stepStatus": {},
- },
- "nativeWidgets": {
- "enabled": false,
- "stepStatus": {},
- },
- "repetitiveContent": {
- "enabled": false,
- "stepStatus": {},
+ ],
+ "id": "some-rule",
+ "nodes": [
+ {
+ "descriptors": {
+ "snippet": "this is a sample snippet",
},
- "textLegibility": {
- "enabled": false,
- "stepStatus": {},
+ "identifiers": {
+ "conciseName": "body img",
+ "css-selector": "body img",
+ "identifier": "body img",
},
- "visibleFocusOrder": {
- "enabled": false,
- "stepStatus": {},
- },
- },
- },
- }
- }
- />
-
-
-
+ />,
+ },
+ ],
+ },
+ "LeftNav": [Function],
+ "ReportExportDialogFactory": [Function],
+ "StartOverComponentFactory": {},
+ },
+ "tabStopsViewStoreData": {
+ "failureInstanceState": {},
+ },
+ "tabStoreData": {
+ "isChanged": false,
+ "isClosed": false,
+ "isOriginChanged": false,
+ "isPageHidden": false,
+ },
+ "visualizationConfigurationFactory": {},
+ "visualizationScanResultData": {
+ "accessibleNames": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "color": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "headings": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "issues": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "landmarks": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "needsReview": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "tabStops": {
+ "needToCollectTabbingResults": true,
+ "requirements": {
+ "focus-indicator": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "input-focus": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "keyboard-navigation": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "keyboard-traps": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "tab-order": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ },
+ "tabbedElements": null,
+ "tabbingCompleted": false,
+ },
+ },
+ "visualizationStoreData": {
+ "focusedTarget": null,
+ "injectingState": "notInjecting",
+ "scanning": null,
+ "selectedAdhocDetailsView": 1,
+ "selectedDetailsViewPivot": 0,
+ "selectedFastPassDetailsView": 1,
+ "tests": {
+ "adhoc": {
+ "accessibleNames": {
+ "enabled": false,
+ },
+ "color": {
+ "enabled": false,
+ },
+ "headings": {
+ "enabled": false,
+ },
+ "issues": {
+ "enabled": false,
+ },
+ "landmarks": {
+ "enabled": false,
+ },
+ "needsReview": {
+ "enabled": false,
+ },
+ "tabStops": {
+ "enabled": false,
+ },
+ },
+ "assessments": {
+ "audioVideoOnly": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "automated-checks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "cognitive": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "color": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "contrast": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "customWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "errors": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "headings": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "images": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "keyboardInteraction": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "landmarks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "language": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "linksAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "liveMultimedia": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "nativeWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "page": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "parsing": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "pointerMotion": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "prerecordedMultimedia": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "repetitiveContent": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "semanticsAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "sequence": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "textLegibility": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "timedEvents": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "visibleFocusOrder": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ },
+ "quickAssess": {
+ "automated-checks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "contrast": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "headings": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "images": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "keyboardInteraction": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "linksAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "nativeWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "repetitiveContent": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "textLegibility": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "visibleFocusOrder": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ },
+ },
+ },
+}
+`;
+
+exports[`DetailsViewBody render render: QuickAssessToAssessmentConfirmDialog props 1`] = `
+{
+ "deps": {
+ "detailsViewActionMessageCreator": {},
+ },
+ "isShown": true,
+}
+`;
+
+exports[`DetailsViewBody render render: TargetPageHiddenBar props 1`] = `
+{
+ "isTargetPageHidden": false,
+}
`;
diff --git a/src/tests/unit/tests/DetailsView/__snapshots__/details-view-container.test.tsx.snap b/src/tests/unit/tests/DetailsView/__snapshots__/details-view-container.test.tsx.snap
index bf3aa46d049..dde75107033 100644
--- a/src/tests/unit/tests/DetailsView/__snapshots__/details-view-container.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/__snapshots__/details-view-container.test.tsx.snap
@@ -1,15 +1,26 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DetailsViewContainer render content render once; should call details view opened 1`] = `
-
+
+
+`;
+
+exports[`DetailsViewContainer render content render once; should call details view opened: NarrowModeDetector props 1`] = `
+{
+ "Component": [Function],
+ "childrenProps": {
+ "deps": {
"detailsViewActionMessageCreator": [typemoq mock object],
"storesHub": [typemoq mock object],
- }
- }
- storeState={
- {
+ },
+ "isSideNavOpen": false,
+ "setSideNavOpen": [Function],
+ "storeState": {
"tabStoreData": {
"isClosed": false,
"isOriginChanged": false,
@@ -17,81 +28,102 @@ exports[`DetailsViewContainer render content render once; should call details vi
"visualizationStoreData": {
"selectedDetailsViewPivot": -1,
},
- }
- }
-/>
+ },
+ },
+ "deps": {
+ "detailsViewActionMessageCreator": [typemoq mock object],
+ "storesHub": [typemoq mock object],
+ },
+ "isNarrowModeEnabled": true,
+}
`;
exports[`DetailsViewContainer render content show NoContentAvailable when stores are not loaded 1`] = `
-
-
+
-
-
+
+
+`;
+
+exports[`DetailsViewContainer render content show NoContentAvailable when stores are not loaded: NarrowModeDetector props 1`] = `
+{
+ "Component": [Function],
+ "childrenProps": {
+ "deps": {
+ "storesHub": [typemoq mock object],
+ },
+ },
+ "deps": {
+ "storesHub": [typemoq mock object],
+ },
+ "isNarrowModeEnabled": false,
+}
`;
exports[`DetailsViewContainer render content show NoContentAvailable when target tab is closed 1`] = `
-
-
+
-
-
+
+
+`;
+
+exports[`DetailsViewContainer render content show NoContentAvailable when target tab is closed: NarrowModeDetector props 1`] = `
+{
+ "Component": [Function],
+ "childrenProps": {
+ "deps": {
+ "storesHub": [typemoq mock object],
+ },
+ },
+ "deps": {
+ "storesHub": [typemoq mock object],
+ },
+ "isNarrowModeEnabled": true,
+}
`;
exports[`DetailsViewContainer render content shows NoContentAvailable when target page is changed and no permissions granted 1`] = `
-
-
+
-
-
+
+
+`;
+
+exports[`DetailsViewContainer render content shows NoContentAvailable when target page is changed and no permissions granted: NarrowModeDetector props 1`] = `
+{
+ "Component": [Function],
+ "childrenProps": {
+ "deps": {
+ "storesHub": [typemoq mock object],
+ },
+ },
+ "deps": {
+ "storesHub": [typemoq mock object],
+ },
+ "isNarrowModeEnabled": true,
+}
`;
exports[`DetailsViewContainer render renders spinner when stores not ready 1`] = `
-
+
+
+
`;
+
+exports[`DetailsViewContainer render renders spinner when stores not ready: NarrowModeDetector props 1`] = `undefined`;
diff --git a/src/tests/unit/tests/DetailsView/__snapshots__/details-view-content.test.tsx.snap b/src/tests/unit/tests/DetailsView/__snapshots__/details-view-content.test.tsx.snap
index dd76de7148d..9c3a00d337a 100644
--- a/src/tests/unit/tests/DetailsView/__snapshots__/details-view-content.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/__snapshots__/details-view-content.test.tsx.snap
@@ -1,170 +1,248 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DetailsViewContent render renders normally 1`] = `
-
-
+
-
+
+
+`;
+
+exports[`DetailsViewContent render renders normally: DetailsViewBody props 1`] = `
+{
+ "assessmentCardsViewData": {
+ "allCardsCollapsed": true,
+ },
+ "assessmentInstanceTableHandler": [typemoq mock object],
+ "assessmentStoreData": {
+ "assessmentNavState": {
+ "selectedTestSubview": null,
+ "selectedTestType": null,
+ },
+ "assessments": {},
+ "persistedTabInfo": null,
+ "resultDescription": "",
+ },
+ "automatedChecksCardsViewData": {
+ "allCardsCollapsed": false,
+ },
+ "cardsViewStoreData": undefined,
+ "clickHandlerFactory": undefined,
+ "dataTransferViewStoreData": {
+ "showQuickAssessToAssessmentConfirmDialog": false,
+ },
+ "deps": {
+ "convertAssessmentStoreDataToScanNodeResults": [Function],
+ "convertUnifiedStoreDataToScanNodeResults": [Function],
+ "defaultRulesMap": {
+ "some-rule": {
+ "a11yCriteria": null,
+ "help": "some help",
+ "id": "some-rule",
+ },
+ },
+ "detailsViewActionMessageCreator": [typemoq mock object],
+ "dropdownClickHandler": [typemoq mock object],
+ "getAssessmentInstanceTableHandler": [Function],
+ "getCardSelectionViewData": [Function],
+ "getCardViewData": [Function],
+ "getDateFromTimestamp": [Function],
+ "getDetailsRightPanelConfiguration": [Function],
+ "getDetailsSwitcherNavConfiguration": [Function],
+ "isResultHighlightUnavailable": [Function],
+ "storesHub": [typemoq mock object],
+ "visualizationConfigurationFactory": [typemoq mock object],
+ },
+ "detailsViewStoreData": {
+ "contentPath": "",
+ "contentTitle": "",
+ "currentPanel": {
+ "isContentOpen": false,
+ "isPreviewFeaturesOpen": false,
+ "isScopingOpen": false,
+ "isSettingsOpen": false,
+ },
+ "detailsViewRightContentPanel": "TestView",
+ },
+ "dropdownClickHandler": [typemoq mock object],
+ "featureFlagStoreData": {
+ "logTelemetryToConsole": false,
+ },
+ "getOverviewHeadingIntro": undefined,
+ "getOverviewHelpSectionAbout": undefined,
+ "isSideNavOpen": false,
+ "issuesTableHandler": undefined,
+ "linkDataSource": undefined,
+ "narrowModeStatus": {
+ "isCardFooterCollapsed": false,
+ "isCommandBarCollapsed": false,
+ "isHeaderAndNavCollapsed": false,
+ "isVirtualKeyboardCollapsed": false,
+ },
+ "needsReviewCardsViewData": {
+ "allCardsCollapsed": true,
+ "visualHelperEnabled": true,
+ },
+ "pathSnippetStoreData": {
+ "path": null,
+ "snippet": null,
+ },
+ "rightPanelConfiguration": {},
+ "scanIncompleteWarnings": undefined,
+ "scanMetadata": {
+ "targetAppInfo": {
+ "name": "DetailsViewContainerTest title",
+ "url": "http://detailsViewContainerTest/url/",
+ },
+ "timespan": {
+ "scanComplete": 1900-02-02T03:00:00.000Z,
+ },
+ "toolData": {
+ "applicationProperties": {
+ "name": "some app",
+ },
+ },
+ },
+ "selectedTest": -1,
+ "setSideNavOpen": [Function],
+ "switcherNavConfiguration": {
+ "getSelectedAssessmentCardSelectionStoreData": [Function],
+ "getSelectedAssessmentStoreData": [Function],
+ "getSelectedDetailsView": [Function],
+ },
+ "tabStopRequirementData": {
+ "focus-indicator": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "input-focus": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "keyboard-navigation": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "keyboard-traps": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ "tab-order": {
+ "instances": [],
+ "isExpanded": false,
+ "status": "unknown",
+ },
+ },
+ "tabStopsViewStoreData": {
+ "failureInstanceState": {
+ "actionType": "CREATE",
+ "description": null,
+ "isPanelOpen": false,
+ "selectedInstanceId": null,
+ "selectedRequirementId": null,
+ },
+ },
+ "tabStoreData": {
+ "id": 1,
+ "isChanged": false,
+ "isClosed": false,
+ "isOriginChanged": false,
+ "isPageHidden": false,
+ "title": "DetailsViewContainerTest title",
+ "url": "http://detailsViewContainerTest/url/",
+ },
+ "testViewContainerProvider": undefined,
+ "userConfigurationStoreData": {
+ "bugService": "gitHub",
+ "bugServicePropertiesMap": {
+ "gitHub": {
+ "repository": "gitHub-repository",
+ },
+ },
+ "enableHighContrast": false,
+ "enableTelemetry": true,
+ "isFirstTime": false,
+ "lastSelectedHighContrast": false,
+ "showAutoDetectedFailuresDialog": true,
+ "showSaveAssessmentDialog": true,
+ },
+ "visualizationConfigurationFactory": [typemoq mock object],
+ "visualizationScanResultData": {
+ "accessibleNames": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "color": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "headings": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "issues": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "landmarks": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "needsReview": {
+ "fullAxeResultsMap": null,
+ "fullIdToRuleResultMap": null,
+ "scanResult": null,
+ },
+ "tabStops": {
+ "needToCollectTabbingResults": true,
+ "requirements": {
"focus-indicator": {
"instances": [],
"isExpanded": false,
@@ -190,360 +268,292 @@ exports[`DetailsViewContent render renders normally 1`] = `
"isExpanded": false,
"status": "unknown",
},
- }
- }
- tabStopsViewStoreData={
- {
- "failureInstanceState": {
- "actionType": "CREATE",
- "description": null,
- "isPanelOpen": false,
- "selectedInstanceId": null,
- "selectedRequirementId": null,
- },
- }
- }
- tabStoreData={
- {
- "id": 1,
- "isChanged": false,
- "isClosed": false,
- "isOriginChanged": false,
- "isPageHidden": false,
- "title": "DetailsViewContainerTest title",
- "url": "http://detailsViewContainerTest/url/",
- }
- }
- userConfigurationStoreData={
- {
- "bugService": "gitHub",
- "bugServicePropertiesMap": {
- "gitHub": {
- "repository": "gitHub-repository",
- },
- },
- "enableHighContrast": false,
- "enableTelemetry": true,
- "isFirstTime": false,
- "lastSelectedHighContrast": false,
- "showAutoDetectedFailuresDialog": true,
- "showSaveAssessmentDialog": true,
- }
- }
- visualizationConfigurationFactory={[typemoq mock object]}
- visualizationScanResultData={
- {
+ },
+ "tabbedElements": null,
+ "tabbingCompleted": false,
+ },
+ },
+ "visualizationStoreData": {
+ "focusedTarget": null,
+ "injectingState": "notInjecting",
+ "scanning": null,
+ "selectedAdhocDetailsView": -1,
+ "selectedDetailsViewPivot": 0,
+ "selectedFastPassDetailsView": 1,
+ "tests": {
+ "adhoc": {
"accessibleNames": {
- "fullAxeResultsMap": null,
- "fullIdToRuleResultMap": null,
- "scanResult": null,
+ "enabled": false,
},
"color": {
- "fullAxeResultsMap": null,
- "fullIdToRuleResultMap": null,
- "scanResult": null,
+ "enabled": false,
},
"headings": {
- "fullAxeResultsMap": null,
- "fullIdToRuleResultMap": null,
- "scanResult": null,
+ "enabled": false,
},
"issues": {
- "fullAxeResultsMap": null,
- "fullIdToRuleResultMap": null,
- "scanResult": null,
+ "enabled": false,
},
"landmarks": {
- "fullAxeResultsMap": null,
- "fullIdToRuleResultMap": null,
- "scanResult": null,
+ "enabled": false,
},
"needsReview": {
- "fullAxeResultsMap": null,
- "fullIdToRuleResultMap": null,
- "scanResult": null,
+ "enabled": false,
},
"tabStops": {
- "needToCollectTabbingResults": true,
- "requirements": {
- "focus-indicator": {
- "instances": [],
- "isExpanded": false,
- "status": "unknown",
- },
- "input-focus": {
- "instances": [],
- "isExpanded": false,
- "status": "unknown",
- },
- "keyboard-navigation": {
- "instances": [],
- "isExpanded": false,
- "status": "unknown",
- },
- "keyboard-traps": {
- "instances": [],
- "isExpanded": false,
- "status": "unknown",
- },
- "tab-order": {
- "instances": [],
- "isExpanded": false,
- "status": "unknown",
- },
- },
- "tabbedElements": null,
- "tabbingCompleted": false,
- },
- }
- }
- visualizationStoreData={
- {
- "focusedTarget": null,
- "injectingState": "notInjecting",
- "scanning": null,
- "selectedAdhocDetailsView": -1,
- "selectedDetailsViewPivot": 0,
- "selectedFastPassDetailsView": 1,
- "tests": {
- "adhoc": {
- "accessibleNames": {
- "enabled": false,
- },
- "color": {
- "enabled": false,
- },
- "headings": {
- "enabled": false,
- },
- "issues": {
- "enabled": false,
- },
- "landmarks": {
- "enabled": false,
- },
- "needsReview": {
- "enabled": false,
- },
- "tabStops": {
- "enabled": false,
- },
- },
- "assessments": {
- "audioVideoOnly": {
- "enabled": false,
- "stepStatus": {},
- },
- "automated-checks": {
- "enabled": false,
- "stepStatus": {},
- },
- "cognitive": {
- "enabled": false,
- "stepStatus": {},
- },
- "color": {
- "enabled": false,
- "stepStatus": {},
- },
- "contrast": {
- "enabled": false,
- "stepStatus": {},
- },
- "customWidgets": {
- "enabled": false,
- "stepStatus": {},
- },
- "errors": {
- "enabled": false,
- "stepStatus": {},
- },
- "headings": {
- "enabled": false,
- "stepStatus": {},
- },
- "images": {
- "enabled": false,
- "stepStatus": {},
- },
- "keyboardInteraction": {
- "enabled": false,
- "stepStatus": {},
- },
- "landmarks": {
- "enabled": false,
- "stepStatus": {},
- },
- "language": {
- "enabled": false,
- "stepStatus": {},
- },
- "linksAssessment": {
- "enabled": false,
- "stepStatus": {},
- },
- "liveMultimedia": {
- "enabled": false,
- "stepStatus": {},
- },
- "nativeWidgets": {
- "enabled": false,
- "stepStatus": {},
- },
- "page": {
- "enabled": false,
- "stepStatus": {},
- },
- "parsing": {
- "enabled": false,
- "stepStatus": {},
- },
- "pointerMotion": {
- "enabled": false,
- "stepStatus": {},
- },
- "prerecordedMultimedia": {
- "enabled": false,
- "stepStatus": {},
- },
- "repetitiveContent": {
- "enabled": false,
- "stepStatus": {},
- },
- "semanticsAssessment": {
- "enabled": false,
- "stepStatus": {},
- },
- "sequence": {
- "enabled": false,
- "stepStatus": {},
- },
- "textLegibility": {
- "enabled": false,
- "stepStatus": {},
- },
- "timedEvents": {
- "enabled": false,
- "stepStatus": {},
- },
- "visibleFocusOrder": {
- "enabled": false,
- "stepStatus": {},
- },
- },
- "quickAssess": {
- "automated-checks": {
- "enabled": false,
- "stepStatus": {},
- },
- "contrast": {
- "enabled": false,
- "stepStatus": {},
- },
- "headings": {
- "enabled": false,
- "stepStatus": {},
- },
- "images": {
- "enabled": false,
- "stepStatus": {},
- },
- "keyboardInteraction": {
- "enabled": false,
- "stepStatus": {},
- },
- "linksAssessment": {
- "enabled": false,
- "stepStatus": {},
- },
- "nativeWidgets": {
- "enabled": false,
- "stepStatus": {},
- },
- "repetitiveContent": {
- "enabled": false,
- "stepStatus": {},
- },
- "textLegibility": {
- "enabled": false,
- "stepStatus": {},
- },
- "visibleFocusOrder": {
- "enabled": false,
- "stepStatus": {},
- },
- },
- },
- }
- }
- />
-
-
+ "enabled": false,
+ },
+ },
+ "assessments": {
+ "audioVideoOnly": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "automated-checks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "cognitive": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "color": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "contrast": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "customWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "errors": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "headings": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "images": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "keyboardInteraction": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "landmarks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "language": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "linksAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "liveMultimedia": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "nativeWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "page": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "parsing": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "pointerMotion": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "prerecordedMultimedia": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "repetitiveContent": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "semanticsAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "sequence": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "textLegibility": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "timedEvents": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "visibleFocusOrder": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ },
+ "quickAssess": {
+ "automated-checks": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "contrast": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "headings": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "images": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "keyboardInteraction": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "linksAssessment": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "nativeWidgets": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "repetitiveContent": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "textLegibility": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ "visibleFocusOrder": {
+ "enabled": false,
+ "stepStatus": {},
+ },
+ },
+ },
+ },
+}
+`;
+
+exports[`DetailsViewContent render renders normally: DetailsViewOverlay props 1`] = `
+{
+ "deps": {
+ "convertAssessmentStoreDataToScanNodeResults": [Function],
+ "convertUnifiedStoreDataToScanNodeResults": [Function],
+ "defaultRulesMap": {
+ "some-rule": {
+ "a11yCriteria": null,
+ "help": "some help",
+ "id": "some-rule",
+ },
+ },
+ "detailsViewActionMessageCreator": [typemoq mock object],
+ "dropdownClickHandler": [typemoq mock object],
+ "getAssessmentInstanceTableHandler": [Function],
+ "getCardSelectionViewData": [Function],
+ "getCardViewData": [Function],
+ "getDateFromTimestamp": [Function],
+ "getDetailsRightPanelConfiguration": [Function],
+ "getDetailsSwitcherNavConfiguration": [Function],
+ "isResultHighlightUnavailable": [Function],
+ "storesHub": [typemoq mock object],
+ "visualizationConfigurationFactory": [typemoq mock object],
+ },
+ "detailsViewStoreData": {
+ "contentPath": "",
+ "contentTitle": "",
+ "currentPanel": {
+ "isContentOpen": false,
+ "isPreviewFeaturesOpen": false,
+ "isScopingOpen": false,
+ "isSettingsOpen": false,
+ },
+ "detailsViewRightContentPanel": "TestView",
+ },
+ "featureFlagStoreData": {
+ "logTelemetryToConsole": false,
+ },
+ "inspectActionMessageCreator": undefined,
+ "previewFeatureFlagsHandler": undefined,
+ "scopingActionMessageCreator": undefined,
+ "scopingStoreData": {
+ "selectors": {
+ "exclude": [],
+ "include": [],
+ },
+ },
+ "userConfigurationStoreData": {
+ "bugService": "gitHub",
+ "bugServicePropertiesMap": {
+ "gitHub": {
+ "repository": "gitHub-repository",
+ },
+ },
+ "enableHighContrast": false,
+ "enableTelemetry": true,
+ "isFirstTime": false,
+ "lastSelectedHighContrast": false,
+ "showAutoDetectedFailuresDialog": true,
+ "showSaveAssessmentDialog": true,
+ },
+}
+`;
+
+exports[`DetailsViewContent render renders normally: InteractiveHeader props 1`] = `
+{
+ "deps": {
+ "convertAssessmentStoreDataToScanNodeResults": [Function],
+ "convertUnifiedStoreDataToScanNodeResults": [Function],
+ "defaultRulesMap": {
+ "some-rule": {
+ "a11yCriteria": null,
+ "help": "some help",
+ "id": "some-rule",
+ },
+ },
+ "detailsViewActionMessageCreator": [typemoq mock object],
+ "dropdownClickHandler": [typemoq mock object],
+ "getAssessmentInstanceTableHandler": [Function],
+ "getCardSelectionViewData": [Function],
+ "getCardViewData": [Function],
+ "getDateFromTimestamp": [Function],
+ "getDetailsRightPanelConfiguration": [Function],
+ "getDetailsSwitcherNavConfiguration": [Function],
+ "isResultHighlightUnavailable": [Function],
+ "storesHub": [typemoq mock object],
+ "visualizationConfigurationFactory": [typemoq mock object],
+ },
+ "featureFlagStoreData": {
+ "logTelemetryToConsole": false,
+ },
+ "isSideNavOpen": false,
+ "narrowModeStatus": {
+ "isCardFooterCollapsed": false,
+ "isCommandBarCollapsed": false,
+ "isHeaderAndNavCollapsed": false,
+ "isVirtualKeyboardCollapsed": false,
+ },
+ "navMenu": undefined,
+ "selectedPivot": 0,
+ "setSideNavOpen": [Function],
+ "tabClosed": false,
+}
`;
diff --git a/src/tests/unit/tests/DetailsView/components/__snapshots__/status-icon.test.tsx.snap b/src/tests/unit/tests/DetailsView/components/__snapshots__/status-icon.test.tsx.snap
index d5c0fa2f438..8cd2953226a 100644
--- a/src/tests/unit/tests/DetailsView/components/__snapshots__/status-icon.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/components/__snapshots__/status-icon.test.tsx.snap
@@ -1,46 +1,56 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`StatusIcon render for FAIL 1`] = `
-
+
+
+
`;
exports[`StatusIcon render for PASS 1`] = `
-
+
+
+
`;
exports[`StatusIcon render for PASS with extra class name 1`] = `
-
+
+
+
`;
exports[`StatusIcon render for UNKNOWN 1`] = `
-
+
+
+
`;
exports[`StatusIcon render for default 1`] = `
-
+
+
+
`;
diff --git a/src/tests/unit/tests/DetailsView/components/__snapshots__/switcher.test.tsx.snap b/src/tests/unit/tests/DetailsView/components/__snapshots__/switcher.test.tsx.snap
index 33b1e128a32..471619bc465 100644
--- a/src/tests/unit/tests/DetailsView/components/__snapshots__/switcher.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/components/__snapshots__/switcher.test.tsx.snap
@@ -30,22 +30,29 @@ exports[`Switcher props dropdown has correct options 1`] = `
`;
exports[`Switcher renders Switcher itself matches snapshot 1`] = `
-"
-
-
"
+
+
+
+
+
`;
exports[`Switcher renders option renderer override matches snapshot 1`] = `
-
- FastPass
-
+ />
`;
diff --git a/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-failed-instance-section.test.tsx.snap b/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-failed-instance-section.test.tsx.snap
index e76b4c91948..ab03b87ef0f 100644
--- a/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-failed-instance-section.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-failed-instance-section.test.tsx.snap
@@ -1,78 +1,87 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`TabStopsFailedInstanceSection does not render when no results are failing 1`] = `null`;
+exports[`TabStopsFailedInstanceSection does not render when no results are failing 1`] = ``;
exports[`TabStopsFailedInstanceSection does renders when no results are failing and set to alwaysRenderSection 1`] = `
-
+
`;
exports[`TabStopsFailedInstanceSection renders with failing results 1`] = `
-
-
+
-
+
+
+
-
-
+
+`;
+
+exports[`TabStopsFailedInstanceSection renders with failing results: TabStopsRequirementsWithInstances props 1`] = `
+{
+ "deps": {},
+ "getCollapsibleComponentPropsWithInstance": [Function],
+ "headingLevel": 3,
+ "results": [
+ {
+ "description": "All interactive elements can be reached using the Tab and arrow keys. (Partially automated)",
+ "id": "keyboard-navigation",
+ "instances": [
{
- "description": "All interactive elements can be reached using the Tab and arrow keys. (Partially automated)",
- "id": "keyboard-navigation",
- "instances": [
- {
- "description": "test desc 1",
- "id": "test-id-1",
- },
- ],
- "isExpanded": false,
- "name": "Keyboard navigation",
+ "description": "test desc 1",
+ "id": "test-id-1",
},
+ ],
+ "isExpanded": false,
+ "name": "Keyboard navigation",
+ },
+ {
+ "description": "There are no interactive elements that “trap” input focus and prevent navigating away. (Partially automated)",
+ "id": "keyboard-traps",
+ "instances": [
{
- "description": "There are no interactive elements that “trap” input focus and prevent navigating away. (Partially automated)",
- "id": "keyboard-traps",
- "instances": [
- {
- "description": "test desc 2",
- "id": "test-id-2",
- },
- ],
- "isExpanded": false,
- "name": "Keyboard traps",
+ "description": "test desc 2",
+ "id": "test-id-2",
},
- ]
- }
- />
-
+ ],
+ "isExpanded": false,
+ "name": "Keyboard traps",
+ },
+ ],
+}
`;
diff --git a/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-minimal-requirement-header.test.tsx.snap b/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-minimal-requirement-header.test.tsx.snap
index 0522547952e..dfad718e097 100644
--- a/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-minimal-requirement-header.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-minimal-requirement-header.test.tsx.snap
@@ -1,33 +1,35 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TabStopsMinimalRequirementHeader renders 1`] = `
-
-
-
-
+
+
+
+
+
+
-
-
-
-
- test requirement name
-
-
- :
-
- test requirement description
+
+
+
+ test requirement name
+
+
+ :
+
+ test requirement description
+
-
+
`;
diff --git a/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-requirement-instances-collapsible-content.test.tsx.snap b/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-requirement-instances-collapsible-content.test.tsx.snap
index e2608d187d4..a80b7ad82d3 100644
--- a/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-requirement-instances-collapsible-content.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-requirement-instances-collapsible-content.test.tsx.snap
@@ -1,43 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TabStopsRequirementInstancesCollapsibleContent renders 1`] = `
-
+
+
+
`;
exports[`TabStopsRequirementInstancesCollapsibleContent renders captured instance details column 1`] = `
@@ -70,3 +41,39 @@ exports[`TabStopsRequirementInstancesCollapsibleContent renders captured instanc
`;
+
+exports[`TabStopsRequirementInstancesCollapsibleContent renders: StyledWithViewportComponent props 1`] = `
+{
+ "checkboxVisibility": 2,
+ "columns": [
+ {
+ "columnActionsMode": 0,
+ "fieldName": "description",
+ "isResizable": true,
+ "key": "failureDescription",
+ "minWidth": 100,
+ "name": "Failure description",
+ "onRender": [Function],
+ },
+ {
+ "columnActionsMode": 0,
+ "fieldName": "instanceActionButtons",
+ "isIconOnly": true,
+ "isResizable": false,
+ "key": "instanceActionButtons",
+ "maxWidth": 124,
+ "minWidth": 124,
+ "name": "instance actions",
+ "onRender": [Function],
+ },
+ ],
+ "constrainMode": 1,
+ "items": [
+ {
+ "description": "test-description",
+ "id": "test-instance-id",
+ },
+ ],
+ "onRenderDetailsHeader": [Function],
+}
+`;
diff --git a/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-requirements-with-instances.test.tsx.snap b/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-requirements-with-instances.test.tsx.snap
index c5ab22efb56..c2d5bc3117a 100644
--- a/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-requirements-with-instances.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/components/__snapshots__/tab-stops-requirements-with-instances.test.tsx.snap
@@ -1,37 +1,37 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TabStopsRequirementsWithInstances renders component instance count === 0 1`] = `
-
+
`;
-exports[`TabStopsRequirementsWithInstances renders empty div when instance count === 0 1`] = ``;
+exports[`TabStopsRequirementsWithInstances renders empty div when instance count === 0 1`] = `
+
+
+
+`;
exports[`TabStopsRequirementsWithInstances renders when instance count > 0 1`] = `
-
+
`;
diff --git a/src/tests/unit/tests/DetailsView/components/__snapshots__/target-change-dialog.test.tsx.snap b/src/tests/unit/tests/DetailsView/components/__snapshots__/target-change-dialog.test.tsx.snap
index a8d6617960f..a22d434c802 100644
--- a/src/tests/unit/tests/DetailsView/components/__snapshots__/target-change-dialog.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/components/__snapshots__/target-change-dialog.test.tsx.snap
@@ -1,254 +1,329 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TargetChangeDialog test sets for same prev tab and newTab values snapshot: render the only information available in prevTab detailsViewId matches current detailsViewId 1`] = `
-
- Would you like to continue your current assessment on the new target of
-
-
+
+
+`;
+
+exports[`TargetChangeDialog test sets for same prev tab and newTab values snapshot: render the only information available in prevTab detailsViewId matches current detailsViewId: ChangeAssessmentDialog props 1`] = `
+{
+ "dialogContentTitle": "Assessment in progress",
+ "dialogFirstText":
+ Would you like to continue your current assessment on the new target of
+
+
+
-
- test title 2
-
-
- ?
-
- }
- dialogNoteText="If 'Continue previous' is selected, the previous assessment will be connected to this new page."
- dialogWarningText="If 'Start new' is selected, all previous progress will be lost."
- divId="target-change-dialog-description"
- isOpen={true}
- leftButtonOnClick={[Function]}
- leftButtonText="Continue previous"
- prevTab={
- {
- "detailsViewId": "differentDetailsViewId",
- "id": 456,
- }
- }
- rightButtonDataAutomationId="target-change-start-new-button"
- rightButtonOnClick={[Function]}
- rightButtonStyle="restartButton"
- rightButtonText="Start new"
- subtitleAriaId="target-change-dialog-description"
-/>
+ test title 2
+
+
+ ?
+ ,
+ "dialogNoteText": "If 'Continue previous' is selected, the previous assessment will be connected to this new page.",
+ "dialogWarningText": "If 'Start new' is selected, all previous progress will be lost.",
+ "divId": "target-change-dialog-description",
+ "isOpen": true,
+ "leftButtonOnClick": [Function],
+ "leftButtonText": "Continue previous",
+ "prevTab": {
+ "detailsViewId": "differentDetailsViewId",
+ "id": 456,
+ },
+ "rightButtonDataAutomationId": "target-change-start-new-button",
+ "rightButtonOnClick": [Function],
+ "rightButtonStyle": "restartButton",
+ "rightButtonText": "Start new",
+ "subtitleAriaId": "target-change-dialog-description",
+}
`;
exports[`TargetChangeDialog test sets for same prev tab and newTab values snapshot: render when previous tab info shows app is refreshed 1`] = `
-
- Would you like to continue your current assessment on the new target of
-
-
+
+
+`;
+
+exports[`TargetChangeDialog test sets for same prev tab and newTab values snapshot: render when previous tab info shows app is refreshed: ChangeAssessmentDialog props 1`] = `
+{
+ "dialogContentTitle": "Assessment in progress",
+ "dialogFirstText":
+ Would you like to continue your current assessment on the new target of
+
+
+
-
- test title 2
-
-
- ?
-
- }
- dialogNoteText="If 'Continue previous' is selected, the previous assessment will be connected to this new page."
- dialogWarningText="If 'Start new' is selected, all previous progress will be lost."
- divId="target-change-dialog-description"
- isOpen={true}
- leftButtonOnClick={[Function]}
- leftButtonText="Continue previous"
- prevTab={
- {
- "detailsViewId": "differentDetailsViewId",
- "id": 111,
- "title": "test title 1",
- "url": "https://www.abc.com",
- }
- }
- rightButtonDataAutomationId="target-change-start-new-button"
- rightButtonOnClick={[Function]}
- rightButtonStyle="restartButton"
- rightButtonText="Start new"
- subtitleAriaId="target-change-dialog-description"
-/>
+ test title 2
+
+
+ ?
+ ,
+ "dialogNoteText": "If 'Continue previous' is selected, the previous assessment will be connected to this new page.",
+ "dialogWarningText": "If 'Start new' is selected, all previous progress will be lost.",
+ "divId": "target-change-dialog-description",
+ "isOpen": true,
+ "leftButtonOnClick": [Function],
+ "leftButtonText": "Continue previous",
+ "prevTab": {
+ "detailsViewId": "differentDetailsViewId",
+ "id": 111,
+ "title": "test title 1",
+ "url": "https://www.abc.com",
+ },
+ "rightButtonDataAutomationId": "target-change-start-new-button",
+ "rightButtonOnClick": [Function],
+ "rightButtonStyle": "restartButton",
+ "rightButtonText": "Start new",
+ "subtitleAriaId": "target-change-dialog-description",
+}
`;
exports[`TargetChangeDialog test sets for same prev tab and newTab values snapshot: render when tab ids are same and also url doesn't change 1`] = `
-
- Would you like to continue your current assessment on the new target of
-
-
+
+
+`;
+
+exports[`TargetChangeDialog test sets for same prev tab and newTab values snapshot: render when tab ids are same and also url doesn't change: ChangeAssessmentDialog props 1`] = `
+{
+ "dialogContentTitle": "Assessment in progress",
+ "dialogFirstText":
+ Would you like to continue your current assessment on the new target of
+
+
+
-
- test title 2
-
-
- ?
-
- }
- dialogNoteText="If 'Continue previous' is selected, the previous assessment will be connected to this new page."
- dialogWarningText="If 'Start new' is selected, all previous progress will be lost."
- divId="target-change-dialog-description"
- isOpen={true}
- leftButtonOnClick={[Function]}
- leftButtonText="Continue previous"
- prevTab={
- {
- "detailsViewId": "detailsViewId",
- "id": 111,
- "title": "test title 1",
- "url": "https://www.abc.com",
- }
- }
- rightButtonDataAutomationId="target-change-start-new-button"
- rightButtonOnClick={[Function]}
- rightButtonStyle="restartButton"
- rightButtonText="Start new"
- subtitleAriaId="target-change-dialog-description"
-/>
+ test title 2
+
+
+ ?
+ ,
+ "dialogNoteText": "If 'Continue previous' is selected, the previous assessment will be connected to this new page.",
+ "dialogWarningText": "If 'Start new' is selected, all previous progress will be lost.",
+ "divId": "target-change-dialog-description",
+ "isOpen": true,
+ "leftButtonOnClick": [Function],
+ "leftButtonText": "Continue previous",
+ "prevTab": {
+ "detailsViewId": "detailsViewId",
+ "id": 111,
+ "title": "test title 1",
+ "url": "https://www.abc.com",
+ },
+ "rightButtonDataAutomationId": "target-change-start-new-button",
+ "rightButtonOnClick": [Function],
+ "rightButtonStyle": "restartButton",
+ "rightButtonText": "Start new",
+ "subtitleAriaId": "target-change-dialog-description",
+}
`;
exports[`TargetChangeDialog test sets for same prev tab and newTab values snapshot: render when tab ids are same but url changes 1`] = `
-
- Would you like to continue your current assessment on the new target of
-
-
+
+
+`;
+
+exports[`TargetChangeDialog test sets for same prev tab and newTab values snapshot: render when tab ids are same but url changes: ChangeAssessmentDialog props 1`] = `
+{
+ "dialogContentTitle": "Assessment in progress",
+ "dialogFirstText":
+ Would you like to continue your current assessment on the new target of
+
+
+
-
- test title 2
-
-
- ?
-
- }
- dialogNoteText="If 'Continue previous' is selected, the previous assessment will be connected to this new page."
- dialogWarningText="If 'Start new' is selected, all previous progress will be lost."
- divId="target-change-dialog-description"
- isOpen={true}
- leftButtonOnClick={[Function]}
- leftButtonText="Continue previous"
- prevTab={
- {
- "detailsViewId": "detailsViewId",
- "id": 111,
- "title": "test title 1",
- "url": "https://www.abc.com",
- }
- }
- rightButtonDataAutomationId="target-change-start-new-button"
- rightButtonOnClick={[Function]}
- rightButtonStyle="restartButton"
- rightButtonText="Start new"
- subtitleAriaId="target-change-dialog-description"
-/>
+ test title 2
+
+
+ ?
+ ,
+ "dialogNoteText": "If 'Continue previous' is selected, the previous assessment will be connected to this new page.",
+ "dialogWarningText": "If 'Start new' is selected, all previous progress will be lost.",
+ "divId": "target-change-dialog-description",
+ "isOpen": true,
+ "leftButtonOnClick": [Function],
+ "leftButtonText": "Continue previous",
+ "prevTab": {
+ "detailsViewId": "detailsViewId",
+ "id": 111,
+ "title": "test title 1",
+ "url": "https://www.abc.com",
+ },
+ "rightButtonDataAutomationId": "target-change-start-new-button",
+ "rightButtonOnClick": [Function],
+ "rightButtonStyle": "restartButton",
+ "rightButtonText": "Start new",
+ "subtitleAriaId": "target-change-dialog-description",
+}
`;
exports[`TargetChangeDialog test sets for same prev tab and newTab values snapshot: render when target tab id changed 1`] = `
-
- Would you like to continue your current assessment on the new target of
-
-
+
+
+`;
+
+exports[`TargetChangeDialog test sets for same prev tab and newTab values snapshot: render when target tab id changed: ChangeAssessmentDialog props 1`] = `
+{
+ "dialogContentTitle": "Assessment in progress",
+ "dialogFirstText":
+ Would you like to continue your current assessment on the new target of
+
+
+
-
- test title 2
-
-
- ?
-
- }
- dialogNoteText="If 'Continue previous' is selected, the previous assessment will be connected to this new page."
- dialogWarningText="If 'Start new' is selected, all previous progress will be lost."
- divId="target-change-dialog-description"
- isOpen={true}
- leftButtonOnClick={[Function]}
- leftButtonText="Continue previous"
- prevTab={
- {
- "detailsViewId": "detailsViewId",
- "id": 111,
- "title": "test title 1",
- "url": "https://www.abc.com",
- }
- }
- rightButtonDataAutomationId="target-change-start-new-button"
- rightButtonOnClick={[Function]}
- rightButtonStyle="restartButton"
- rightButtonText="Start new"
- subtitleAriaId="target-change-dialog-description"
-/>
+ test title 2
+
+
+ ?
+ ,
+ "dialogNoteText": "If 'Continue previous' is selected, the previous assessment will be connected to this new page.",
+ "dialogWarningText": "If 'Start new' is selected, all previous progress will be lost.",
+ "divId": "target-change-dialog-description",
+ "isOpen": true,
+ "leftButtonOnClick": [Function],
+ "leftButtonText": "Continue previous",
+ "prevTab": {
+ "detailsViewId": "detailsViewId",
+ "id": 111,
+ "title": "test title 1",
+ "url": "https://www.abc.com",
+ },
+ "rightButtonDataAutomationId": "target-change-start-new-button",
+ "rightButtonOnClick": [Function],
+ "rightButtonStyle": "restartButton",
+ "rightButtonText": "Start new",
+ "subtitleAriaId": "target-change-dialog-description",
+}
`;
diff --git a/src/tests/unit/tests/DetailsView/components/__snapshots__/target-page-changed-view.test.tsx.snap b/src/tests/unit/tests/DetailsView/components/__snapshots__/target-page-changed-view.test.tsx.snap
index 89c2a6d05c7..5c26d7a4bc3 100644
--- a/src/tests/unit/tests/DetailsView/components/__snapshots__/target-page-changed-view.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/components/__snapshots__/target-page-changed-view.test.tsx.snap
@@ -1,72 +1,72 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TargetPageChangedView renders with subtitle=test subtitle content and feature flag= false 1`] = `
-
-
- test title
-
+
- test subtitle content
-
-
-
+
+ test title
+
+
+ test subtitle content
+
+
The target page has changed. Use the
-
button to scan the new target page.
-
-
-
+
+
+
`;
exports[`TargetPageChangedView renders with subtitle=undefined and feature flag= false 1`] = `
-
-
- test title
-
+
-
-
+ class="staticContentInDetailsView"
+ >
+
+ test title
+
+
+
The target page has changed. Use the
-
button to scan the new target page.
-
-
-
+
+
+
`;
exports[`TargetPageChangedView renders with subtitle=undefined and feature flag= true 1`] = `
-
-
- test title
-
+
-
-
+ class="staticContentInDetailsView"
+ >
+
+ test title
+
+
+
The target page has changed. Use the
-
button to scan the new target page.
-
-
-
+
+
+
`;
diff --git a/src/tests/unit/tests/DetailsView/components/__snapshots__/target-page-hidden-bar.test.tsx.snap b/src/tests/unit/tests/DetailsView/components/__snapshots__/target-page-hidden-bar.test.tsx.snap
index 081d181799e..c300a6416b7 100644
--- a/src/tests/unit/tests/DetailsView/components/__snapshots__/target-page-hidden-bar.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/components/__snapshots__/target-page-hidden-bar.test.tsx.snap
@@ -1,7 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TargetPageHiddenBar renders per snapshot to indicate that the target page is hidden 1`] = `
-"
- The Target page is in a hidden state. For better performance, use the Target page link above to make the page visible.
-"
+
+
+ The Target page is in a hidden state. For better performance, use the Target page link above to make the page visible.
+
+
`;
diff --git a/src/tests/unit/tests/DetailsView/components/__snapshots__/test-status-choice-group.test.tsx.snap b/src/tests/unit/tests/DetailsView/components/__snapshots__/test-status-choice-group.test.tsx.snap
index fa90a2b33a6..be07d622ee9 100644
--- a/src/tests/unit/tests/DetailsView/components/__snapshots__/test-status-choice-group.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/components/__snapshots__/test-status-choice-group.test.tsx.snap
@@ -1,64 +1,88 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TestStatusChoiceGroup render: status is set to FAIL 1`] = `
-
+
+
+
+`;
+
+exports[`TestStatusChoiceGroup render: status is set to FAIL: ChoiceGroupPassFail props 1`] = `
+{
+ "isLabelVisible": false,
+ "onChange": [Function],
+ "onUndoClickedPassThrough": [Function],
+ "options": [
+ {
+ "key": 0,
+ "text": "Pass",
+ },
+ {
+ "key": 2,
+ "text": "Fail",
+ },
+ ],
+ "selectedKey": 2,
+}
`;
exports[`TestStatusChoiceGroup render: status is set to PASS 1`] = `
-
+
+
+
+`;
+
+exports[`TestStatusChoiceGroup render: status is set to PASS: ChoiceGroupPassFail props 1`] = `
+{
+ "isLabelVisible": false,
+ "onChange": [Function],
+ "onUndoClickedPassThrough": [Function],
+ "options": [
+ {
+ "key": 0,
+ "text": "Pass",
+ },
+ {
+ "key": 2,
+ "text": "Fail",
+ },
+ ],
+ "selectedKey": 0,
+}
`;
exports[`TestStatusChoiceGroup render: status is set to UNKNOWN 1`] = `
-
+
+
+
+`;
+
+exports[`TestStatusChoiceGroup render: status is set to UNKNOWN: ChoiceGroupPassFail props 1`] = `
+{
+ "isLabelVisible": false,
+ "onChange": [Function],
+ "onUndoClickedPassThrough": [Function],
+ "options": [
+ {
+ "key": 0,
+ "text": "Pass",
+ },
+ {
+ "key": 2,
+ "text": "Fail",
+ },
+ ],
+ "selectedKey": 1,
+}
`;
diff --git a/src/tests/unit/tests/DetailsView/components/__snapshots__/transfer-to-assessment-button.test.tsx.snap b/src/tests/unit/tests/DetailsView/components/__snapshots__/transfer-to-assessment-button.test.tsx.snap
index 3b3a489c99f..4e596b16b5b 100644
--- a/src/tests/unit/tests/DetailsView/components/__snapshots__/transfer-to-assessment-button.test.tsx.snap
+++ b/src/tests/unit/tests/DetailsView/components/__snapshots__/transfer-to-assessment-button.test.tsx.snap
@@ -11,15 +11,23 @@ exports[`TransferToAssessmentButton getTransferToAssessmentButton 1`] = `
`;
exports[`TransferToAssessmentButton render 1`] = `
-
- Move to assessment
-
+
+
+ Move to assessment
+
+
+`;
+
+exports[`TransferToAssessmentButton render: InsightsCommandButton props 1`] = `
+{
+ "children": "Move to assessment",
+ "data-automation-id": "transfer-to-assessment-button",
+ "iconProps": {
+ "iconName": "fabricMoveToFolder",
+ },
+ "onClick": [Function],
+}
`;
diff --git a/src/tests/unit/tests/DetailsView/components/status-icon.test.tsx b/src/tests/unit/tests/DetailsView/components/status-icon.test.tsx
index 8ee1e31caee..12b79039739 100644
--- a/src/tests/unit/tests/DetailsView/components/status-icon.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/status-icon.test.tsx
@@ -1,41 +1,44 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-import * as Enzyme from 'enzyme';
+import { Icon } from '@fluentui/react';
+import { render } from '@testing-library/react';
import * as React from 'react';
-
import { ManualTestStatus } from '../../../../../common/types/store-data/manual-test-status';
import { StatusIcon } from '../../../../../DetailsView/components/status-icon';
+import { mockReactComponents } from '../../../mock-helpers/mock-module-helpers';
+jest.mock('@fluentui/react');
describe('StatusIcon', () => {
+ mockReactComponents([(Icon as any).type]);
test('render for PASS', () => {
- const wrapper = Enzyme.shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
});
test('render for PASS with extra class name', () => {
- const wrapper = Enzyme.shallow(
+ const renderResult = render(
,
);
- expect(wrapper.getElement()).toMatchSnapshot();
+ expect(renderResult.asFragment()).toMatchSnapshot();
});
test('render for FAIL', () => {
- const wrapper = Enzyme.shallow(
+ const renderResult = render(
,
);
- expect(wrapper.getElement()).toMatchSnapshot();
+ expect(renderResult.asFragment()).toMatchSnapshot();
});
test('render for UNKNOWN', () => {
- const wrapper = Enzyme.shallow(
+ const renderResult = render(
,
);
- expect(wrapper.getElement()).toMatchSnapshot();
+ expect(renderResult.asFragment()).toMatchSnapshot();
});
test('render for default', () => {
const status: ManualTestStatus = -1 as ManualTestStatus;
- const wrapper = Enzyme.shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
});
});
diff --git a/src/tests/unit/tests/DetailsView/components/switcher.test.tsx b/src/tests/unit/tests/DetailsView/components/switcher.test.tsx
index c7678d22878..de7fb2315d1 100644
--- a/src/tests/unit/tests/DetailsView/components/switcher.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/switcher.test.tsx
@@ -1,17 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { Dropdown, IDropdownOption } from '@fluentui/react';
+import { render } from '@testing-library/react';
+import '@testing-library/jest-dom';
import { DetailsViewPivotType } from 'common/types/store-data/details-view-pivot-type';
import { DetailsViewActionMessageCreator } from 'DetailsView/actions/details-view-action-message-creator';
import { Switcher, SwitcherProps } from 'DetailsView/components/switcher';
-import { shallow } from 'enzyme';
import * as React from 'react';
import { IMock, Mock, Times } from 'typemoq';
-
+import {
+ getMockComponentClassPropsForCall,
+ mockReactComponents,
+ useOriginalReactElements,
+} from '../../../mock-helpers/mock-module-helpers';
+jest.mock('@fluentui/react');
describe('Switcher', () => {
+ mockReactComponents([Dropdown]);
let defaultProps: SwitcherProps;
let detailsViewActionMessageCreatorMock: IMock;
-
beforeEach(() => {
detailsViewActionMessageCreatorMock = Mock.ofType();
defaultProps = {
@@ -21,34 +27,26 @@ describe('Switcher', () => {
},
};
});
-
describe('renders', () => {
it('Switcher itself matches snapshot', () => {
- const renderer = shallow();
-
- expect(renderer.debug()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
});
-
it('option renderer override matches snapshot', () => {
- const renderer = shallow();
-
- const dropdown = renderer.find(Dropdown);
-
- const options = dropdown.prop('options');
-
- const onRenderOption = dropdown.prop('onRenderOption');
-
- expect(onRenderOption(options[0])).toMatchSnapshot();
+ render();
+ const options = getMockComponentClassPropsForCall(Dropdown).options;
+ const renderOptions =
+ getMockComponentClassPropsForCall(Dropdown).onRenderOption(options);
+ expect(renderOptions).toMatchSnapshot();
});
});
-
describe('props', () => {
it('dropdown has correct options', () => {
- const renderer = shallow();
+ render();
- const dropdown = renderer.find(Dropdown);
+ const dropdown = getMockComponentClassPropsForCall(Dropdown);
- expect(dropdown.prop('options')).toMatchSnapshot();
+ expect(dropdown.options).toMatchSnapshot();
});
});
@@ -61,35 +59,33 @@ describe('Switcher', () => {
),
)
.verifiable(Times.once());
- const wrapper = shallow();
- const dropdown = wrapper.find(Dropdown);
-
- expect(wrapper.state().selectedKey).toBe(DetailsViewPivotType.fastPass);
-
- dropdown.props().onChange(null, {
+ render();
+ const dropdown = getMockComponentClassPropsForCall(Dropdown);
+ expect(dropdown.selectedKey).toBe(DetailsViewPivotType.fastPass);
+ dropdown.onChange(null, {
key: DetailsViewPivotType.assessment,
} as IDropdownOption);
-
- expect(wrapper.state().selectedKey).toBe(DetailsViewPivotType.assessment);
+ const dropdown2 = getMockComponentClassPropsForCall(Dropdown, 2);
+ expect(dropdown2.selectedKey).toBe(DetailsViewPivotType.assessment);
detailsViewActionMessageCreatorMock.verifyAll();
});
});
-
describe('componentDidUpdate', () => {
+ const newProps = {
+ ...defaultProps,
+ pivotKey: DetailsViewPivotType.assessment,
+ };
it('pivotKey has changed', () => {
- const newProps = {
- ...defaultProps,
- pivotKey: DetailsViewPivotType.assessment,
- };
- const component = shallow().instance() as Switcher;
- component.componentDidUpdate(defaultProps);
- expect(component.state).toMatchObject({ selectedKey: DetailsViewPivotType.assessment });
+ useOriginalReactElements('@fluentui/react', ['Dropdown']);
+ const component = render();
+ component.rerender();
+ expect(component.getByText('Assessment')).toBeTruthy();
});
-
it('pivotKey has not changed', () => {
- const component = shallow().instance() as Switcher;
- component.componentDidUpdate(defaultProps);
- expect(component.state).toMatchObject({ selectedKey: DetailsViewPivotType.fastPass });
+ useOriginalReactElements('@fluentui/react', ['Dropdown']);
+ const component = render();
+ component.rerender();
+ expect(component.getByText('FastPass')).toBeTruthy();
});
});
});
diff --git a/src/tests/unit/tests/DetailsView/components/tab-stops-failed-instance-section.test.tsx b/src/tests/unit/tests/DetailsView/components/tab-stops-failed-instance-section.test.tsx
index b32ae55d6ce..f29849ba056 100644
--- a/src/tests/unit/tests/DetailsView/components/tab-stops-failed-instance-section.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/tab-stops-failed-instance-section.test.tsx
@@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-import { HeadingLevel } from 'common/components/heading-element-for-level';
+import { render } from '@testing-library/react';
+import { HeadingElementForLevel, HeadingLevel } from 'common/components/heading-element-for-level';
import {
TabStopsInstanceSectionPropsFactory,
TabStopsInstanceSectionPropsFactoryProps,
@@ -12,11 +13,24 @@ import {
TabStopsFailedInstanceSectionProps,
} from 'DetailsView/components/tab-stops-failed-instance-section';
import { TabStopsFailedCounter } from 'DetailsView/tab-stops-failed-counter';
-import { shallow } from 'enzyme';
import * as React from 'react';
import { IMock, It, Mock, Times } from 'typemoq';
+import { ResultSectionTitle } from '../../../../../common/components/cards/result-section-title';
+import { TabStopsRequirementsWithInstances } from '../../../../../DetailsView/tab-stops-requirements-with-instances';
+import {
+ expectMockedComponentPropsToMatchSnapshots,
+ mockReactComponents,
+} from '../../../mock-helpers/mock-module-helpers';
+jest.mock('common/components/heading-element-for-level');
+jest.mock('../../../../../common/components/cards/result-section-title');
+jest.mock('../../../../../DetailsView/tab-stops-requirements-with-instances');
describe('TabStopsFailedInstanceSection', () => {
+ mockReactComponents([
+ TabStopsRequirementsWithInstances,
+ HeadingElementForLevel,
+ ResultSectionTitle,
+ ]);
let tabStopsFailedCounterMock: IMock;
let tabStopsInstanceSectionPropsFactoryMock: IMock;
let props: TabStopsFailedInstanceSectionProps;
@@ -71,9 +85,10 @@ describe('TabStopsFailedInstanceSection', () => {
.returns(() => 10)
.verifiable(Times.once());
- const wrapper = shallow();
+ const renderResult = render();
- expect(wrapper.getElement()).toMatchSnapshot();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([TabStopsRequirementsWithInstances]);
tabStopsFailedCounterMock.verifyAll();
tabStopsInstanceSectionPropsFactoryMock.verifyAll();
});
@@ -94,9 +109,9 @@ describe('TabStopsFailedInstanceSection', () => {
.returns(() => 0)
.verifiable(Times.once());
- const wrapper = shallow();
+ const renderResult = render();
- expect(wrapper.getElement()).toMatchSnapshot();
+ expect(renderResult.asFragment()).toMatchSnapshot();
tabStopsFailedCounterMock.verifyAll();
tabStopsInstanceSectionPropsFactoryMock.verifyAll();
});
@@ -113,9 +128,9 @@ describe('TabStopsFailedInstanceSection', () => {
.returns(() => 0)
.verifiable(Times.once());
- const wrapper = shallow();
+ const renderResult = render();
- expect(wrapper.getElement()).toMatchSnapshot();
+ expect(renderResult.asFragment()).toMatchSnapshot();
tabStopsFailedCounterMock.verifyAll();
tabStopsInstanceSectionPropsFactoryMock.verifyAll();
});
diff --git a/src/tests/unit/tests/DetailsView/components/tab-stops-minimal-requirement-header.test.tsx b/src/tests/unit/tests/DetailsView/components/tab-stops-minimal-requirement-header.test.tsx
index ecc4a5422bf..79bb9177c61 100644
--- a/src/tests/unit/tests/DetailsView/components/tab-stops-minimal-requirement-header.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/tab-stops-minimal-requirement-header.test.tsx
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+import { render } from '@testing-library/react';
import { TabStopsFailedCounter } from 'DetailsView/tab-stops-failed-counter';
import {
TabStopsMinimalRequirementHeader,
@@ -8,11 +9,14 @@ import {
TabStopsMinimalRequirementHeaderProps,
} from 'DetailsView/tab-stops-minimal-requirement-header';
import { TabStopsRequirementResult } from 'DetailsView/tab-stops-requirement-result';
-import { shallow } from 'enzyme';
import * as React from 'react';
import { IMock, It, Mock, Times } from 'typemoq';
+import { OutcomeChip } from '../../../../../reports/components/outcome-chip';
+import { mockReactComponents } from '../../../mock-helpers/mock-module-helpers';
+jest.mock('../../../../../reports/components/outcome-chip');
describe('TabStopsMinimalRequirementHeader', () => {
+ mockReactComponents([OutcomeChip]);
let tabStopsFailedCounterMock: IMock;
const requirement = {
@@ -44,8 +48,8 @@ describe('TabStopsMinimalRequirementHeader', () => {
.returns(() => 2)
.verifiable(Times.once());
- const wrapped = shallow();
- expect(wrapped.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
tabStopsFailedCounterMock.verifyAll();
});
});
diff --git a/src/tests/unit/tests/DetailsView/components/tab-stops-requirement-instances-collapsible-content.test.tsx b/src/tests/unit/tests/DetailsView/components/tab-stops-requirement-instances-collapsible-content.test.tsx
index 328e7c0f25e..3678d57de9b 100644
--- a/src/tests/unit/tests/DetailsView/components/tab-stops-requirement-instances-collapsible-content.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/tab-stops-requirement-instances-collapsible-content.test.tsx
@@ -1,18 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-
-import { DetailsList, Link } from '@fluentui/react';
+import { DetailsList } from '@fluentui/react';
+import { fireEvent, render } from '@testing-library/react';
import {
TabStopsRequirementInstancesCollapsibleContent,
TabStopsRequirementInstancesCollapsibleContentProps,
} from 'DetailsView/tab-stops-requirement-instances-collapsible-content';
import { TabStopsRequirementResultInstance } from 'DetailsView/tab-stops-requirement-result';
-import { mount, shallow } from 'enzyme';
import * as React from 'react';
import { IMock, Mock, Times } from 'typemoq';
import { TabStopRequirementId } from 'types/tab-stop-requirement-info';
+import {
+ expectMockedComponentPropsToMatchSnapshots,
+ getMockComponentClassPropsForCall,
+ mockReactComponents,
+ useOriginalReactElements,
+} from '../../../mock-helpers/mock-module-helpers';
+jest.mock('@fluentui/react');
describe('TabStopsRequirementInstancesCollapsibleContent', () => {
+ mockReactComponents([DetailsList]);
let onEditButtonClickedMock: IMock<
(requirementId: TabStopRequirementId, instanceId: string, description: string) => void
>;
@@ -48,30 +55,33 @@ describe('TabStopsRequirementInstancesCollapsibleContent', () => {
});
it('renders', () => {
- const wrapper = shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([DetailsList]);
});
test('renders captured instance details column', () => {
- const testSubject = shallow();
- const columns = testSubject.find(DetailsList).props().columns;
+ render();
+ const columns = getMockComponentClassPropsForCall(DetailsList).columns;
expect(columns[0].onRender(requirementResultInstanceStub)).toMatchSnapshot();
});
test('renders captured instance icons column', () => {
- const testSubject = shallow();
- const columns = testSubject.find(DetailsList).props().columns;
+ render();
+ const columns = getMockComponentClassPropsForCall(DetailsList).columns;
expect(columns[1].onRender(requirementResultInstanceStub)).toMatchSnapshot();
});
- test('click events pass through as expected', () => {
+ test('click events pass through as expected', async () => {
onEditButtonClickedMock
.setup(ebc => ebc('keyboard-navigation', 'test-instance-id', 'test-description'))
.verifiable(Times.once());
onRemoveButtonClickedMock
.setup(rbc => rbc(props.requirementId, 'test-instance-id'))
.verifiable(Times.once());
- const testSubject = mount(
+ useOriginalReactElements('@fluentui/react', ['DetailsList', 'Link']);
+
+ const renderResult = render(
{
onRemoveButtonClicked={onRemoveButtonClickedMock.object}
/>,
);
- testSubject
- .find(Link)
- .find('button')
- .forEach(wrapper => wrapper.simulate('click'));
+ const buttons = renderResult.getAllByRole('button');
+ buttons.forEach(button => fireEvent.click(button));
onEditButtonClickedMock.verifyAll();
onRemoveButtonClickedMock.verifyAll();
});
diff --git a/src/tests/unit/tests/DetailsView/components/tab-stops-requirements-with-instances.test.tsx b/src/tests/unit/tests/DetailsView/components/tab-stops-requirements-with-instances.test.tsx
index 86431db03a4..938c59d3e77 100644
--- a/src/tests/unit/tests/DetailsView/components/tab-stops-requirements-with-instances.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/tab-stops-requirements-with-instances.test.tsx
@@ -1,8 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-import { CollapsibleComponentCardsProps } from 'common/components/cards/collapsible-component-cards';
-import { NamedFC, ReactFCWithDisplayName } from 'common/react/named-fc';
+import { render } from '@testing-library/react';
+import {
+ CardsCollapsibleControl,
+ CollapsibleComponentCardsProps,
+} from 'common/components/cards/collapsible-component-cards';
import { TabStopRequirementActionMessageCreator } from 'DetailsView/actions/tab-stop-requirement-action-message-creator';
import { TabStopsTestViewController } from 'DetailsView/components/tab-stops/tab-stops-test-view-controller';
import { TabStopsFailedCounter } from 'DetailsView/tab-stops-failed-counter';
@@ -12,15 +15,16 @@ import {
TabStopsRequirementsWithInstancesDeps,
TabStopsRequirementsWithInstancesProps,
} from 'DetailsView/tab-stops-requirements-with-instances';
-import { shallow } from 'enzyme';
import * as React from 'react';
import { IMock, It, Mock } from 'typemoq';
+import { mockReactComponents } from '../../../mock-helpers/mock-module-helpers';
+jest.mock('common/components/cards/collapsible-component-cards');
describe('TabStopsRequirementsWithInstances', () => {
+ mockReactComponents([CardsCollapsibleControl]);
let tabStopsFailedCounterMock: IMock;
let tabStopsRequirementActionMessageCreatorMock: IMock;
let tabStopsTestViewControllerMock: IMock;
- const CollapsibleControlStub = getCollapsibleControlStub();
let depsStub: TabStopsRequirementsWithInstancesDeps;
let props: TabStopsRequirementsWithInstancesProps;
let getCollapsibleComponentPropsWithInstance: (
@@ -41,9 +45,7 @@ describe('TabStopsRequirementsWithInstances', () => {
} as CollapsibleComponentCardsProps;
};
depsStub = {
- collapsibleControl: (props: CollapsibleComponentCardsProps) => (
-
- ),
+ collapsibleControl: CardsCollapsibleControl,
tabStopsFailedCounter: tabStopsFailedCounterMock.object,
tabStopsTestViewController: tabStopsTestViewControllerMock.object,
tabStopRequirementActionMessageCreator:
@@ -77,8 +79,8 @@ describe('TabStopsRequirementsWithInstances', () => {
tabStopsFailedCounterMock
.setup(m => m.getTotalFailedByRequirementId(It.isAny(), It.isAny()))
.returns(() => 2);
- const wrapper = shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
});
it('renders empty div when instance count === 0', () => {
@@ -88,8 +90,8 @@ describe('TabStopsRequirementsWithInstances', () => {
tabStopsFailedCounterMock
.setup(m => m.getFailedInstancesByRequirementId(It.isAny(), It.isAny()))
.returns(() => 0);
- const wrapper = shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
});
it('renders component instance count === 0', () => {
@@ -105,11 +107,7 @@ describe('TabStopsRequirementsWithInstances', () => {
headingLevel: 3,
} as CollapsibleComponentCardsProps;
};
- const wrapper = shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
});
-
- function getCollapsibleControlStub(): ReactFCWithDisplayName {
- return NamedFC('CollapsibleControlStub', _ => null);
- }
});
diff --git a/src/tests/unit/tests/DetailsView/components/target-change-dialog.test.tsx b/src/tests/unit/tests/DetailsView/components/target-change-dialog.test.tsx
index d7492165172..de77d23557e 100644
--- a/src/tests/unit/tests/DetailsView/components/target-change-dialog.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/target-change-dialog.test.tsx
@@ -1,24 +1,34 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-import { Dialog, TooltipHost } from '@fluentui/react';
+import { TooltipHost, Link } from '@fluentui/react';
+import { render } from '@testing-library/react';
import { BlockingDialog } from 'common/components/blocking-dialog';
import { PersistedTabInfo } from 'common/types/store-data/assessment-result-data';
import { Tab } from 'common/types/store-data/itab';
import { UrlParser } from 'common/url-parser';
import { AssessmentActionMessageCreator } from 'DetailsView/actions/assessment-action-message-creator';
import { DetailsViewActionMessageCreator } from 'DetailsView/actions/details-view-action-message-creator';
+import { ChangeAssessmentDialog } from 'DetailsView/components/change-assessment-dialog';
import {
TargetChangeDialog,
TargetChangeDialogDeps,
TargetChangeDialogProps,
} from 'DetailsView/components/target-change-dialog';
-import * as Enzyme from 'enzyme';
-import { shallow } from 'enzyme';
import * as React from 'react';
-import { IMock, It, Mock, MockBehavior, Times } from 'typemoq';
-
+import {
+ expectMockedComponentPropsToMatchSnapshots,
+ getMockComponentClassPropsForCall,
+ mockReactComponents,
+ useOriginalReactElements,
+} from 'tests/unit/mock-helpers/mock-module-helpers';
+import { IMock, It, Mock, Times } from 'typemoq';
+
+jest.mock('DetailsView/components/change-assessment-dialog');
+jest.mock('@fluentui/react');
+jest.mock('common/components/blocking-dialog');
describe('TargetChangeDialog test set for prev tab null', () => {
- const urlParserMock = Mock.ofType(UrlParser, MockBehavior.Strict);
+ mockReactComponents([ChangeAssessmentDialog, BlockingDialog, TooltipHost, Link]);
+ const urlParserMock = Mock.ofType(UrlParser);
test.each([
null,
@@ -51,9 +61,8 @@ describe('TargetChangeDialog test set for prev tab null', () => {
newTab: newTab,
};
- const wrapper = Enzyme.shallow();
-
- expect(wrapper.find(Dialog).exists()).toBe(false);
+ render();
+ expect(getMockComponentClassPropsForCall(ChangeAssessmentDialog).isOpen).toBe(false);
urlParserMock.verifyAll();
});
});
@@ -80,7 +89,7 @@ describe('TargetChangeDialog test sets for same prev tab and newTab values', ()
url: 'https://www.def.com',
title: 'test title 2',
};
- urlParserMock = Mock.ofType(UrlParser, MockBehavior.Strict);
+ urlParserMock = Mock.ofType(UrlParser);
deps = {
urlParser: urlParserMock.object,
detailsViewActionMessageCreator: detailsViewActionMessageCreatorMock.object,
@@ -93,25 +102,6 @@ describe('TargetChangeDialog test sets for same prev tab and newTab values', ()
urlParserMock.verifyAll();
});
- test('should show dialog when target tab id changed', () => {
- urlParserMock
- .setup(urlParserObject => urlParserObject.areURLsEqual(prevTab.url, newTab.url))
- .returns(() => true)
- .verifiable(Times.once());
-
- const targetChangeProps: TargetChangeDialogProps = {
- deps,
- prevTab,
- newTab,
- };
-
- const wrapper = Enzyme.mount();
- expect(wrapper.find(BlockingDialog).exists()).toBe(true);
- expect(wrapper.find(TooltipHost).exists()).toBe(true);
- expect(wrapper.find(TooltipHost).length).toEqual(2);
- expect(wrapper.find(BlockingDialog).props().hidden).toBe(false);
- });
-
test('snapshot: render when target tab id changed', () => {
prevTab = {
...prevTab,
@@ -130,8 +120,9 @@ describe('TargetChangeDialog test sets for same prev tab and newTab values', ()
newTab,
};
- const wrapper = Enzyme.shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const wrapper = render();
+ expect(wrapper.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([ChangeAssessmentDialog]);
});
test('snapshot: render when previous tab info shows app is refreshed', () => {
@@ -151,8 +142,9 @@ describe('TargetChangeDialog test sets for same prev tab and newTab values', ()
newTab,
};
- const wrapper = shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([ChangeAssessmentDialog]);
});
test('snapshot: render when tab ids are same but url changes', () => {
@@ -175,8 +167,9 @@ describe('TargetChangeDialog test sets for same prev tab and newTab values', ()
newTab,
};
- const wrapper = shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([ChangeAssessmentDialog]);
});
test("snapshot: render when tab ids are same and also url doesn't change", () => {
@@ -196,8 +189,9 @@ describe('TargetChangeDialog test sets for same prev tab and newTab values', ()
newTab,
};
- const wrapper = shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([ChangeAssessmentDialog]);
});
test('snapshot: render the only information available in prevTab detailsViewId matches current detailsViewId', () => {
@@ -221,7 +215,33 @@ describe('TargetChangeDialog test sets for same prev tab and newTab values', ()
newTab,
};
- const wrapper = shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([ChangeAssessmentDialog]);
+ });
+
+ test('should show dialog when target tab id changed', () => {
+ useOriginalReactElements('DetailsView/components/change-assessment-dialog', [
+ 'ChangeAssessmentDialog',
+ ]);
+ urlParserMock
+ .setup(urlParserObject => urlParserObject.areURLsEqual(prevTab.url, newTab.url))
+ .returns(() => true)
+ .verifiable(Times.once());
+
+ const targetChangeProps: TargetChangeDialogProps = {
+ deps,
+ prevTab,
+ newTab,
+ };
+
+ render();
+
+ expect(getMockComponentClassPropsForCall(BlockingDialog)).not.toBeNull();
+ expect(getMockComponentClassPropsForCall(TooltipHost)).not.toBeNull();
+ const tooltipHostCalls =
+ (TooltipHost as any).mock?.calls || (TooltipHost as any).render.mock.calls;
+ expect(tooltipHostCalls.length).toEqual(2);
+ expect(getMockComponentClassPropsForCall(BlockingDialog).hidden).toBe(false);
});
});
diff --git a/src/tests/unit/tests/DetailsView/components/target-page-changed-view.test.tsx b/src/tests/unit/tests/DetailsView/components/target-page-changed-view.test.tsx
index 1664c55a78f..dabb3279c02 100644
--- a/src/tests/unit/tests/DetailsView/components/target-page-changed-view.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/target-page-changed-view.test.tsx
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+import { render } from '@testing-library/react';
import { DisplayableVisualizationTypeData } from 'common/types/displayable-visualization-type-data';
import { VisualizationType } from 'common/types/visualization-type';
import { DetailsViewActionMessageCreator } from 'DetailsView/actions/details-view-action-message-creator';
@@ -7,10 +8,13 @@ import {
TargetPageChangedView,
TargetPageChangedViewProps,
} from 'DetailsView/components/target-page-changed-view';
-import { shallow } from 'enzyme';
import * as React from 'react';
+import { InlineStartOverButton } from '../../../../../DetailsView/components/inline-start-over-button';
+import { mockReactComponents } from '../../../mock-helpers/mock-module-helpers';
+jest.mock('../../../../../DetailsView/components/inline-start-over-button');
describe('TargetPageChangedView', () => {
+ mockReactComponents([InlineStartOverButton]);
it.each`
subtitle | isCardsUIEnabled
${undefined} | ${true}
@@ -37,9 +41,9 @@ describe('TargetPageChangedView', () => {
detailsViewActionMessageCreator,
};
- const wrapped = shallow();
+ const renderResult = render();
- expect(wrapped.getElement()).toMatchSnapshot();
+ expect(renderResult.asFragment()).toMatchSnapshot();
},
);
});
diff --git a/src/tests/unit/tests/DetailsView/components/target-page-hidden-bar.test.tsx b/src/tests/unit/tests/DetailsView/components/target-page-hidden-bar.test.tsx
index 990aef9dc11..7a17b8e8fdf 100644
--- a/src/tests/unit/tests/DetailsView/components/target-page-hidden-bar.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/target-page-hidden-bar.test.tsx
@@ -1,19 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+import { MessageBar } from '@fluentui/react';
+import { render } from '@testing-library/react';
import { TargetPageHiddenBar } from 'DetailsView/components/target-page-hidden-bar';
-import { shallow } from 'enzyme';
import * as React from 'react';
+import { mockReactComponents } from '../../../mock-helpers/mock-module-helpers';
+jest.mock('@fluentui/react');
describe('TargetPageHiddenBar', () => {
+ mockReactComponents([MessageBar]);
it('renders per snapshot to indicate that the target page is hidden', () => {
- const testSubject = shallow();
+ const renderResult = render();
- expect(testSubject.debug()).toMatchSnapshot();
+ expect(renderResult.asFragment()).toMatchSnapshot();
});
it('renders as null when the target page is not hidden', () => {
- const testSubject = shallow();
+ const renderResult = render();
- expect(testSubject.getElement()).toBeNull();
+ expect(renderResult.container.firstChild).toBeNull();
});
});
diff --git a/src/tests/unit/tests/DetailsView/components/test-status-choice-group.test.tsx b/src/tests/unit/tests/DetailsView/components/test-status-choice-group.test.tsx
index adc1a23f4a2..7562cfbbf30 100644
--- a/src/tests/unit/tests/DetailsView/components/test-status-choice-group.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/test-status-choice-group.test.tsx
@@ -1,14 +1,20 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-import { ChoiceGroup, IChoiceGroup, IconButton } from '@fluentui/react';
+import { render } from '@testing-library/react';
import { ManualTestStatus } from 'common/types/store-data/manual-test-status';
import { ChoiceGroupPassFail } from 'DetailsView/components/choice-group-pass-fail';
import { TestStatusChoiceGroup } from 'DetailsView/components/test-status-choice-group';
-import { mount, shallow } from 'enzyme';
import * as React from 'react';
+import {
+ expectMockedComponentPropsToMatchSnapshots,
+ getMockComponentClassPropsForCall,
+ mockReactComponents,
+} from 'tests/unit/mock-helpers/mock-module-helpers';
import { Mock, Times } from 'typemoq';
+jest.mock('DetailsView/components/choice-group-pass-fail');
describe('TestStatusChoiceGroup', () => {
+ mockReactComponents([ChoiceGroupPassFail]);
let props;
let onUndoMock;
let onGroupChoiceChangeMock;
@@ -33,17 +39,22 @@ describe('TestStatusChoiceGroup', () => {
});
test('render: unknown (do not show undo button)', () => {
- const component = mount();
- const choiceGroup = component.find(ChoiceGroupPassFail);
- expect(choiceGroup.props()).toMatchObject({
+ render();
+
+ const component = render();
+
+ const choiceGroupProps = getMockComponentClassPropsForCall(ChoiceGroupPassFail);
+
+ expect(choiceGroupProps).toMatchObject({
selectedKey: ManualTestStatus.UNKNOWN,
});
- expect(component.find(IconButton).exists()).toBeFalsy();
+ expect(component.queryByRole('button')).toBeFalsy();
});
test('render: status is set to UNKNOWN', () => {
- const actual = shallow();
- expect(actual.getElement()).toMatchSnapshot();
+ const actual = render();
+ expect(actual.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([ChoiceGroupPassFail]);
});
test('render: status is set to PASS', () => {
@@ -53,14 +64,16 @@ describe('TestStatusChoiceGroup', () => {
.setup(o => o(props.status, props.test, props.step, props.selector))
.verifiable(Times.once());
- const wrapper = shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const wrapper = render();
+ expect(wrapper.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([ChoiceGroupPassFail]);
});
test('render: status is set to FAIL', () => {
props.status = ManualTestStatus.FAIL;
- const actual = shallow();
- expect(actual.getElement()).toMatchSnapshot();
+ const actual = render();
+ expect(actual.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([ChoiceGroupPassFail]);
});
test('verify onChange', () => {
@@ -69,28 +82,17 @@ describe('TestStatusChoiceGroup', () => {
.setup(o => o(ManualTestStatus.PASS, props.test, props.step, props.selector))
.verifiable(Times.once());
- const testObject = shallow();
- testObject.find(ChoiceGroupPassFail).simulate('change', null, props.options[0]);
+ render();
+ getMockComponentClassPropsForCall(ChoiceGroupPassFail).onChange(null, props.options[0]);
onGroupChoiceChangeMock.verifyAll();
});
test('verify undo button', () => {
- const choiceGroupMock = Mock.ofType();
- const eventStub = {} as React.MouseEvent;
- props.status = ManualTestStatus.PASS;
- props.originalStatus = ManualTestStatus.FAIL;
-
onUndoMock.setup(o => o(props.test, props.step, props.selector)).verifiable(Times.once());
- const testObject = mount();
- const setComponentRef = testObject.find(ChoiceGroup).prop('componentRef') as any;
- const undoLinkOnClicked = testObject.find(IconButton).prop('onClick');
-
- setComponentRef(choiceGroupMock.object);
- undoLinkOnClicked(eventStub);
-
- choiceGroupMock.verify(m => m.focus(), Times.once());
- onUndoMock.verify(m => m(1, 'step', 'selector'), Times.once());
+ render();
+ getMockComponentClassPropsForCall(ChoiceGroupPassFail).onUndoClickedPassThrough();
+ onUndoMock.verifyAll();
});
});
diff --git a/src/tests/unit/tests/DetailsView/components/test-view-container.test.tsx b/src/tests/unit/tests/DetailsView/components/test-view-container.test.tsx
index 3069c067982..1886459c5e6 100644
--- a/src/tests/unit/tests/DetailsView/components/test-view-container.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/test-view-container.test.tsx
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+import { render } from '@testing-library/react';
import { VisualizationConfiguration } from 'common/configs/visualization-configuration';
import { VisualizationConfigurationFactory } from 'common/configs/visualization-configuration-factory';
import { AutomatedChecksCardSelectionMessageCreator } from 'common/message-creators/automated-checks-card-selection-message-creator';
@@ -15,7 +16,6 @@ import {
TestViewContainerProvider,
TestViewContainerProviderProps,
} from 'DetailsView/components/test-view-container-provider';
-import { shallow } from 'enzyme';
import * as React from 'react';
import { IMock, Mock, Times } from 'typemoq';
@@ -90,8 +90,10 @@ describe('TestViewContainer', () => {
)
.returns(() => elementStub)
.verifiable(Times.once());
- const rendered = shallow();
- expect(rendered.getElement()).toEqual(elementStub);
+ const renderResult = render();
+ const stubResult = render(elementStub);
+ expect(renderResult.container.isEqualNode(stubResult.container)).toBeTruthy();
+
getTestViewContainerMock.verifyAll();
getAssessmentCardSelectionMessageCreatorMock.verifyAll();
});
diff --git a/src/tests/unit/tests/DetailsView/components/transfer-to-assessment-button.test.tsx b/src/tests/unit/tests/DetailsView/components/transfer-to-assessment-button.test.tsx
index cd2109fd217..cabb9526ce4 100644
--- a/src/tests/unit/tests/DetailsView/components/transfer-to-assessment-button.test.tsx
+++ b/src/tests/unit/tests/DetailsView/components/transfer-to-assessment-button.test.tsx
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+import { render } from '@testing-library/react';
import { InsightsCommandButton } from 'common/components/controls/insights-command-button';
import {
getTransferToAssessmentButton,
@@ -8,11 +9,17 @@ import {
TransferToAssessmentButtonProps,
} from 'DetailsView/components/transfer-to-assessment-button';
import { DataTransferViewController } from 'DetailsView/data-transfer-view-controller';
-import { shallow } from 'enzyme';
import * as React from 'react';
import { IMock, Mock } from 'typemoq';
+import {
+ expectMockedComponentPropsToMatchSnapshots,
+ getMockComponentClassPropsForCall,
+ mockReactComponents,
+} from '../../../mock-helpers/mock-module-helpers';
+jest.mock('common/components/controls/insights-command-button');
describe('TransferToAssessmentButton', () => {
+ mockReactComponents([InsightsCommandButton]);
let dataTransferViewControllerMock: IMock;
let props: TransferToAssessmentButtonProps;
@@ -26,9 +33,10 @@ describe('TransferToAssessmentButton', () => {
});
test('render', () => {
- const testSubject = shallow();
- expect(testSubject.getElement()).toMatchSnapshot();
- expect(testSubject.find(InsightsCommandButton).prop('onClick')).toEqual(
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([InsightsCommandButton]);
+ expect(getMockComponentClassPropsForCall(InsightsCommandButton).onClick).toEqual(
dataTransferViewControllerMock.object.showQuickAssessToAssessmentConfirmDialog,
);
});
diff --git a/src/tests/unit/tests/DetailsView/details-view-body.test.tsx b/src/tests/unit/tests/DetailsView/details-view-body.test.tsx
index 82da335dfb9..c3d53b9cb22 100644
--- a/src/tests/unit/tests/DetailsView/details-view-body.test.tsx
+++ b/src/tests/unit/tests/DetailsView/details-view-body.test.tsx
@@ -1,16 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+import { render } from '@testing-library/react';
import { FeatureFlagStoreData } from 'common/types/store-data/feature-flag-store-data';
import { ManualTestStatus } from 'common/types/store-data/manual-test-status';
import { ScanMetadata, TargetAppData } from 'common/types/store-data/unified-data-interface';
-import {
- DetailsViewCommandBarDeps,
- DetailsViewCommandBarProps,
-} from 'DetailsView/components/details-view-command-bar';
+import { DetailsViewCommandBarDeps } from 'DetailsView/components/details-view-command-bar';
import { FluentSideNav } from 'DetailsView/components/left-nav/fluent-side-nav';
import { StartOverComponentFactory } from 'DetailsView/components/start-over-component-factory';
import { TabStopsViewStoreData } from 'DetailsView/components/tab-stops/tab-stops-view-store-data';
-import { shallow } from 'enzyme';
import * as React from 'react';
import { IMock, Mock } from 'typemoq';
import { VisualizationConfigurationFactory } from '../../../../common/configs/visualization-configuration-factory';
@@ -31,14 +28,31 @@ import {
DetailsViewSwitcherNavConfiguration,
LeftNavProps,
} from '../../../../DetailsView/components/details-view-switcher-nav';
+import { QuickAssessCommandBar } from '../../../../DetailsView/components/quick-assess-command-bar';
+import { QuickAssessToAssessmentDialog } from '../../../../DetailsView/components/quick-assess-to-assessment-dialog';
+import { TargetPageHiddenBar } from '../../../../DetailsView/components/target-page-hidden-bar';
import { DetailsViewBody, DetailsViewBodyProps } from '../../../../DetailsView/details-view-body';
import { DetailsViewToggleClickHandlerFactory } from '../../../../DetailsView/handlers/details-view-toggle-click-handler-factory';
import { TabStoreDataBuilder } from '../../common/tab-store-data-builder';
import { VisualizationScanResultStoreDataBuilder } from '../../common/visualization-scan-result-store-data-builder';
import { VisualizationStoreDataBuilder } from '../../common/visualization-store-data-builder';
+import {
+ expectMockedComponentPropsToMatchSnapshots,
+ getMockComponentClassPropsForCall,
+ mockReactComponents,
+} from '../../mock-helpers/mock-module-helpers';
import { exampleUnifiedStatusResults } from '../common/components/cards/sample-view-model-data';
-
+jest.mock('DetailsView/components/left-nav/fluent-side-nav');
+jest.mock('../../../../DetailsView/components/quick-assess-to-assessment-dialog');
+jest.mock('../../../../DetailsView/components/quick-assess-command-bar');
+jest.mock('../../../../DetailsView/components/target-page-hidden-bar');
describe('DetailsViewBody', () => {
+ mockReactComponents([
+ FluentSideNav,
+ QuickAssessToAssessmentDialog,
+ QuickAssessCommandBar,
+ TargetPageHiddenBar,
+ ]);
let selectedTest: VisualizationType;
let configFactoryStub: VisualizationConfigurationFactory;
let clickHandlerFactoryStub: DetailsViewToggleClickHandlerFactory;
@@ -54,8 +68,7 @@ describe('DetailsViewBody', () => {
selectedTest = -1;
const RightPanelStub: Readonly> =
NamedFC('test', _ => null);
- const CommandBarStub: Readonly> =
- NamedFC('test', _ => null);
+ const CommandBarStub = QuickAssessCommandBar;
const LeftNavStub: Readonly> =
NamedFC('test', _ => null);
rightPanelConfig = {
@@ -129,17 +142,23 @@ describe('DetailsViewBody', () => {
});
test('render', () => {
- const wrapper = shallow();
- expect(wrapper.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([
+ FluentSideNav,
+ QuickAssessToAssessmentDialog,
+ QuickAssessCommandBar,
+ TargetPageHiddenBar,
+ ]);
- wrapper.find(FluentSideNav).props().onRightPanelContentSwitch();
+ getMockComponentClassPropsForCall(FluentSideNav).onRightPanelContentSwitch();
});
test('onRightPanelContentSwitch calls setSideNavOpen with false', () => {
- const wrapper = shallow();
+ render();
setSideNavOpenMock.setup(sm => sm(false)).verifiable();
- wrapper.find(FluentSideNav).props().onRightPanelContentSwitch();
+ getMockComponentClassPropsForCall(FluentSideNav).onRightPanelContentSwitch();
setSideNavOpenMock.verifyAll();
});
diff --git a/src/tests/unit/tests/DetailsView/details-view-container.test.tsx b/src/tests/unit/tests/DetailsView/details-view-container.test.tsx
index 98f51fcb3e5..655b66afeee 100644
--- a/src/tests/unit/tests/DetailsView/details-view-container.test.tsx
+++ b/src/tests/unit/tests/DetailsView/details-view-container.test.tsx
@@ -1,5 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+import { Spinner } from '@fluentui/react';
+import { render } from '@testing-library/react';
import { ClientStoresHub } from 'common/stores/client-stores-hub';
import { DetailsViewPivotType } from 'common/types/store-data/details-view-pivot-type';
import { FeatureFlagStoreData } from 'common/types/store-data/feature-flag-store-data';
@@ -8,11 +10,19 @@ import {
DetailsViewContainer,
DetailsViewContainerProps,
} from 'DetailsView/details-view-container';
-import { shallow } from 'enzyme';
import * as React from 'react';
import { IMock, Mock, Times } from 'typemoq';
-
+import { NarrowModeDetector } from '../../../../DetailsView/components/narrow-mode-detector';
+import { NoContentAvailable } from '../../../../DetailsView/components/no-content-available/no-content-available';
+import {
+ expectMockedComponentPropsToMatchSnapshots,
+ mockReactComponents,
+} from '../../mock-helpers/mock-module-helpers';
+jest.mock('../../../../DetailsView/components/no-content-available/no-content-available');
+jest.mock('@fluentui/react');
+jest.mock('../../../../DetailsView/components/narrow-mode-detector');
describe('DetailsViewContainer', () => {
+ mockReactComponents([NarrowModeDetector, NoContentAvailable, Spinner]);
let detailsViewActionMessageCreator: IMock;
beforeEach(() => {
@@ -33,8 +43,9 @@ describe('DetailsViewContainer', () => {
storesHubMock.setup(mock => mock.hasStores()).returns(() => true);
storesHubMock.setup(mock => mock.hasStoreData()).returns(() => false);
- const rendered = shallow();
- expect(rendered.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([NarrowModeDetector]);
});
});
@@ -51,8 +62,9 @@ describe('DetailsViewContainer', () => {
storesHubMock.setup(mock => mock.hasStores()).returns(() => false);
- const rendered = shallow();
- expect(rendered.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([NarrowModeDetector]);
});
it('show NoContentAvailable when target tab is closed', () => {
@@ -73,8 +85,9 @@ describe('DetailsViewContainer', () => {
storesHubMock.setup(mock => mock.hasStores()).returns(() => true);
storesHubMock.setup(mock => mock.hasStoreData()).returns(() => true);
- const rendered = shallow();
- expect(rendered.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([NarrowModeDetector]);
});
it('shows NoContentAvailable when target page is changed and no permissions granted', () => {
@@ -99,8 +112,9 @@ describe('DetailsViewContainer', () => {
storesHubMock.setup(mock => mock.hasStores()).returns(() => true);
storesHubMock.setup(mock => mock.hasStoreData()).returns(() => true);
- const rendered = shallow();
- expect(rendered.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([NarrowModeDetector]);
});
it('render once; should call details view opened', () => {
@@ -129,8 +143,9 @@ describe('DetailsViewContainer', () => {
.setup(mock => mock.detailsViewOpened(selectedDetailsViewPivotStub))
.verifiable();
- const rendered = shallow();
- expect(rendered.getElement()).toMatchSnapshot();
+ const renderResult = render();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([NarrowModeDetector]);
detailsViewActionMessageCreator.verifyAll();
});
diff --git a/src/tests/unit/tests/DetailsView/details-view-content.test.tsx b/src/tests/unit/tests/DetailsView/details-view-content.test.tsx
index 5e0d2ae9a9e..bdcae77989d 100644
--- a/src/tests/unit/tests/DetailsView/details-view-content.test.tsx
+++ b/src/tests/unit/tests/DetailsView/details-view-content.test.tsx
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+import { render } from '@testing-library/react';
import { VisualizationConfiguration } from 'common/configs/visualization-configuration';
import { VisualizationConfigurationFactory } from 'common/configs/visualization-configuration-factory';
import { WebVisualizationConfigurationFactory } from 'common/configs/web-visualization-configuration-factory';
@@ -50,17 +51,27 @@ import {
} from 'DetailsView/details-view-container';
import { AssessmentInstanceTableHandler } from 'DetailsView/handlers/assessment-instance-table-handler';
import { DetailsViewToggleClickHandlerFactory } from 'DetailsView/handlers/details-view-toggle-click-handler-factory';
-import { shallow } from 'enzyme';
import * as React from 'react';
import { ScannerRuleInfoMap } from 'scanner/scanner-rule-info';
import { IMock, It, Mock, MockBehavior, Times } from 'typemoq';
+import { DetailsViewOverlay } from '../../../../DetailsView/components/details-view-overlay/details-view-overlay';
+import { InteractiveHeader } from '../../../../DetailsView/components/interactive-header';
+import { DetailsViewBody } from '../../../../DetailsView/details-view-body';
import { DetailsViewStoreDataBuilder } from '../../common/details-view-store-data-builder';
import { VisualizationStoreDataBuilder } from '../../common/visualization-store-data-builder';
+import {
+ expectMockedComponentPropsToMatchSnapshots,
+ mockReactComponents,
+} from '../../mock-helpers/mock-module-helpers';
import { DetailsViewContainerPropsBuilder } from './details-view-container-props-builder';
import { StoreMocks } from './store-mocks';
+jest.mock('../../../../DetailsView/components/interactive-header');
+jest.mock('../../../../DetailsView/components/details-view-overlay/details-view-overlay');
+jest.mock('../../../../DetailsView/details-view-body');
describe(DetailsViewContent.displayName, () => {
+ mockReactComponents([InteractiveHeader, DetailsViewOverlay, DetailsViewBody]);
const pageTitle = 'DetailsViewContainerTest title';
const pageUrl = 'http://detailsViewContainerTest/url/';
let detailsViewActionMessageCreator: IMock;
@@ -107,10 +118,7 @@ describe(DetailsViewContent.displayName, () => {
(storeData: CardSelectionStoreData) => null,
MockBehavior.Strict,
);
- visualizationConfigurationFactoryMock = Mock.ofType(
- WebVisualizationConfigurationFactory,
- MockBehavior.Strict,
- );
+ visualizationConfigurationFactoryMock = Mock.ofType(WebVisualizationConfigurationFactory);
isResultHighlightUnavailableStub = () => null;
timestamp = 'timestamp';
scanDate = new Date(Date.UTC(0, 1, 2, 3));
@@ -368,7 +376,7 @@ describe(DetailsViewContent.displayName, () => {
.setup(m => m(needsReviewScanNodeResultsStub, cardSelectionViewData))
.returns(() => needsReviewCardsViewDataStub);
- const rendered = shallow(
+ const renderResult = render(
{
setSideNavOpen={() => {}}
/>,
);
- expect(rendered.getElement()).toMatchSnapshot();
+ expect(renderResult.asFragment()).toMatchSnapshot();
+ expectMockedComponentPropsToMatchSnapshots([
+ InteractiveHeader,
+ DetailsViewOverlay,
+ DetailsViewBody,
+ ]);
clickHandlerFactoryMock.verifyAll();
getCardSelectionViewDataMock.verifyAll();