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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/html/script-tests/figure-element.js

Issue 2674643002: Stop using script-tests in fast/html/. (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 description('Various tests for the figure element.');
2
3 function getStyleValue(id, propertyName) {
4 return document.defaultView.getComputedStyle(document.getElementById(id), nu ll).getPropertyValue(propertyName);
5 }
6
7 var testParent = document.createElement('div');
8 document.body.appendChild(testParent);
9
10 debug('<figure> default styling:');
11 testParent.innerHTML = '<figure id="figure0">element</figure>';
12 var emSize = getStyleValue("figure0","font-size");
13 shouldBe('getStyleValue("figure0","display")', '"block"');
14 shouldBe('getStyleValue("figure0","margin-top")', 'emSize');
15 shouldBe('getStyleValue("figure0","margin-right")', '"40px"');
16 shouldBe('getStyleValue("figure0","margin-bottom")', 'emSize');
17 shouldBe('getStyleValue("figure0","margin-left")', '"40px"');
18
19 debug('&lt;figure> closes &lt;p>:');
20 testParent.innerHTML = '<p>Test that <figure id="figure1">a figure element</figu re> closes &lt;p>.</p>';
21 var figure1 = document.getElementById('figure1');
22 shouldBeFalse('figure1.parentNode.nodeName == "p"');
23
24 debug('&lt;p> does not close &lt;figure>:');
25 testParent.innerHTML = '<figure>Test that <p id="p1">a p element</p> does not cl ose a figure element.</figure>';
26 var p1 = document.getElementById('p1');
27 shouldBe('p1.parentNode.nodeName', '"FIGURE"');
28
29 debug('&lt;figure> can be nested inside &lt;figure> or &lt;footer>:');
30 testParent.innerHTML = '<figure id="figure2">Test that <figure id="figure3">a fi gure element</figure> can be nested inside another figure element.</figure>';
31 var figure3 = document.getElementById('figure3');
32 shouldBe('figure3.parentNode.id', '"figure2"');
33 testParent.innerHTML = '<footer id="footer1">Test that <figure id="figure5">a fi gure element</figure> can be nested inside a footer element.</footer>';
34 var figure5 = document.getElementById('figure5');
35 shouldBe('figure5.parentNode.id', '"footer1"');
36
37 debug('Residual style:');
38 testParent.innerHTML = '<b><figure id="figure4">This text should be bold.</figur e> <span id="span1">This is also bold.</span></b>';
39 shouldBe('getStyleValue("figure4","font-weight")', '"bold"');
40 shouldBe('getStyleValue("span1","font-weight")', '"bold"');
41 document.body.removeChild(testParent);
42
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698