| Index: third_party/WebKit/LayoutTests/shadow-dom/link-title.html
|
| diff --git a/third_party/WebKit/LayoutTests/shadow-dom/link-title.html b/third_party/WebKit/LayoutTests/shadow-dom/link-title.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8b36e31f6319d5db91780e4300d4eb4cf895282c
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/shadow-dom/link-title.html
|
| @@ -0,0 +1,37 @@
|
| +<!DOCTYPE html>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script src="resources/shadow-dom.js"></script>
|
| +<body>
|
| + <div id="host">
|
| + <template mode-data="open">
|
| + <link rel="stylesheet" title="hello1" href="data:text/css,#shadowChild1 { color: green }">
|
| + <link rel="stylesheet" title="hello2" href="data:text/css,#shadowChild2 { color: green }">
|
| + <link rel="alternate stylesheet" title="world1" href="data:text/css,#shadowChild3 { color: green }">
|
| + <div id="shadowChild1"></div>
|
| + <div id="shadowChild2"></div>
|
| + <div id="shadowChild3"></div>
|
| + <div id="shadowChild4"></div>
|
| + </template>
|
| + </div>
|
| + <div id="bodyChild1"></div>
|
| + <div id="bodyChild2"></div>
|
| + <script>convertTemplatesToShadowRootsWithin(host);</script>
|
| + <link rel="stylesheet" title="preferred1" href="data:text/css,#bodyChild1 { color: green }">
|
| + <link rel="stylesheet" title="preferred2" href="data:text/css,#bodyChild2 { color: green }">
|
| +</body>
|
| +<script>
|
| +function colorFor(elem) {
|
| + return document.defaultView.getComputedStyle(elem, '').color;
|
| +}
|
| +
|
| +test(() => {
|
| + assert_equals(colorFor(bodyChild1), 'rgb(0, 128, 0)', 'A link in a shadow tree does not have any effect on the preferred stylesheet on a document tree.');
|
| + assert_equals(colorFor(bodyChild2), 'rgb(0, 0, 0)', 'A non-preferred stylesheet should not be used.');
|
| +
|
| + assert_equals(colorFor(host.shadowRoot.querySelector('#shadowChild2')), 'rgb(0, 128, 0)', 'A title attribute should be ignored in a shadow tree.');
|
| + assert_equals(colorFor(host.shadowRoot.querySelector('#shadowChild2')), 'rgb(0, 128, 0)', 'A title attribute should be ignored in a shadow tree. Both hello1 and hello2 are enabled in a shadow tree.');
|
| + // Setting document.selectedStyleSheetSetName currently has no effect to activate alternate stylesheets. We can not test to select alternate stylesheet in a shadow tree.
|
| + assert_equals(colorFor(host.shadowRoot.querySelector('#shadowChild3')), 'rgb(0, 0, 0)', 'An alternate stylesheet should be disabled by default.');
|
| +}, '<link rel="stylesheet"> should work in a connected shadow tree.');
|
| +</script>
|
|
|