-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shadowDOM accessible text calculation #420
Changes from 1 commit
d29d6cc
48fca9d
0314c42
19a9ff8
55d6aa1
e3ca631
9584884
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ describe('focusable-no-name', function () { | |
|
||
var fixture = document.getElementById('fixture'); | ||
var fixtureSetup = axe.testUtils.fixtureSetup; | ||
var shadowSupport = axe.testUtils.shadowSupport; | ||
|
||
afterEach(function () { | ||
fixture.innerHTML = ''; | ||
|
@@ -26,16 +27,27 @@ describe('focusable-no-name', function () { | |
assert.isTrue(checks['focusable-no-name'].evaluate(node)); | ||
}); | ||
|
||
it('should fail if element is tabbable with no name - ARIA', function () { | ||
it('should fail if element is tabable with no name - ARIA', function () { | ||
fixtureSetup('<span tabindex="0" role="link" href="#"></spam>'); | ||
var node = fixture.querySelector('span'); | ||
assert.isTrue(checks['focusable-no-name'].evaluate(node)); | ||
}); | ||
|
||
it('should pass if the element is tabbable but has an accessible name', function () { | ||
it('should pass if the element is tabable but has an accessible name', function () { | ||
fixtureSetup('<a href="#" title="Hello"></a>'); | ||
var node = fixture.querySelector('a'); | ||
assert.isFalse(checks['focusable-no-name'].evaluate(node)); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a test where when an anchor has content inside the shadow root, it returns false. Test this for slotted content as well as fallback content inside the default slot There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WilcoFiers Can you add one more
|
||
|
||
(shadowSupport.v1 ? it : xit)('should pass if the content is passed in with shadow DOM', function () { | ||
var node = document.createElement('div'); | ||
node.innerText = 'Content!'; | ||
var shadow = node.attachShadow({ mode: 'open' }); | ||
shadow.innerHTML = '<a href="#"><slot></slot></a>'; | ||
fixtureSetup(node); | ||
|
||
var link = shadow.querySelector('a'); | ||
assert.isFalse(checks['focusable-no-name'].evaluate(link)); | ||
}); | ||
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ describe('same-caption-summary', function () { | |
|
||
var fixture = document.getElementById('fixture'); | ||
var fixtureSetup = axe.testUtils.fixtureSetup; | ||
var shadowSupport = axe.testUtils.shadowSupport; | ||
|
||
afterEach(function () { | ||
fixture.innerHTML = ''; | ||
|
@@ -37,8 +38,23 @@ describe('same-caption-summary', function () { | |
var node = fixture.querySelector('table'); | ||
|
||
assert.isTrue(checks['same-caption-summary'].evaluate(node)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should catch the following situation
|
||
|
||
}); | ||
|
||
(shadowSupport.v1 ? it : xit)('should match slotted caption elements', function () { | ||
var node = document.createElement('div'); | ||
node.innerHTML = '<span slot="caption">Caption</span>' + | ||
'<span slot="one">Data element 1</span>' + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WilcoFiers indentation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's an indentation feature ;) |
||
'<span slot="two">Data element 2</span>'; | ||
|
||
var root = node.attachShadow({ mode: 'open' }); | ||
var table = document.createElement('table'); | ||
table.innerHTML = '<caption><slot name="caption"></slot></caption>' + | ||
'<tr><td><slot name="one"></slot></td><td><slot name="two"></slot></td></tr>'; | ||
table.setAttribute('summary', 'Caption'); | ||
root.appendChild(table); | ||
fixtureSetup(node); | ||
|
||
assert.isTrue(checks['same-caption-summary'].evaluate(table)); | ||
}); | ||
|
||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we put a note in here to indicate that this function is intended to be used only on elements that cannot contain a shadow root?