Title: [128434] trunk/LayoutTests
Revision
128434
Author
[email protected]
Date
2012-09-13 02:32:20 -0700 (Thu, 13 Sep 2012)

Log Message

[Tests] We should have tests for preserving/resetting values of input type "time" after browser navigation
https://bugs.webkit.org/show_bug.cgi?id=96595

Reviewed by Kent Tamura.

This patch adds two tests for preserving/resetting values input type
"time" with multiple fields input UI after page reload, backward and
forward browser navigation.

This patch affects ports which enable both ENABLE_INPUT_TYPE_TIME and
ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS.

* fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back-expected.txt: Added.
* fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back.html: Added for checking value is preserved after history backward and forward navigation.
* fast/forms/time-multiple-fields/time-multiple-fields-reset-value-after-reload-expected.txt: Added.
* fast/forms/time-multiple-fields/time-multiple-fields-reset-preserve-value-after-reload.html: Added for checking values are resetted after page reload.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (128433 => 128434)


--- trunk/LayoutTests/ChangeLog	2012-09-13 09:24:25 UTC (rev 128433)
+++ trunk/LayoutTests/ChangeLog	2012-09-13 09:32:20 UTC (rev 128434)
@@ -1,3 +1,22 @@
+2012-09-13  Yoshifumi Inoue  <[email protected]>
+
+        [Tests] We should have tests for preserving/resetting values of input type "time" after browser navigation
+        https://bugs.webkit.org/show_bug.cgi?id=96595
+
+        Reviewed by Kent Tamura.
+
+        This patch adds two tests for preserving/resetting values input type
+        "time" with multiple fields input UI after page reload, backward and
+        forward browser navigation.
+
+        This patch affects ports which enable both ENABLE_INPUT_TYPE_TIME and
+        ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS.
+
+        * fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back-expected.txt: Added.
+        * fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back.html: Added for checking value is preserved after history backward and forward navigation.
+        * fast/forms/time-multiple-fields/time-multiple-fields-reset-value-after-reload-expected.txt: Added.
+        * fast/forms/time-multiple-fields/time-multiple-fields-reset-preserve-value-after-reload.html: Added for checking values are resetted after page reload.
+
 2012-09-13  Ádám Kallai  <[email protected]>
 
         [Qt] Unreviewed gardening. Skip a failing test. Added platform specific expectations after r128375.

Added: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back-expected.txt (0 => 128434)


--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back-expected.txt	2012-09-13 09:32:20 UTC (rev 128434)
@@ -0,0 +1,18 @@
+Checks input value is preserved after backward and forward
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Went back to a page. Checking a form control which had a full value:
+PASS "01:01" is "01:01"
+Went back to a page. Checking a form control which had a partial value:
+PASS "" is ""
+Went forward to a page. Checking a form control which had a full value:
+PASS "02:02" is "02:02"
+Went forward to a page. Checking a form control which had a partial value:
+PASS "" is ""
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back.html (0 => 128434)


--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back.html	2012-09-13 09:32:20 UTC (rev 128434)
@@ -0,0 +1,134 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id=container>
+<input type=time id=test1><br>
+<input type=time id=test2><br>
+<iframe id=iframe></iframe>
+</div>
+<script>
+description('Checks input value is preserved after backward and forward');
+if (!window.eventSender) {
+    debug('Please run within DumpRenderTree');
+}
+window.jsTestIsAsync = true;
+
+var iframe = document.getElementById('iframe');
+var testInput1 = document.getElementById('test1');
+var testInput2 = document.getElementById('test2');
+var state = 'direct';
+var pageName = location.search || '?page0';
+var testCases = [];
+
+function back(newState)
+{
+    parent.state = newState;
+    history.back();
+}
+
+function failed(message) {
+    testFailed(message + ' in ' + state);
+    finishJSTest();
+}
+
+function finishTest() {
+    runTestCases();
+    document.body.removeChild(document.getElementById('container'));
+    finishJSTest();
+}
+
+function forward(newState)
+{
+    parent.state = newState;
+    history.forward();
+}
+
+function keyDown(key, modifiers)
+{
+    if (!window.eventSender)
+        return;
+    eventSender.keyDown(key, modifiers);
+}
+
+function runTestCases() {
+    for (var index = 0; index < testCases.length; ++ index) {
+        var testCase = testCases[index];
+        debug(testCase['description'] + ':');
+        shouldBeEqualToString('"' + testCase['actual'] + '"', testCase['expected']);
+    }
+    debug('');
+}
+
+switch (pageName) {
+case '?page0':
+    iframe.src = "" + '?page1';
+    break;
+case '?page1':
+    switch (parent.state) {
+    case 'direct': {
+        testInput1.value = '01:01';
+        testInput2.focus();
+        keyDown('upArrow');
+        var nextUri = location.toString().replace('?page1', '?page2');
+        setTimeout(function () { window.location.href = "" }, 0);
+        break;
+    }
+    case 'backTo1':
+        parent.testCases.push(
+            {
+                'description' : 'Went back to a page. Checking a form control which had a full value',
+                'actual' : testInput1.value,
+                'expected' : '01:01' },
+            {
+                'description' : 'Went back to a page. Checking a form control which had a partial value',
+                'actual' : testInput2.value,
+                'expected' : ''
+            });
+        forward('forwardTo2');
+        break;
+    case 'backTo1Second':
+        parent.finishTest();
+        break;
+    default:
+        failed('Unsupported state(' + parent.state + ')');
+        break;
+    }
+    break;
+case '?page2':
+    switch (parent.state) {
+    case 'direct':
+        testInput1.value = '02:02';
+        testInput2.focus();
+        keyDown('upArrow');
+        back('backTo1');
+        break;
+    case 'forwardTo2':
+        parent.testCases.push(
+            {
+                'description' : 'Went forward to a page. Checking a form control which had a full value',
+                'actual' : testInput1.value,
+                'expected' : '02:02'
+            },
+            {
+                'description' : 'Went forward to a page. Checking a form control which had a partial value',
+                'actual' : testInput2.value,
+                'expected' : ''
+            });
+        back('backTo1Second');
+        break;
+    default:
+        failed('Unsupported state(' + parent.state + ')');
+        break;
+    }
+    break;
+default:
+    failed('Unsupported page(' + pageName + ')');
+    break;
+}
+</script>
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-reset-value-after-reload-expected.txt (0 => 128434)


--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-reset-value-after-reload-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-reset-value-after-reload-expected.txt	2012-09-13 09:32:20 UTC (rev 128434)
@@ -0,0 +1,11 @@
+Checks reloading page resets input values
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testInput1.value is ""
+PASS testInput2.value is "02:02"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-reset-value-after-reload-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-reset-value-after-reload.html (0 => 128434)


--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-reset-value-after-reload.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-reset-value-after-reload.html	2012-09-13 09:32:20 UTC (rev 128434)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body _onload_="runBodyLoaded()">
+<iframe id=iframe srcdoc="<input type=time id=test1><input type=time id=test2 value=02:02>"></iframe>
+<script>
+description('Checks reloading page resets input values');
+window.jsTestIsAsync = true;
+
+var iframe = document.getElementById('iframe');
+var testInput1;
+var testInput2;
+
+function runBodyLoaded()
+{
+    iframe.contentDocument.getElementById('test1').value = '12:34';
+    iframe.contentDocument.getElementById('test2').value = '03:03';
+    iframe.addEventListener("load", function () { parent.runOnIFrameLoad(); });
+    iframe.contentWindow.location.reload();
+}
+
+function runOnIFrameLoad()
+{
+    testInput1 = iframe.contentDocument.getElementById('test1');
+    testInput2 = iframe.contentDocument.getElementById('test2');
+    shouldBeEqualToString('testInput1.value', '');
+    shouldBeEqualToString('testInput2.value', '02:02');
+    iframe.parentNode.removeChild(iframe);
+    finishJSTest();
+}
+</script>
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-reset-value-after-reload.html
___________________________________________________________________

Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to