Skip to content

Commit

Permalink
test: Capture failing test for shadow exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcy Sutton authored and WilcoFiers committed Mar 9, 2018

Verified

This commit was signed with the committer’s verified signature.
Fdawgs Frazer Smith
1 parent 9af1dea commit 10086fc
Showing 2 changed files with 37 additions and 2 deletions.
24 changes: 23 additions & 1 deletion test/integration/full/context/context.html
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
<script src="/node_modules/mocha/mocha.js"></script>
<script src="/node_modules/chai/chai.js"></script>
<script src="/axe.js"></script>
<script src="/test/testutils.js"></script>
<script>
mocha.setup({
timeout: 10000,
@@ -20,7 +19,30 @@
<div id="frame-container">
<iframe id="myframe" src="frames/level1.html"></iframe>
</div>
<ul style="display: none;">
<p>Text</p>
<p>Text 2</p>
</ul>
<div id="shadow-container">
<p id="test-passes">Passing Text</p>
<div id="shadow-host"></div>
</div>
<div id="mocha"></div>
<script>
var host = document.getElementById('shadow-host');
var list = document.getElementsByTagName('ul')[0];
var shadowRoot = host.attachShadow({ mode: 'open' });
var shadowContent = document.createElement('div');
shadowContent.setAttribute('style', 'background-color: #333');
var content = document.createElement('p');
content.style.color = '#000';
content.textContent = 'Failing Text';
shadowContent.appendChild(content);
var shadowList = shadowContent.appendChild(list);
shadowList.style.display = 'block';
shadowRoot.appendChild(shadowContent);
</script>
<script src="/test/testutils.js"></script>
<script src="context.js"></script>
<script src="/test/integration/adapter.js"></script>
</body>
15 changes: 14 additions & 1 deletion test/integration/full/context/context.js
Original file line number Diff line number Diff line change
@@ -2,11 +2,13 @@ describe('context test', function () {
'use strict';

var config = { runOnly: { type: 'rule', values: ['html-has-lang'] } };
var shadowSupported = axe.testUtils.shadowSupport.v1;

before(function (done) {
axe.testUtils.awaitNestedLoad(done);
axe._tree = undefined;
});


describe('direct exclude', function () {

describe('no include', function () {
@@ -105,6 +107,17 @@ describe('context test', function () {
});
});

(shadowSupported ? it : xit)
('should find no nodes in Shadow DOM', function (done) {
var sConfig = { runOnly: { type: 'rule', values: ['list', 'color-contrast'] } };
axe.run({ include: [['#shadow-container']], exclude: [['#shadow-host']] }, sConfig, function (err, results) {
assert.isNull(err);
assert.lengthOf(results.violations, 0, 'violations');
assert.lengthOf(results.passes, 2, 'passes');
done();
});
});

describe('no include', function () {

it('should find no violations given a selector array', function (done) {

0 comments on commit 10086fc

Please sign in to comment.