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

Side by Side Diff: LayoutTests/imported/web-platform-tests/html/semantics/scripting-1/the-script-element/script-text.html

Issue 1144143009: W3C Test: Import web-platform-tests/html/semantics (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!doctype html>
2 <meta charset=utf-8>
3 <title>HTMLScriptElement.text</title>
4 <link rel=help href="https://html.spec.whatwg.org/multipage/#dom-script-text">
5 <script src="../../../../../../resources/testharness.js"></script>
6 <script src="../../../../../../resources/testharnessreport.js"></script>
7 <div id="log"></div>
8 <script>
9 var script;
10 setup(function() {
11 script = document.createElement("script")
12 script.appendChild(document.createComment("COMMENT"))
13 script.appendChild(document.createTextNode(" TEXT "))
14 script.appendChild(document.createProcessingInstruction("P", "I"))
15 script.appendChild(document.createElement("a"))
16 .appendChild(document.createTextNode("ELEMENT"))
17 })
18 test(function() {
19 assert_equals(script.text, " TEXT ")
20 assert_equals(script.textContent, " TEXT ELEMENT")
21 }, "Getter")
22 test(function() {
23 script.text = " text "
24 assert_equals(script.text, " text ")
25 assert_equals(script.textContent, " text ")
26 assert_equals(script.firstChild.nodeType, Node.TEXT_NODE)
27 assert_equals(script.firstChild.data, " text ")
28 assert_equals(script.firstChild, script.lastChild)
29 assert_array_equals(script.childNodes, [script.firstChild])
30 }, "Setter (non-empty string)")
31 test(function() {
32 script.text = ""
33 assert_equals(script.text, "")
34 assert_equals(script.textContent, "")
35 assert_equals(script.firstChild, null)
36 }, "Setter (empty string)")
37 test(function() {
38 script.text = null
39 assert_equals(script.text, "null")
40 assert_equals(script.textContent, "null")
41 assert_equals(script.firstChild.nodeType, Node.TEXT_NODE)
42 assert_equals(script.firstChild.data, "null")
43 assert_equals(script.firstChild, script.lastChild)
44 }, "Setter (null)")
45 test(function() {
46 script.text = undefined
47 assert_equals(script.text, "undefined")
48 assert_equals(script.textContent, "undefined")
49 assert_equals(script.firstChild.nodeType, Node.TEXT_NODE)
50 assert_equals(script.firstChild.data, "undefined")
51 assert_equals(script.firstChild, script.lastChild)
52 }, "Setter (undefined)")
53 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698