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

Side by Side Diff: LayoutTests/fast/dom/shadow/layout-tests-can-access-shadow.html

Issue 445933003: Clean up testing.internals argument type checking. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tidy up result type Created 6 years, 4 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 | LayoutTests/fast/dom/shadow/layout-tests-can-access-shadow-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <keygen id="keys" /> 7 <keygen id="keys" />
8 <p id="peas" /> 8 <p id="peas" />
9 <pre id="console"> 9 <pre id="console">
10 This tests that layout tests can access shadow DOM. 10 This tests that layout tests can access shadow DOM.
11 11
12 </pre> 12 </pre>
13 <script> 13 <script>
14 if (window.internals) { 14 if (window.internals) {
15 // Make assertions about a built-in shadow 15 // Make assertions about a built-in shadow
16 var keygen = document.getElementById('keys'); 16 var keygen = document.getElementById('keys');
17 var shadow = internals.shadowRoot(keygen); 17 var shadow = internals.shadowRoot(keygen);
18 shouldBe('shadow.nodeName', '"#document-fragment"'); 18 shouldBe('shadow.nodeName', '"#document-fragment"');
19 19
20 // Shadow roots aren't elements, so accessing their shadow should 20 // Shadow roots aren't elements, so accessing their shadow should throw.
21 // raise 21 shouldThrow("internals.shadowRoot(shadow)");
22 var exceptionCode;
23 try {
24 internals.shadowRoot(shadow);
25 } catch (e) {
26 exceptionCode = e.code;
27 }
28 shouldBe('exceptionCode', 'DOMException.INVALID_ACCESS_ERR');
29 22
30 // Ordinary element should not have shadow 23 // Ordinary element should not have shadow
31 var p = document.getElementById('peas'); 24 var p = document.getElementById('peas');
32 shouldBe('internals.shadowRoot(p)', 'null'); 25 shouldBe('internals.shadowRoot(p)', 'null');
33 26
34 // Can bless ordinary elements with shadows 27 // Can bless ordinary elements with shadows
35 shadow = p.createShadowRoot(p); 28 shadow = p.createShadowRoot(p);
36 shouldBe('shadow.nodeName', '"#document-fragment"'); 29 shouldBe('shadow.nodeName', '"#document-fragment"');
37 shouldBe('shadow === internals.shadowRoot(p)', 'true'); 30 shouldBe('shadow === internals.shadowRoot(p)', 'true');
38 } 31 }
39 </script> 32 </script>
40 </body> 33 </body>
41 </html> 34 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/shadow/layout-tests-can-access-shadow-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698