Reviewed by Maciej.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Feb 2006 19:34:01 +0000 (19:34 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Feb 2006 19:34:01 +0000 (19:34 +0000)
        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=6908
          REGRESSION: Replacing existing <option> shuffles it to the end of the list

        * fast/forms/select-replace-option.html: Added.
        * fast/forms/select-replace-option-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@12585 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/forms/select-replace-option-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/select-replace-option.html [new file with mode: 0644]

index 9d070259cbf318f4a759634dd3b526a4dcf3e168..86742f97ed95fa6d8889be4aa679b5e77732216b 100644 (file)
@@ -1,3 +1,13 @@
+2006-02-05  Darin Adler  <darin@apple.com>
+
+        Reviewed by Maciej.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=6908
+          REGRESSION: Replacing existing <option> shuffles it to the end of the list
+
+        * fast/forms/select-replace-option.html: Added.
+        * fast/forms/select-replace-option-expected.txt: Added.
+
 2006-02-05  Darin Adler  <darin@apple.com>
 
         Reviewed by Maciej.
diff --git a/LayoutTests/fast/forms/select-replace-option-expected.txt b/LayoutTests/fast/forms/select-replace-option-expected.txt
new file mode 100644 (file)
index 0000000..373a081
--- /dev/null
@@ -0,0 +1,10 @@
+This tests replacing an option using JavaScript. If successful, the options should be "Replacement Option 0", "Option 1", and "Option 2", and selected index should be 0.
+
+
+options[0] is Option 0
+options[1] is Replacement Option 1
+options[2] is Option 2
+selected index is 0
+
+
+
diff --git a/LayoutTests/fast/forms/select-replace-option.html b/LayoutTests/fast/forms/select-replace-option.html
new file mode 100644 (file)
index 0000000..7814100
--- /dev/null
@@ -0,0 +1,33 @@
+<head>
+<script>
+function test()
+{
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+    var select = document.getElementById('select');
+    select.options[1] = new Option("Replacement Option 1", "Replacement Option 1");
+    var length = select.options.length;
+    for (var i = 0; i < length; ++i) {
+        var message = "options[" + i + "] is " + select.options[i].innerHTML;
+        var paragraph = document.createElement('div');
+        paragraph.appendChild(document.createTextNode(message));
+        document.getElementById('console').appendChild(paragraph);
+    }
+    var message = "selected index is " + select.selectedIndex;
+    var paragraph = document.createElement('p');
+    paragraph.appendChild(document.createTextNode(message));
+    document.getElementById('console').appendChild(paragraph);
+}
+</script>
+</head>
+<body onload="test();">
+<p>This tests replacing an option using JavaScript. If successful, the options should be "Replacement Option 0", "Option 1", and "Option 2", and selected index should be 0.<form>
+<form>
+<select id="select">
+<option>Option 0</option>
+<option>Option 1</option>
+<option>Option 2</option>
+</select>
+</form>
+<p id="console"></p>
+</body>