-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(manual-auto-pass): add auto-pass for CSS content and CSS positio…
…ning (#2687) #### Description of changes Per discussion in #2644, the new manual auto-pass behavior we added for some of the Landmarks requirements would also be nice to have for the Semantics > CSS content and Sequence > CSS positioning requirements when their visualization analyzers find no relevant elements. This PR generalizes the "auto-pass if no landmarks" behavior to a "auto-pass if no results relevant to the requirement" behavior and adds it in to the 2 CSS requirements. To do this, it updates the assessment store to only pass instance data with results relevant to the current requirement when it calls a requirement's getInitialManualTestStatus function. I considered an alternative approach of leaving assessment store as-is and creating a factory function for each requirement to specify its own `autoPassIfNoResultsFor(key)` rather than a single `autoPassIfNoResults`; I liked that because it avoided adding more complexity to `assessment-store`, which is already a very complex class, but I felt that it was better for data encapsulation if requirements were systematically prevented from seeing/depending on other requirements' data, and I thought the encapsulation was more valuable. ![gif of 2 CSS requirements auto-passing on a page with no matching instances](https://user-images.githubusercontent.com/376284/81997746-89da2800-9605-11ea-8617-787a6b4b3f1b.gif) #### Pull request checklist <!-- If a checklist item is not applicable to this change, write "n/a" in the checkbox --> - [n/a] Addresses an existing issue: #0000 - [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: `<rootDir>/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`. - [x] (UI changes only) Added screenshots/GIFs to description above - [x] (UI changes only) Verified usability with NVDA/JAWS
- Loading branch information
Showing
10 changed files
with
94 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { ManualTestStatus } from 'common/types/manual-test-status'; | ||
import { InstanceIdToInstanceDataMap } from 'common/types/store-data/assessment-result-data'; | ||
import { isEmpty } from 'lodash'; | ||
|
||
export function autoPassIfNoResults(instanceData: InstanceIdToInstanceDataMap): ManualTestStatus { | ||
return isEmpty(instanceData) ? ManualTestStatus.PASS : ManualTestStatus.UNKNOWN; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/tests/unit/tests/assessments/auto-pass-if-no-results.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { autoPassIfNoResults } from 'assessments/auto-pass-if-no-results'; | ||
import { ManualTestStatus } from 'common/types/manual-test-status'; | ||
import { InstanceIdToInstanceDataMap } from 'common/types/store-data/assessment-result-data'; | ||
|
||
describe('autoPassIfNoResults', () => { | ||
it('returns UNKNOWN for instance data with a result', () => { | ||
const inputWithResult: InstanceIdToInstanceDataMap = { | ||
'#some-element': { | ||
target: ['#some-element'], | ||
html: '<div id="some-element" />', | ||
propertyBag: { | ||
someDataProperty: 'some data', | ||
}, | ||
testStepResults: { | ||
'test-step-1': { | ||
someResultData: 'some result data', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
expect(autoPassIfNoResults(inputWithResult)).toBe(ManualTestStatus.UNKNOWN); | ||
}); | ||
|
||
it('returns PASS for instance data with no results', () => { | ||
const inputWithNoResults: InstanceIdToInstanceDataMap = {}; | ||
|
||
expect(autoPassIfNoResults(inputWithNoResults)).toBe(ManualTestStatus.PASS); | ||
}); | ||
}); |
40 changes: 0 additions & 40 deletions
40
src/tests/unit/tests/assessments/landmarks/auto-pass-if-no-landmarks.test.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters