Index: third_party/WebKit/LayoutTests/shadow-dom/link-element.html |
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/link-element.html b/third_party/WebKit/LayoutTests/shadow-dom/link-element.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fbd1e469fce4f923cf9d6344de46a7e91cae333f |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/shadow-dom/link-element.html |
@@ -0,0 +1,28 @@ |
+<!DOCTYPE html> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<body> |
+ <div id="host"></div> |
+</body> |
+<script> |
+function computedBackgroundColor(elem) { |
+ return document.defaultView.getComputedStyle(elem, '').backgroundColor; |
+} |
+ |
+async_test((test) => { |
+ let link = document.createElement('link'); |
+ link.setAttribute('rel', 'stylesheet'); |
+ link.setAttribute('href', 'resources/test.css'); |
+ link.addEventListener("load", (e) => { |
+ test.step(() => { |
+ assert_equals(computedBackgroundColor(host), 'rgba(0, 0, 0, 0)', 'A host in a document tree should not be styled.'); |
kochi
2016/07/26 05:35:06
Having a :host rule in linked css and check if tha
hayato
2016/07/26 06:04:32
That sounds another concern. That should not be do
|
+ assert_equals(computedBackgroundColor(shadowChild), 'rgb(0, 0, 255)', 'An element in a shadow tree should be styled.'); |
+ test.done(); |
+ }); |
+ }); |
+ let sr = host.attachShadow({ mode: 'open' }); |
+ let shadowChild = document.createElement('div'); |
+ sr.appendChild(shadowChild); |
+ sr.appendChild(link); |
+}, '<link rel=stylesheet> should load a stylesheet in a connected shadow tree.'); |
+</script> |