mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 1357191 - 2. Fix form tests for new mobile date/time controls; r=jessica
Fix some test failures on mobile for the new date/time controls, * Because mobile does not use the built-in reset button, tests involving the reset button are skipped. * The mobile-only date/time tests in test_input_typing_sanitization.html do not apply to the new date/time controls, so they are removed to make mobile match desktop. * test_input_sanitization.html now takes a lot longer to run on Android debug and frequently times out, so it's disabled for debug Android builds. * time-content-left-aligned.html may fail because of different drawing behavior on Android, so the test is made fuzzy on Android. MozReview-Commit-ID: FTzwHTJgVJe
This commit is contained in:
parent
ea127a6715
commit
8bfda16485
@ -33,19 +33,12 @@ skip-if = android_version == '18' # Android, bug 1147974
|
||||
[test_input_color_picker_update.html]
|
||||
skip-if = android_version == '18' # Android, bug 1147974
|
||||
[test_input_date_bad_input.html]
|
||||
skip-if = os == "android"
|
||||
[test_input_date_key_events.html]
|
||||
skip-if = os == "android"
|
||||
[test_input_datetime_input_change_events.html]
|
||||
skip-if = os == "android"
|
||||
[test_input_datetime_focus_blur.html]
|
||||
skip-if = os == "android"
|
||||
[test_input_datetime_focus_blur_events.html]
|
||||
skip-if = os == "android"
|
||||
[test_input_datetime_focus_state.html]
|
||||
skip-if = os == "android"
|
||||
[test_input_datetime_tabindex.html]
|
||||
skip-if = os == "android"
|
||||
[test_input_defaultValue.html]
|
||||
[test_input_email.html]
|
||||
[test_input_event.html]
|
||||
@ -71,11 +64,10 @@ skip-if = os == "android"
|
||||
[test_input_range_mozinputrangeignorepreventdefault.html]
|
||||
[test_input_range_rounding.html]
|
||||
[test_input_sanitization.html]
|
||||
skip-if = os == 'android' && debug # Extremely slow on debug android
|
||||
[test_input_textarea_set_value_no_scroll.html]
|
||||
[test_input_time_key_events.html]
|
||||
skip-if = os == "android"
|
||||
[test_input_time_sec_millisec_field.html]
|
||||
skip-if = os == "android"
|
||||
[test_input_types_pref.html]
|
||||
[test_input_typing_sanitization.html]
|
||||
skip-if = os == "android" && debug # bug 1397615
|
||||
|
@ -37,6 +37,7 @@ SimpleTest.waitForFocus(function() {
|
||||
});
|
||||
|
||||
const DATE_BAD_INPUT_MSG = "Please enter a valid date.";
|
||||
const isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
|
||||
|
||||
function checkValidity(aElement, aIsBadInput) {
|
||||
is(aElement.validity.valid, aIsBadInput ? false : true,
|
||||
@ -93,9 +94,12 @@ function test() {
|
||||
elem.blur();
|
||||
checkValidity(elem, true);
|
||||
|
||||
// Clearing all fields should clear bad input validity state as well.
|
||||
synthesizeMouse(input, resetButton_X, resetButton_Y, {});
|
||||
checkValidity(elem, false);
|
||||
// Reset button is desktop only.
|
||||
if (isDesktop) {
|
||||
// Clearing all fields should clear bad input validity state as well.
|
||||
synthesizeMouse(input, resetButton_X, resetButton_Y, {});
|
||||
checkValidity(elem, false);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -26,6 +26,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1370858
|
||||
* Test that change and input events are (not) fired for date/time inputs.
|
||||
**/
|
||||
|
||||
const isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
|
||||
|
||||
var inputTypes = ["time", "date"];
|
||||
var changeEvents = [0, 0];
|
||||
var inputEvents = [0, 0];
|
||||
@ -73,12 +75,15 @@ function test() {
|
||||
is(changeEvents[i], 2, "Change event should be dispatched (2).");
|
||||
is(inputEvents[i], 2, "Input event should be dispatched (2).");
|
||||
|
||||
// Test that change and input events are fired when clearing the value using
|
||||
// the reset button.
|
||||
synthesizeMouse(input, resetButton_X, resetButton_Y, {});
|
||||
is(input.value, "", "Check that value was set correctly (3).");
|
||||
is(changeEvents[i], 3, "Change event should be dispatched (3).");
|
||||
is(inputEvents[i], 3, "Input event should be dispatched (3).");
|
||||
// Reset button is desktop only.
|
||||
if (isDesktop) {
|
||||
// Test that change and input events are fired when clearing the value using
|
||||
// the reset button.
|
||||
synthesizeMouse(input, resetButton_X, resetButton_Y, {});
|
||||
is(input.value, "", "Check that value was set correctly (3).");
|
||||
is(changeEvents[i], 3, "Change event should be dispatched (3).");
|
||||
is(inputEvents[i], 3, "Input event should be dispatched (3).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=765772
|
||||
* This test checks that when a user types in some input types, it will not be
|
||||
* in a state where the value will be un-sanitized and usable (by a script).
|
||||
*/
|
||||
const isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
|
||||
|
||||
var input = document.getElementById('i');
|
||||
var form = document.getElementById('f');
|
||||
@ -137,47 +136,6 @@ function* runTest()
|
||||
"42,13", // comma can't be used as a decimal separator
|
||||
]
|
||||
},
|
||||
{
|
||||
mobileOnly: true,
|
||||
type: 'date',
|
||||
validData: [
|
||||
'0001-01-01',
|
||||
'2012-12-21',
|
||||
'2013-01-28',
|
||||
'100000-01-01',
|
||||
],
|
||||
invalidData: [
|
||||
'1-01-01',
|
||||
'a',
|
||||
'-',
|
||||
'2012-01',
|
||||
'2013-01-1',
|
||||
'1011-23-21',
|
||||
'1000-12-99',
|
||||
]
|
||||
},
|
||||
{
|
||||
mobileOnly: true,
|
||||
type: 'time',
|
||||
validData: [
|
||||
'00:00',
|
||||
'09:09:00',
|
||||
'08:23:23.1',
|
||||
'21:43:56.12',
|
||||
'23:12:45.100',
|
||||
],
|
||||
invalidData: [
|
||||
'00:',
|
||||
'00:00:',
|
||||
'25:00',
|
||||
'-00:00',
|
||||
'00:00:00.',
|
||||
'00:60',
|
||||
'10:58:99',
|
||||
':19:10',
|
||||
'23:08:09.1012',
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'month',
|
||||
validData: [
|
||||
@ -236,10 +194,6 @@ function* runTest()
|
||||
for (test of data) {
|
||||
gCurrentTest = test;
|
||||
|
||||
if (gCurrentTest.mobileOnly && isDesktop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
input.type = test.type;
|
||||
gValidData = test.validData;
|
||||
gInvalidData = test.invalidData;
|
||||
|
@ -1,24 +1,21 @@
|
||||
default-preferences pref(dom.forms.datetime,true)
|
||||
|
||||
# not valid on Android where type=time looks like type=text
|
||||
skip-if(Android) != time-simple-unthemed.html time-simple-unthemed-ref.html
|
||||
skip-if(Android) != time-large-font.html time-basic.html
|
||||
skip-if(Android) != time-width-height.html time-basic.html
|
||||
skip-if(Android) != time-border.html time-basic.html
|
||||
# only valid on Android where type=number looks the same as type=text
|
||||
skip-if(!Android) == time-simple-unthemed.html time-simple-unthemed-ref.html
|
||||
!= time-simple-unthemed.html time-simple-unthemed-ref.html
|
||||
!= time-large-font.html time-basic.html
|
||||
!= time-width-height.html time-basic.html
|
||||
!= time-border.html time-basic.html
|
||||
|
||||
# type change
|
||||
skip-if(Android) == to-time-from-other-type-unthemed.html time-simple-unthemed.html
|
||||
skip-if(Android) == from-time-to-other-type-unthemed.html from-time-to-other-type-unthemed-ref.html
|
||||
== to-time-from-other-type-unthemed.html time-simple-unthemed.html
|
||||
== from-time-to-other-type-unthemed.html from-time-to-other-type-unthemed-ref.html
|
||||
|
||||
# content should not overflow on small width/height
|
||||
skip-if(Android) == time-small-width.html time-small-width-ref.html
|
||||
skip-if(Android) == time-small-height.html time-small-height-ref.html
|
||||
skip-if(Android) == time-small-width-height.html time-small-width-height-ref.html
|
||||
== time-small-width.html time-small-width-ref.html
|
||||
== time-small-height.html time-small-height-ref.html
|
||||
== time-small-width-height.html time-small-width-height-ref.html
|
||||
|
||||
# content (text) should be left aligned
|
||||
skip-if(Android) == time-content-left-aligned.html time-content-left-aligned-ref.html
|
||||
fuzzy-if(Android,4,8) == time-content-left-aligned.html time-content-left-aligned-ref.html
|
||||
|
||||
# reset button should be right aligned
|
||||
skip-if(Android) == time-reset-button-right-aligned.html time-reset-button-right-aligned-ref.html # bug 1372062
|
||||
|
Loading…
Reference in New Issue
Block a user