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

Unified Diff: third_party/WebKit/LayoutTests/fast/html/header-element.html

Issue 2674643002: Stop using script-tests in fast/html/. (Closed)
Patch Set: Created 3 years, 11 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
Index: third_party/WebKit/LayoutTests/fast/html/header-element.html
diff --git a/third_party/WebKit/LayoutTests/fast/html/header-element.html b/third_party/WebKit/LayoutTests/fast/html/header-element.html
index 38ff111db333ee0f37d2402d682c0c67cbf6b675..dd760935b02a2f989b5fb3ca9901084ed0899dde 100644
--- a/third_party/WebKit/LayoutTests/fast/html/header-element.html
+++ b/third_party/WebKit/LayoutTests/fast/html/header-element.html
@@ -4,6 +4,51 @@
<script src="../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/header-element.js"></script>
+<script>
+description('Various tests for the header element.');
+
+var testParent = document.createElement('div');
+document.body.appendChild(testParent);
+
+debug('&lt;header> closes &lt;p>:');
+testParent.innerHTML = '<p>Test that <header id="header1">a header element</header> closes &lt;p>.</p>';
+var header1 = document.getElementById('header1');
+shouldBeFalse('header1.parentNode.nodeName == "p"');
+
+debug('&lt;p> does not close &lt;header>:');
+testParent.innerHTML = '<header>Test that <p id="p1">a p element</p> does not close a header element.</header>';
+var p1 = document.getElementById('p1');
+shouldBe('p1.parentNode.nodeName', '"HEADER"');
+
+debug('&lt;header> can be nested inside &lt;header> or &lt;footer>:');
+testParent.innerHTML = '<header id="header2">Test that <header id="header3">a header element</header> can be nested inside another header element.</header>';
+var header3 = document.getElementById('header3');
+shouldBe('header3.parentNode.id', '"header2"');
+testParent.innerHTML = '<footer id="footer1">Test that <header id="header5">a header element</header> can be nested inside a footer element.</footer>';
+var header5 = document.getElementById('header5');
+shouldBe('header5.parentNode.id', '"footer1"');
+
+debug('Residual style:');
+testParent.innerHTML = '<b><header id="header4">This text should be bold.</header> <span id="span1">This is also bold.</span></b>';
+function getWeight(id) {
+ return document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue('font-weight');
+}
+shouldBe('getWeight("header4")', '"bold"');
+shouldBe('getWeight("span1")', '"bold"');
+document.body.removeChild(testParent);
+
+debug('FormatBlock:');
+var editable = document.createElement('div');
+editable.innerHTML = '[<span id="span2">The text will be a child of &lt;header>.</span>]';
+document.body.appendChild(editable);
+editable.contentEditable = true;
+var selection = window.getSelection();
+selection.selectAllChildren(editable);
+document.execCommand('FormatBlock', false, 'header');
+selection.removeAllRanges();
+shouldBe('document.getElementById("span2").parentNode.nodeName', '"HEADER"');
+document.body.removeChild(editable);
+
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698