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

Unified Diff: third_party/WebKit/LayoutTests/shadow-dom/attach-shadow-with-parameter.html

Issue 2333623003: Convert remaining focus tests in shadow-dom to use testharness.js (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/shadow-dom/attach-shadow-with-parameter-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/shadow-dom/attach-shadow-with-parameter.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/attach-shadow-with-parameter.html b/third_party/WebKit/LayoutTests/shadow-dom/attach-shadow-with-parameter.html
index c61c06aacaba633dcc1b4c7ba2f9db1bcb0a3042..74ae0a48aebb11e3712bcc22e358236658cded7c 100644
--- a/third_party/WebKit/LayoutTests/shadow-dom/attach-shadow-with-parameter.html
+++ b/third_party/WebKit/LayoutTests/shadow-dom/attach-shadow-with-parameter.html
@@ -1,32 +1,30 @@
-<!doctype html>
-<script src="../resources/js-test.js"></script>
-<script src="../fast/dom/shadow/resources/shadow-dom.js"></script>
-<body>
- <div id="host1"></div>
- <div id="host2"></div>
- <div id="host3"></div>
-</body>
+<!DOCTYPE html>
+<script src='../resources/testharness.js'></script>
+<script src='../resources/testharnessreport.js'></script>
+<script src='resources/shadow-dom.js'></script>
+<div id='host1'></div>
+<div id='host2'></div>
+<div id='host3'></div>
<script>
-debug('Attach open shadow root.');
-var host1 = document.querySelector('#host1');
-shouldBeNonNull("host1.attachShadow({mode: 'open'})");
+'use strict';
-debug('Attach closed shadow root.');
-var host2 = document.querySelector('#host2');
-shouldBeNonNull("host2.attachShadow({mode: 'closed'})");
+test(() => {
+ let root1 = host1.attachShadow({mode: 'open'});
+ assert_not_equals(root1, null, 'Attach open shadow root should succeed.');
+ assert_equals(Object.getPrototypeOf(root1), ShadowRoot.prototype,
+ 'ShadowRoot object should be returned by attachShadow({mode:"open"}).');
-debug('Attach shadow root whose mode is neither open nor closed.');
-var host4 = document.querySelector('#host3');
-shouldThrow("host4.attachShadow({mode: 'illegal'})");
+ let root2 = host2.attachShadow({mode: 'closed'});
+ assert_not_equals(root2, null, 'Attach closed shadow root should succeed.');
+ assert_equals(Object.getPrototypeOf(root2), ShadowRoot.prototype,
+ 'ShadowRoot object should be returned by attachShadow({mode:"closed"}).');
-debug('Attach open shadow root with shadow-dom.js utility.');
-document.body.appendChild(
- createDOM('div', {id: 'host5'},
- attachShadow({mode: 'open'})));
-var host5 = document.querySelector('#host5');
-var root5 = host5.shadowRoot;
-shouldBeNonNull(root5);
+ assert_throws({name: 'TypeError'}, () => { host3.attachShadow({mode: 'illegal'}); },
+ 'Attach shadow root whose mode is neither open nor closed should throw TypeError.');
-debug('Attach shadow root on already shadowed host will raise InvalidStateError exception.');
-shouldThrow("host1.attachShadow({mode: 'open'})");
+ assert_throws({name: 'InvalidStateError'}, () => { host1.attachShadow({mode: 'open'}); },
+ 'Attach shadow on a host which has open shadow root will raise InvalidStateError exception.');
+ assert_throws({name: 'InvalidStateError'}, () => { host2.attachShadow({mode: 'open'}); },
+ 'Attach shadow on a host wich has closed shadow root will raise InvalidStateError exception.');
+}, 'Test for Element.attachShadow() with mode parameter.');
</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/shadow-dom/attach-shadow-with-parameter-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698