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

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

Issue 2634323002: Import wpt@aae3e1b6ffb8b24acb777450933ceeafd97e3655 (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 // context is either a string or an element node 8 // context is either a string or an element node
9 if (typeof context === "string") { 9 if (typeof context === "string") {
10 container.innerHTML = context; 10 container.innerHTML = context;
11 } else { 11 } else {
12 container.innerHTML = ""; 12 container.innerHTML = "";
13 container.appendChild(context); 13 container.appendChild(context);
14 } 14 }
15 var e = container.firstChild; 15 var e = container.firstChild;
16 while (e && e.nodeType != Node.ELEMENT_NODE) { 16 while (e && e.nodeType != Node.ELEMENT_NODE) {
17 e = e.nextSibling; 17 e = e.nextSibling;
18 } 18 }
19 var oldChild = e.firstChild;
19 e.innerText = plain; 20 e.innerText = plain;
20 return e; 21 return [e, oldChild];
21 } 22 }
22 function testText(context, plain, expectedText, msg) { 23 function testText(context, plain, expectedText, msg) {
23 test(function(){ 24 test(function(){
24 var e = setupTest(context, plain); 25 var arr = setupTest(context, plain);
26 var e = arr[0];
27 var oldChild = arr[1];
25 assert_not_equals(e.firstChild, null, "Should have a child"); 28 assert_not_equals(e.firstChild, null, "Should have a child");
26 assert_equals(e.firstChild.nodeType, Node.TEXT_NODE, "Child should be a text node"); 29 assert_equals(e.firstChild.nodeType, Node.TEXT_NODE, "Child should be a text node");
27 assert_equals(e.firstChild.nextSibling, null, "Should have only one child"); 30 assert_equals(e.firstChild.nextSibling, null, "Should have only one child");
28 assert_equals(e.firstChild.data, expectedText); 31 assert_equals(e.firstChild.data, expectedText);
32 assert_not_equals(e.firstChild, oldChild, "Child should be a *new* text node ");
29 }, msg); 33 }, msg);
30 } 34 }
31 function testHTML(context, plain, expectedHTML, msg) { 35 function testHTML(context, plain, expectedHTML, msg) {
32 test(function(){ 36 test(function(){
33 var e = setupTest(context, plain); 37 var e = setupTest(context, plain)[0];
34 assert_equals(e.innerHTML, expectedHTML); 38 assert_equals(e.innerHTML, expectedHTML);
35 }, msg); 39 }, msg);
36 } 40 }
37 </script> 41 </script>
38 <script src="setter-tests.js"></script> 42 <script src="setter-tests.js"></script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698