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

Side by Side Diff: LayoutTests/fast/dynamic/insertAdjacentText.html

Issue 146313006: Make arguments to insertAdjacent{Text,Element} non-optional (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
1 <body> 1 <body>
2 <pre id="error-log"></pre> 2 <pre id="error-log"></pre>
3 <span id="container" style="color: green"> 3 <span id="container" style="color: green">
4 </span> 4 </span>
5 <span id="status" style="color: red"> 5 <span id="status" style="color: red">
6 FAILURE 6 FAILURE
7 </span> 7 </span>
8 </body> 8 </body>
9 <script> 9 <script>
10 if (window.testRunner) 10 if (window.testRunner)
11 testRunner.dumpAsText(); 11 testRunner.dumpAsText();
12 12
13 // verify all standard cases 13 // verify all standard cases
14 document.getElementById("container").insertAdjacentText("beforeBegin", " 1 (b lack)"); 14 document.getElementById("container").insertAdjacentText("beforeBegin", " 1 (b lack)");
15 document.getElementById("container").insertAdjacentText("afterBegin", " 2 (gr een)"); 15 document.getElementById("container").insertAdjacentText("afterBegin", " 2 (gr een)");
16 document.getElementById("container").insertAdjacentText("beforeEnd", " 3 (gre en)"); 16 document.getElementById("container").insertAdjacentText("beforeEnd", " 3 (gre en)");
17 document.getElementById("container").insertAdjacentText("afterEnd", " 4 (blac k)"); 17 document.getElementById("container").insertAdjacentText("afterEnd", " 4 (blac k)");
18 18
19 function assertThrows(func) { 19 function assertThrows(func) {
20 var testPassed = false; 20 var testPassed = false;
21 try { 21 try {
22 func(); 22 func();
23 document.getElementById("error-log").textContent += "Expected exception missing.\n";
23 } catch (e) { 24 } catch (e) {
24 document.getElementById("error-log").innerHTML += "Caught expected exce ption: " + e + "\n"; 25 document.getElementById("error-log").textContent += "Caught expected ex ception: " + e + "\n";
25 testPassed = true; 26 testPassed = true;
26 } 27 }
27 return testPassed; 28 return testPassed;
28 } 29 }
29 30
30 // check that exceptions are thrown as required 31 // check that exceptions are thrown as required
31 var passes = true; 32 var passes = true;
32 passes = passes & assertThrows(function() { 33 passes = assertThrows(function() {
33 // should throw TYPE_MISMATCH_ERR 34 // should throw SyntaxError
34 document.getElementById("container").insertAdjacentText("blah", "text"); 35 document.getElementById("container").insertAdjacentText("blah", "text");
35 }); 36 }) && passes;
37
38 passes = assertThrows(function() {
39 // should throw TypeError
40 document.getElementById("container").insertAdjacentText();
41 }) && passes;
42
43 passes = assertThrows(function() {
44 // should throw TypeError
45 document.getElementById("container").insertAdjacentText("afterBegin");
46 }) && passes;
36 47
37 if (passes) { 48 if (passes) {
38 document.getElementById("status").style.color = "green"; 49 document.getElementById("status").style.color = "green";
39 document.getElementById("status").innerHTML = "<br><br>PASS"; 50 document.getElementById("status").innerHTML = "<br><br>PASS";
40 } 51 }
41 </script> 52 </script>
OLDNEW
« no previous file with comments | « LayoutTests/fast/dynamic/insertAdjacentHTML.html ('k') | LayoutTests/fast/dynamic/insertAdjacentText-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698