forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the test for Shadow-DOM ::distributed() pseudo-element with Relat…
…ive selector.
- Loading branch information
Tetsuharu OHZEKI
committed
Jun 8, 2013
1 parent
6ac0267
commit 000afe2
Showing
2 changed files
with
69 additions
and
2 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
67 changes: 67 additions & 0 deletions
67
shadow-dom/shadow-trees/distributed-pseudo-element/test-002.html
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,67 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Distributed under both the W3C Test Suite License [1] and the W3C | ||
3-clause BSD License [2]. To contribute to a W3C Test Suite, see the | ||
policies and contribution forms [3]. | ||
[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license | ||
[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license | ||
[3] http://www.w3.org/2004/10/27-testcases | ||
--> | ||
<html> | ||
<head> | ||
<title>Shadow DOM Test: A_04_04_01</title> | ||
<link rel="author" title="Tetsuharu OHZEKI" href="mailto:[email protected]"> | ||
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#distributed-pseudo-element"> | ||
<meta name="assert" content="::distributed() pseudo-element, Relative Selector"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../../testcommon.js"></script> | ||
<link rel="stylesheet" href="/resources/testharness.css"> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
<script> | ||
var A_04_04_01_T2 = async_test('A_04_04_01_T02'); | ||
|
||
A_04_04_01_T2.step(function () { | ||
var iframe = document.createElement('iframe'); | ||
iframe.src = '../../resources/bobs_page.html'; | ||
document.body.appendChild(iframe); | ||
|
||
iframe.onload = A_04_04_01_T2.step_func(function () { | ||
try { | ||
var d = iframe.contentDocument; | ||
|
||
//make shadow tree | ||
var ul = d.querySelector('ul.stories'); | ||
var s = createSR(ul); | ||
var subdiv1 = d.createElement('div'); | ||
subdiv1.innerHTML = '<ul><content select="li"></content></ul>'; | ||
s.appendChild(subdiv1); | ||
|
||
var shadowStyle = d.createElement('style'); | ||
shadowStyle.innerHTML = '*::distributed(>.shadow) { display:none; }'; | ||
s.appendChild(shadowStyle); | ||
|
||
//The order of DOM elements should be the following: | ||
//li3, li6 - invisible. Other elements visible | ||
var li3 = d.querySelector('#li3'); | ||
var li6 = d.querySelector('#li6'); | ||
assert_equals(window.getComputedStyle(li3).display, "none", | ||
'Point 1: Elements that don\'t mach insertion point criteria participate in distribution'); | ||
assert_equals(window.getComputedStyle(li6).display, "none", | ||
'Point 2: Elements that don\'t mach insertion point criteria participate in distribution'); | ||
|
||
var a5 = d.querySelector('#a5'); | ||
assert_not_equals(window.getComputedStyle(a5).display, "none", | ||
'Point 3: ::distributed() pseudo-element with relative selector should be a valid insertion point matching criteria, element should be visible'); | ||
} finally { | ||
iframe.parentNode.removeChild(iframe); | ||
} | ||
A_04_04_01_T2.done(); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |