Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(580)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/Node.html

Issue 2376103007: Import wpt@09907a9c4bcee14986431d53e4381384c7c69107 (Closed)
Patch Set: update platform expectations Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Custom Elements: CEReactions on Node interface</title>
5 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
6 <meta name="assert" content="nodeValue, textContent, normalize, cloneNode, inser tBefore, appendChild, replaceChild, and removeChild of Node interface must have CEReactions">
7 <meta name="help" content="https://dom.spec.whatwg.org/#node">
8 <script src="/resources/testharness.js"></script>
9 <script src="/resources/testharnessreport.js"></script>
10 <script src="./resources/reactions.js"></script>
11 </head>
12 <body>
13 <div id="log"></div>
14 <script>
15
16 testAttributeMutator(function (element, name, value) {
17 element.getAttributeNode(name).nodeValue = value;
18 }, 'nodeValue on Node');
19
20 testAttributeMutator(function (element, name, value) {
21 element.getAttributeNode(name).textContent = value;
22 }, 'textContent on Node');
23
24 // FIXME: Add a test for normalize()
25
26 test(function () {
27 var element = defineNewCustomElement();
28 var instance = document.createElement(element.name);
29 instance.setAttribute('id', 'foo');
30 assert_array_equals(element.log().types(), ['constructed', 'attributeChanged ']);
31 var newInstance = instance.cloneNode(false);
32 var logEntries = element.log();
33 assert_array_equals(logEntries.types(), ['constructed', 'attributeChanged']) ;
34 assert_equals(logEntries.log().name, 'id');
35 assert_equals(logEntries.log().oldValue, null);
36 assert_equals(logEntries.log().newValue, 'foo');
37 }, 'cloneNode on Node must enqueue a attributeChanged reaction when cloning an e lement with an attribute');
38
39 test(function () {
40 var element = defineNewCustomElement();
41 var instance = document.createElement(element.name);
42 instance.setAttribute('lang', 'en');
43 assert_array_equals(element.log().types(), ['constructed']);
44 var newInstance = instance.cloneNode(false);
45 assert_array_equals(element.log().types(), ['constructed']);
46 }, 'cloneNode on Node must not enqueue a attributeChanged reaction when cloning an element with an attribute');
47
48
49 testNodeConnector(function (newContainer, customElement) {
50 newContainer.insertBefore(customElement, newContainer.firstChild);
51 }, 'insertBefore on ChildNode');
52
53 testNodeConnector(function (newContainer, customElement) {
54 newContainer.appendChild(customElement);
55 }, 'appendChild on ChildNode');
56
57 testNodeConnector(function (newContainer, customElement) {
58 newContainer.replaceChild(customElement, newContainer.firstChild);
59 }, 'replaceChild on ChildNode');
60
61 testNodeDisconnector(function (customElement) {
62 customElement.parentNode.removeChild(customElement);
63 }, 'removeChild on ChildNode');
64
65 </script>
66 </body>
67 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698