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

Unified Diff: LayoutTests/fast/forms/radio/radio_checked_dynamic.html

Issue 1298133002: Convert radio_checked_dynamic.html to the testharness style. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/forms/radio/radio_checked_dynamic-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/forms/radio/radio_checked_dynamic.html
diff --git a/LayoutTests/fast/forms/radio/radio_checked_dynamic.html b/LayoutTests/fast/forms/radio/radio_checked_dynamic.html
index b2105e60b8e52f10e02f4b071a2115b4446be688..c700fb21ac551ac885ca502346ebad1cccf61ee8 100644
--- a/LayoutTests/fast/forms/radio/radio_checked_dynamic.html
+++ b/LayoutTests/fast/forms/radio/radio_checked_dynamic.html
@@ -1,36 +1,24 @@
<html>
-<head>
-<style>
-div { font-weight: bold; }
-</style>
-
-</head>
-
<body>
-This will test that radio buttons can be moved in and out of forms while maintaining only one checked button per group, per form.
-<br>
-Test 1: Transfer radio buttons from &lt;body&gt; to &lt;form&gt;:
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<div id="log"></div>
+
<input type="radio" name="group1" id="radio1" checked="checked">
<input type="radio" name="group1" id="radio2">
<form id="test1">
</form>
-<div id="result1">Test 1 Failed</div>
-<br>
-Test 2: Transfer radio buttons from &lt;form&gt; to &lt;body&gt;:
+
<form>
<input type="radio" name="group2" id="radio3" checked="checked">
<input type="radio" name="group2" id="radio4">
</form>
-<div id="result2">Test 2 Failed</div>
-<br>
-Test 3: Transfer radio buttons from &lt;form&gt; to &lt;body&gt; with a dormant state in the middle:
+
<form>
<input type="radio" name="group3" id="radio5" checked="checked">
<input type="radio" name="group3" id="radio6">
</form>
-<div id="result3">Test 3 Failed</div>
-<br>
-Test 4: Transfer from &lt;form&gt; to &lt;form&gt;
+
<form>
<input type="radio" name="group4" id="radio7" checked="checked" style="outline:1px solid red">
<input type="radio" name="group4" id="radio8" style="outline:1px solid blue">
@@ -38,51 +26,59 @@ Test 4: Transfer from &lt;form&gt; to &lt;form&gt;
<form id="test4">
<input type="radio" name="group4" id="radio9" checked="checked" style="outline:1px solid green">
</form>
-<div id="result4">Test 4 Failed</div>
<script>
-if (window.testRunner)
- testRunner.dumpAsText();
+// This will test that radio buttons can be moved in and out of forms while
+// maintaining only one checked button per group, per form.
+
+test(function() {
+ var radio1 = document.getElementById("radio1");
+ var radio2 = document.getElementById("radio2");
+ var form = document.getElementById("test1");
+ var result1 = document.getElementById("result1");
+ form.appendChild(radio1);
+ form.appendChild(radio2);
+ radio2.checked = true;
+ assert_false(radio1.checked);
+ assert_true(radio2.checked);
+}, "Transfer radio buttons from <body> to <form>.");
+
+test(function() {
+ var radio3 = document.getElementById("radio3");
+ var radio4 = document.getElementById("radio4");
+ document.body.appendChild(radio3);
+ document.body.appendChild(radio4);
+ radio4.checked = true;
+ assert_false(radio3.checked);
+ assert_true(radio4.checked);
+}, "Transfer radio buttons from <form> to <body>.");
+
+test(function() {
+ var radio5 = document.getElementById("radio5");
+ var radio6 = document.getElementById("radio6");
+ radio5.parentNode.removeChild(radio5);
+ radio6.parentNode.removeChild(radio6);
+ document.body.appendChild(radio5);
+ document.body.appendChild(radio6);
+ radio6.checked = true;
+ assert_false(radio5.checked);
+ assert_true(radio6.checked);
+}, "Transfer radio buttons from <form> to <body> with a dormant state in the middle.");
-var radio1 = document.getElementById("radio1");
-var radio2 = document.getElementById("radio2");
-var form = document.getElementById("test1");
-var result1 = document.getElementById("result1");
-form.appendChild(radio1);
-form.appendChild(radio2);
-radio2.checked = true;
-
-var radio3 = document.getElementById("radio3");
-var radio4 = document.getElementById("radio4");
-document.body.appendChild(radio3);
-document.body.appendChild(radio4);
-radio4.checked = true;
-
-var radio5 = document.getElementById("radio5");
-var radio6 = document.getElementById("radio6");
-radio5.parentNode.removeChild(radio5);
-radio6.parentNode.removeChild(radio6);
-document.body.appendChild(radio5);
-document.body.appendChild(radio6);
-radio6.checked = true;
-
-var radio7 = document.getElementById("radio7");
-var radio8 = document.getElementById("radio8");
-var radio9wasChecked = true;
-var form4 = document.getElementById("test4");
-form4.appendChild(radio7);
-form4.appendChild(radio8);
-radio9wasChecked = radio9.checked;
-radio8.checked = true;
-
-if (!radio1.checked && radio2.checked)
- result1.innerHTML = "Test 1 Passed";
-if (!radio3.checked && radio4.checked)
- result2.innerHTML = "Test 2 Passed";
-if (!radio5.checked && radio6.checked)
- result3.innerHTML = "Test 3 Passed";
-if (!radio7.checked && radio8.checked && !radio9.checked && !radio9wasChecked)
- result4.innerHTML = "Test 4 Passed";
+test(function() {
+ var radio7 = document.getElementById("radio7");
+ var radio8 = document.getElementById("radio8");
+ var radio9wasChecked = true;
+ var form4 = document.getElementById("test4");
+ form4.appendChild(radio7);
+ form4.appendChild(radio8);
+ radio9wasChecked = radio9.checked;
+ radio8.checked = true;
+ assert_false(radio7.checked);
+ assert_true(radio8.checked);
+ assert_false(radio9.checked);
+ assert_false(radio9wasChecked);
+}, "Transfer from <form> to <form>.");
</script>
</body>
</html>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/forms/radio/radio_checked_dynamic-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698