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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/innerText/setter.html

Issue 2623223003: Import wpt@82173128ef6f536e5faaafc29eecc521380f81ae (Closed)
Patch Set: Modify TestExpectations or download new baselines for tests. 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>innerText setter test</title> 2 <title>innerText setter test</title>
3 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testharnessreport.js"></script>
5 <div id="container"></div> 5 <div id="container"></div>
6 <script> 6 <script>
7 function setupTest(context, plain) { 7 function setupTest(context, plain) {
8 container.innerHTML = context; 8 // context is either a string or an element node
9 if (typeof context === "string") {
10 container.innerHTML = context;
11 } else {
12 container.innerHTML = "";
13 container.appendChild(context);
14 }
9 var e = container.firstChild; 15 var e = container.firstChild;
10 while (e && e.nodeType != Node.ELEMENT_NODE) { 16 while (e && e.nodeType != Node.ELEMENT_NODE) {
11 e = e.nextSibling; 17 e = e.nextSibling;
12 } 18 }
13 e.innerText = plain; 19 e.innerText = plain;
14 return e; 20 return e;
15 } 21 }
16 function testText(context, plain, expectedText, msg) { 22 function testText(context, plain, expectedText, msg) {
17 test(function(){ 23 test(function(){
18 var e = setupTest(context, plain); 24 var e = setupTest(context, plain);
19 assert_not_equals(e.firstChild, null, "Should have a child"); 25 assert_not_equals(e.firstChild, null, "Should have a child");
20 assert_equals(e.firstChild.nodeType, Node.TEXT_NODE, "Child should be a text node"); 26 assert_equals(e.firstChild.nodeType, Node.TEXT_NODE, "Child should be a text node");
21 assert_equals(e.firstChild.nextSibling, null, "Should have only one child"); 27 assert_equals(e.firstChild.nextSibling, null, "Should have only one child");
22 assert_equals(e.firstChild.data, expectedText); 28 assert_equals(e.firstChild.data, expectedText);
23 }, msg); 29 }, msg);
24 } 30 }
25 function testHTML(context, plain, expectedHTML, msg) { 31 function testHTML(context, plain, expectedHTML, msg) {
26 test(function(){ 32 test(function(){
27 var e = setupTest(context, plain); 33 var e = setupTest(context, plain);
28 assert_equals(e.innerHTML, expectedHTML); 34 assert_equals(e.innerHTML, expectedHTML);
29 }, msg); 35 }, msg);
30 } 36 }
31 </script> 37 </script>
32 <script src="setter-tests.js"></script> 38 <script src="setter-tests.js"></script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698