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

Side by Side Diff: third_party/WebKit/LayoutTests/custom-elements/imports/attribute-changed-callback.html

Issue 2297853006: Fix 'will execute script' condition for creating custom elements in imports (Closed)
Patch Set: Fix and update test Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-elements/imports/resources/attribute-parsercreate.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <link id="import1" rel="import" href="resources/attribute-upgrade.html">
5 <script>
6 'use strict';
7
8 let reactions = [];
9
10 customElements.define('a-a', class extends HTMLElement {
11 static get observedAttributes() { return ['attr']; }
12 attributeChangedCallback() {
13 reactions.push(this);
14 }
15 });
16 </script>
17 <link id="import2" rel="import" href="resources/attribute-parsercreate.html">
18 <script>
19 'use strict';
20
21 test(() => {
22 let importDoc1 = import1.import;
23 let importDoc2 = import2.import;
24
25 let a = importDoc1.querySelector('#a');
26 let b = importDoc1.querySelector('#b');
27 let c = importDoc2.querySelector('#c');
28 let d = importDoc2.querySelector('#d');
29
30 assert_array_equals(reactions, [b, d],
31 'attributeChangedCallback should have called for both upgr ade and create.');
dominicc (has gone to gerrit) 2016/09/02 01:01:55 grammar: have called -> have been called (have cal
kochi 2016/09/02 02:59:15 Done.
32
33 a.setAttribute('attr', 'a');
34 b.setAttribute('attr', 'b');
35 c.setAttribute('attr', 'c');
36 d.setAttribute('attr', 'd');
37
38 assert_array_equals(reactions, [b, d, a, b, c, d],
39 'attributeChangedCallback should have called for setAttrib ute().');
40
41 d.removeAttribute('attr', 'd');
42 c.removeAttribute('attr', 'c');
43 b.removeAttribute('attr', 'b');
44 a.removeAttribute('attr', 'a');
45
46 assert_array_equals(reactions, [b, d, a, b, c, d, d, c, b, a],
dominicc (has gone to gerrit) 2016/09/02 01:01:55 This list is getting long. What do you think about
kochi 2016/09/02 02:59:15 That makes sense. Done.
47 'attributeChangedCallback should have called for removeAtt ribute().');
48 }, 'attributeChangedCallback should be invoked for elements in import');
49 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-elements/imports/resources/attribute-parsercreate.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698