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

Unified Diff: third_party/WebKit/LayoutTests/fast/html/main-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/main-element.html
diff --git a/third_party/WebKit/LayoutTests/fast/html/main-element.html b/third_party/WebKit/LayoutTests/fast/html/main-element.html
index ccafcd646876ec755a11935c5f9165e49f83bc4e..5d0b754321d7f5b867e187c6215abc205c490a6e 100644
--- a/third_party/WebKit/LayoutTests/fast/html/main-element.html
+++ b/third_party/WebKit/LayoutTests/fast/html/main-element.html
@@ -4,6 +4,48 @@
<script src="../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/main-element.js"></script>
+<script>
+description('Various tests for the main element.');
+
+var testParent = document.createElement('div');
+document.body.appendChild(testParent);
+
+debug('&lt;main> closes &lt;p>:');
+testParent.innerHTML = '<p>Test that <main id="main1">an main element</main> closes &lt;p>.</p>';
+var main1 = document.getElementById('main1');
+shouldBeFalse('main1.parentNode.nodeName == "p"');
+
+debug('&lt;p> does not close &lt;main>:');
+testParent.innerHTML = '<main>Test that <p id="p1">a p element</p> does not close an main element.</main>';
+var p1 = document.getElementById('p1');
+shouldBe('p1.parentNode.nodeName', '"MAIN"');
+
+debug('&lt;main> can be nested inside &lt;main>:');
+testParent.innerHTML = '<main id="main2">Test that <main id="main3">an main element</main> can be nested inside another.</main>';
+var main3 = document.getElementById('main3');
+shouldBe('main3.parentNode.id', '"main2"');
+
+debug('Residual style:');
+testParent.innerHTML = '<b><main id="main4">This text should be bold.</main> <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("main4")', '"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;main>.</span>]';
+document.body.appendChild(editable);
+editable.contentEditable = true;
+var selection = window.getSelection();
+selection.selectAllChildren(editable);
+document.execCommand('FormatBlock', false, 'main');
+selection.removeAllRanges();
+shouldBe('document.getElementById("span2").parentNode.nodeName', '"MAIN"');
+document.body.removeChild(editable);
+
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698