Bug 449371 Firefox/Thunderbird crashes at exit [@ gdk_display_x11_finalize], p=Brian...
[wine-gecko.git] / testing / mochitest / tests / test_bug300691-1.html
blob39d63e57ae159d23cfe61d93682e2004d11b0416
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=300691
5 -->
6 <head>
7 <title>Test for Bug 300691</title>
8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
12 </head>
13 <body>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=300691">Mozilla Bug 300691</a>
15 <p id="display">
16 <textarea id="target"></textarea>
17 </p>
18 <div id="content" style="display: none">
20 </div>
21 <pre id="test">
22 <script class="testbody" type="text/javascript">
24 var t = $("target");
26 /** Test for Bug 300691 **/
27 function valueIs(arg, reason) {
28 is(t.value, arg, reason);
31 function defValueIs(arg, reason) {
32 is(t.defaultValue, arg, reason);
35 valueIs("", "Nothing in the textarea");
36 defValueIs("", "Nothing in the textarea 2");
38 t.appendChild(document.createTextNode("ab"));
39 valueIs("ab", "Appended textnode");
40 defValueIs("ab", "Appended textnode 2");
42 t.firstChild.data = "abcd";
43 valueIs("abcd", "Modified textnode text");
44 defValueIs("abcd", "Modified textnode text 2");
46 t.appendChild(document.createTextNode("efgh"));
47 valueIs("abcdefgh", "Appended another textnode");
48 defValueIs("abcdefgh", "Appended another textnode 2");
50 t.removeChild(t.lastChild);
51 valueIs("abcd", "Removed textnode");
52 defValueIs("abcd", "Removed textnode 2");
54 t.appendChild(document.createTextNode("efgh"));
55 valueIs("abcdefgh", "Appended yet another textnode");
56 defValueIs("abcdefgh", "Appended yet another textnode 2");
58 t.normalize();
59 valueIs("abcdefgh", "Normalization changes nothing for the value");
60 defValueIs("abcdefgh", "Normalization changes nothing for the value 2");
62 t.defaultValue = "abc";
63 valueIs("abc", "Just set the default value on non-edited textarea");
64 defValueIs("abc", "Just set the default value on non-edited textarea 2");
66 t.appendChild(document.createTextNode("defgh"));
67 valueIs("abcdefgh", "Appended another textnode again");
68 defValueIs("abcdefgh", "Appended another textnode again 2");
70 t.focus(); // This puts the caret at the end of the textarea, and doing
71 // something like "home" in a cross-platform way is kinda hard.
72 sendKey("left");
73 sendKey("left");
74 sendKey("left");
75 sendString("Test");
77 valueIs("abcdeTestfgh", "Typed 'Test' after three left-arrows starting from end");
78 defValueIs("abcdefgh", "Typing 'Test' shouldn't affect default value");
80 sendKey("right");
81 sendKey("right");
82 sendKey("back_space");
83 sendKey("back_space");
85 valueIs("abcdeTesth",
86 "Backspaced twice after two right-arrows starting from end of typing");
87 defValueIs("abcdefgh", "Deleting shouldn't affect default value");
89 t.appendChild(document.createTextNode("ijk"));
90 valueIs("abcdeTesth",
91 "Appending textnode shouldn't affect value in edited textarea");
92 defValueIs("abcdefghijk", "Appended textnode 3");
94 t.lastChild.data = "lmno";
95 valueIs("abcdeTesth",
96 "Modifying textnode text shouldn't affect value in edited textarea");
97 defValueIs("abcdefghlmno", "Modified textnode text 3");
99 t.removeChild(t.firstChild);
100 valueIs("abcdeTesth",
101 "Removing child textnode shouldn't affect value in edited textarea");
102 defValueIs("defghlmno", "Removed textnode 3");
104 t.insertBefore(document.createTextNode("abc"), t.firstChild);
105 valueIs("abcdeTesth",
106 "Inserting child textnode shouldn't affect value in edited textarea");
107 defValueIs("abcdefghlmno", "Inserted a text node");
109 t.normalize();
110 valueIs("abcdeTesth", "Normalization changes nothing for the value 3");
111 defValueIs("abcdefghlmno", "Normalization changes nothing for the value 4");
113 t.defaultValue = "abc";
114 valueIs("abcdeTesth", "Setting default value shouldn't affect edited textarea");
115 defValueIs("abc", "Just set the default value textarea");
117 </script>
118 </pre>
119 </body>
120 </html>