Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
1655ef7d
Unverified
Commit
1655ef7d
authored
Feb 19, 2020
by
Robert Knight
Committed by
GitHub
Feb 19, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1807 from hypothesis/fix-spurious-color-contrast-failures
Assume white background by default in a11y tests
parents
3a573c8f
d03dbf64
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
9 deletions
+13
-9
annotation-document-info-test.js
src/sidebar/components/test/annotation-document-info-test.js
+1
-2
annotation-share-info-test.js
src/sidebar/components/test/annotation-share-info-test.js
+1
-2
share-annotations-panel-test.js
src/sidebar/components/test/share-annotations-panel-test.js
+1
-2
accessibility.js
src/test-util/accessibility.js
+10
-3
No files found.
src/sidebar/components/test/annotation-document-info-test.js
View file @
1655ef7d
...
...
@@ -77,8 +77,7 @@ describe('AnnotationDocumentInfo', () => {
assert
.
equal
(
domain
.
text
(),
'(www.example.com)'
);
});
// FIXME-A11Y
it
.
skip
(
it
(
'should pass a11y checks'
,
checkAccessibility
({
content
:
()
=>
{
...
...
src/sidebar/components/test/annotation-share-info-test.js
View file @
1655ef7d
...
...
@@ -144,8 +144,7 @@ describe('AnnotationShareInfo', () => {
});
});
// FIXME-A11Y
it
.
skip
(
it
(
'should pass a11y checks'
,
checkAccessibility
({
content
:
()
=>
createAnnotationShareInfo
(),
...
...
src/sidebar/components/test/share-annotations-panel-test.js
View file @
1655ef7d
...
...
@@ -185,8 +185,7 @@ describe('ShareAnnotationsPanel', () => {
});
});
// FIXME-A11Y
it
.
skip
(
it
(
'should pass a11y checks'
,
checkAccessibility
({
content
:
()
=>
createShareAnnotationsPanel
(),
...
...
src/test-util/accessibility.js
View file @
1655ef7d
...
...
@@ -9,10 +9,17 @@ import { isValidElement } from 'preact';
* @prop {() => import('preact').VNode|ReactWrapper} content -
* A function that returns the rendered output to test or an Enzyme wrapper
* created using Enzyme's `mount` function.
* @prop {string} [backgroundColor] -
* Background color onto which to render the element. This can affect the
* result of color contrast tests. Defaults to white.
*/
async
function
testScenario
(
elementOrWrapper
)
{
async
function
testScenario
(
elementOrWrapper
,
{
backgroundColor
=
'white'
}
=
{}
)
{
const
container
=
document
.
createElement
(
'div'
);
container
.
style
.
backgroundColor
=
backgroundColor
;
document
.
body
.
appendChild
(
container
);
let
wrapper
;
...
...
@@ -58,7 +65,7 @@ export function checkAccessibility(scenarios) {
}
return
async
()
=>
{
for
(
let
{
name
=
'default'
,
content
}
of
scenarios
)
{
for
(
let
{
name
=
'default'
,
content
,
...
config
}
of
scenarios
)
{
if
(
typeof
content
!==
'function'
)
{
throw
new
Error
(
`"content" key for accessibility scenario "
${
name
}
" should be a function but is a
${
typeof
content
}
`
...
...
@@ -76,7 +83,7 @@ export function checkAccessibility(scenarios) {
);
}
const
violations
=
await
testScenario
(
elementOrWrapper
);
const
violations
=
await
testScenario
(
elementOrWrapper
,
config
);
assert
.
deepEqual
(
violations
,
[],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment