diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-04-15 11:50:14 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-04-15 11:51:11 +0200 |
commit | fca67bb95d4cda5046365e124e79ec583c336697 (patch) | |
tree | c511e5060d170f181c10155c0a5a3583fe66b756 /testing | |
parent | f8ad954f7d670ba7d4de0648f4b60d3507164dd2 (diff) | |
parent | f4d1b4804a0dad0a616b01edc31187dace152165 (diff) | |
download | uxp-fca67bb95d4cda5046365e124e79ec583c336697.tar.gz |
Merge branch 'html_input_datetime_1'
This is almost everything needed for #162.
Diffstat (limited to 'testing')
9 files changed, 54 insertions, 116 deletions
diff --git a/testing/marionette/interaction.js b/testing/marionette/interaction.js index c8275665da..2392485d73 100644 --- a/testing/marionette/interaction.js +++ b/testing/marionette/interaction.js @@ -76,6 +76,30 @@ const SELECTED_PROPERTY_SUPPORTED_XUL = new Set([ "TAB", ]); +/** + * Common form controls that user can change the value property interactively. + */ +const COMMON_FORM_CONTROLS = new Set([ + "input", + "textarea", + "select", +]); + +/** + * Input elements that do not fire "input" and "change" events when value + * property changes. + */ +const INPUT_TYPES_NO_EVENT = new Set([ + "checkbox", + "radio", + "file", + "hidden", + "image", + "reset", + "button", + "submit", +]); + this.interaction = {}; /** @@ -339,6 +363,32 @@ interaction.uploadFile = function (el, path) { }; /** + * Sets a form element's value. + * + * @param {DOMElement} el + * An form element, e.g. input, textarea, etc. + * @param {string} value + * The value to be set. + * + * @throws TypeError + * If |el| is not an supported form element. + */ +interaction.setFormControlValue = function* (el, value) { + if (!COMMON_FORM_CONTROLS.has(el.localName)) { + throw new TypeError("This function is for form elements only"); + } + + el.value = value; + + if (INPUT_TYPES_NO_EVENT.has(el.type)) { + return; + } + + event.input(el); + event.change(el); +}; + +/** * Send keys to element. * * @param {DOMElement|XULElement} el diff --git a/testing/marionette/listener.js b/testing/marionette/listener.js index b64eb378df..619ac249d1 100644 --- a/testing/marionette/listener.js +++ b/testing/marionette/listener.js @@ -30,6 +30,7 @@ Cu.import("chrome://marionette/content/session.js"); Cu.import("chrome://marionette/content/simpletest.js"); Cu.import("resource://gre/modules/FileUtils.jsm"); +Cu.import("resource://gre/modules/Preferences.jsm"); Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); @@ -1465,6 +1466,9 @@ function* sendKeysToElement(id, val) { if (el.type == "file") { let path = val.join(""); yield interaction.uploadFile(el, path); + } else if ((el.type == "date" || el.type == "time") && + Preferences.get("dom.forms.datetime")) { + yield interaction.setFormControlValue(el, val); } else { yield interaction.sendKeysToElement( el, val, false, capabilities.get("moz:accessibilityChecks")); diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-checkValidity.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-checkValidity.html.ini index a8247d5a09..23bd8642ca 100644 --- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-checkValidity.html.ini +++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-checkValidity.html.ini @@ -32,25 +32,3 @@ [[INPUT in DATETIME status\] The datetime type must be supported.] expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The datetime-local type must be supported.] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from an overflow] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from an overflow (in a form)] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from an underflow] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from an underflow (in a form)] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from a step mismatch] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from a step mismatch (in a form)] - expected: FAIL - diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-reportValidity.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-reportValidity.html.ini index 2236679978..5b373cfeee 100644 --- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-reportValidity.html.ini +++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-reportValidity.html.ini @@ -39,24 +39,3 @@ [[INPUT in DATETIME status\] The datetime type must be supported.] expected: FAIL - [[INPUT in DATETIME-LOCAL status\] The datetime-local type must be supported.] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from an overflow] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from an overflow (in a form)] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from an underflow] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from an underflow (in a form)] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from a step mismatch] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] suffering from a step mismatch (in a form)] - expected: FAIL - diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html.ini index 6af2a360ea..d8c650632b 100644 --- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html.ini +++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html.ini @@ -3,21 +3,3 @@ [[INPUT in DATETIME status\] The datetime type must be supported.] expected: FAIL - [[INPUT in DATETIME-LOCAL status\] The datetime-local type must be supported.] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The value is greater than max] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The value is greater than max(with millisecond in 1 digit)] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The value is greater than max(with millisecond in 2 digits)] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The value is greater than max(with millisecond in 3 digits)] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The value is greater than max(Year is 10000 should be valid)] - expected: FAIL - diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html.ini index 344ee0039f..87f6f964ef 100644 --- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html.ini +++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html.ini @@ -3,21 +3,3 @@ [[INPUT in DATETIME status\] The datetime type must be supported.] expected: FAIL - [[INPUT in DATETIME-LOCAL status\] The datetime-local type must be supported.] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The value is less than min] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The value is less than min(with millisecond in 1 digit)] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The value is less than min(with millisecond in 2 digits)] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The value is less than min(with millisecond in 3 digits)] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The value is less than min(Year is 10000 should be valid)] - expected: FAIL - diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html.ini index 0c33bdcbea..527760e600 100644 --- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html.ini +++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html.ini @@ -2,7 +2,3 @@ type: testharness [[INPUT in DATETIME status\] The datetime type must be supported.] expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The value must mismatch the step] - expected: FAIL - diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valid.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valid.html.ini index 1cddcd0338..8eb7940d95 100644 --- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valid.html.ini +++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valid.html.ini @@ -23,16 +23,3 @@ [[INPUT in MONTH status\] validity.valid must be false if validity.stepMismatch is true] expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] The datetime-local type must be supported.] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] validity.valid must be false if validity.rangeOverflow is true] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] validity.valid must be false if validity.rangeUnderflow is true] - expected: FAIL - - [[INPUT in DATETIME-LOCAL status\] validity.valid must be false if validity.stepMismatch is true] - expected: FAIL - diff --git a/testing/web-platform/meta/html/semantics/selectors/pseudo-classes/inrange-outofrange.html.ini b/testing/web-platform/meta/html/semantics/selectors/pseudo-classes/inrange-outofrange.html.ini deleted file mode 100644 index 5e2525ac28..0000000000 --- a/testing/web-platform/meta/html/semantics/selectors/pseudo-classes/inrange-outofrange.html.ini +++ /dev/null @@ -1,20 +0,0 @@ -[inrange-outofrange.html] - type: testharness - [':in-range' matches all elements that are candidates for constraint validation, have range limitations, and that are neither suffering from an underflow nor suffering from an overflow] - expected: FAIL - - [':in-range' update number1's value < min] - expected: FAIL - - [':in-range' update number3's min < value] - expected: FAIL - - [':out-of-range' matches all elements that are candidates for constraint validation, have range limitations, and that are either suffering from an underflow or suffering from an overflow] - expected: FAIL - - [':out-of-range' update number1's value < min] - expected: FAIL - - [':out-of-range' update number3's min < value] - expected: FAIL - |