diff options
Diffstat (limited to 'layout/reftests/css-ui-invalid/input')
53 files changed, 705 insertions, 0 deletions
diff --git a/layout/reftests/css-ui-invalid/input/input-button-ref.html b/layout/reftests/css-ui-invalid/input/input-button-ref.html new file mode 100644 index 000000000..3b828533e --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-button-ref.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> + <body> + <input type='button' style="background-color: green;"> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-button.html b/layout/reftests/css-ui-invalid/input/input-button.html new file mode 100644 index 000000000..1ec43cc1e --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-button.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input is of button type, it is barred from constraint validation + and should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' type='button'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-changed.html new file mode 100644 index 000000000..1ad786062 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-changed.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if input isn't valid nor barred from constraint validation, + and its checkedness has changed, + it should be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').checked = false; + if (!document.getElementById('i').matches(':-moz-ui-invalid')) { + document.body.textContent='FAIL'; + } else { + document.body.textContent='SUCCESS'; + } + document.documentElement.className='';"> + <input id='i' type='checkbox' required> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-default.html new file mode 100644 index 000000000..ee01e0d38 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-checkbox-required-invalid-default.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if input isn't valid nor barred from constraint validation, + and its checkedness hasn't changed, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="if (document.getElementById('i').matches(':-moz-ui-invalid')) { + document.body.textContent='FAIL'; + } else { + document.body.textContent='SUCCESS'; + } + document.documentElement.className='';"> + <input id='i' type='checkbox' required> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-customerror.html b/layout/reftests/css-ui-invalid/input/input-customerror.html new file mode 100644 index 000000000..676b4bd48 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-customerror.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <head> + <script> + function doTest() { + document.getElementById('t').setCustomValidity('foo'); + document.documentElement.className=''; + } + document.addEventListener("MozReftestInvalidate", doTest, false); + </script> + </head> + <!-- Test: if input has a custom error, it should be affected by :-moz-ui-invalid + pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='invalid' id='t'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-1.html b/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-1.html new file mode 100644 index 000000000..7fbc040c9 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-1.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input has a disabled fieldset ancestor, it is barred from + constraint validation and should not be affected by :-moz-ui-invalid + pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <fieldset disabled> + <fieldset> + <input class='notinvalid' required> + </fieldset> + </fieldset> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-2.html b/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-2.html new file mode 100644 index 000000000..4cda69457 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-disabled-fieldset-2.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if input has a disabled fieldset ancestor, it is barred from + constraint validation and should not be affected by :-moz-ui-invalid + pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <script> + function onloadHandler() + { + var fieldsets = document.getElementsByTagName("fieldset"); + fieldsets[1].disabled = true; + fieldsets[0].disabled = false; + document.documentElement.className=''; + } + </script> + <body onload="onloadHandler();"> + <fieldset disabled> + <fieldset> + <input class='notinvalid' required> + </fieldset> + </fieldset> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-disabled.html b/layout/reftests/css-ui-invalid/input/input-disabled.html new file mode 100644 index 000000000..6757fb096 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-disabled.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input is disabled, it is barred from constraint validation + and should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' disabled> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-dyn-disabled.html b/layout/reftests/css-ui-invalid/input/input-dyn-disabled.html new file mode 100644 index 000000000..f2094b48b --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-dyn-disabled.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if input is disabled and invalid, it is barred from constraint + validation and should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <script> + function onLoadHandler() + { + var e = document.getElementById('i'); + e.setCustomValidity('foo'); + e.disabled = 'true'; + document.documentElement.className=''; + } + </script> + <body onload="onLoadHandler();"> + <input class='notinvalid' id='i'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-dyn-not-disabled.html b/layout/reftests/css-ui-invalid/input/input-dyn-not-disabled.html new file mode 100644 index 000000000..cff1501a4 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-dyn-not-disabled.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if input is not disabled and invalid, it is candidate for + constraint validation and should be affected + by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <script> + function onLoadHandler() + { + var e = document.getElementById('i'); + e.setCustomValidity('foo'); + e.removeAttribute('disabled'); + document.documentElement.className=''; + } + </script> + <body onload="onLoadHandler();"> + <input class='invalid' id='i' disabled> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-changed.html b/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-changed.html new file mode 100644 index 000000000..e9686e98f --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-changed.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if input is no longer readonly, invalid and has it's value changed, + it's affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').removeAttribute('readonly'); + document.getElementById('i').value = ''; + document.documentElement.className='';"> + <input class='invalid' id='i' readonly required> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-not-changed.html b/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-not-changed.html new file mode 100644 index 000000000..b697b4200 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-dyn-not-readonly-not-changed.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if input is no longer readonly and invalid but it's value hasn't + changed, it's affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').removeAttribute('readonly'); document.documentElement.className='';"> + <input class='notinvalid' id='i' readonly required> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-dyn-readonly.html b/layout/reftests/css-ui-invalid/input/input-dyn-readonly.html new file mode 100644 index 000000000..474e8ff4b --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-dyn-readonly.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if input is readonly, it is barred from constraint validation + and should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').readOnly='ro'; document.documentElement.className='';"> + <input class='notinvalid' id='i' required> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-email-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-email-invalid-changed.html new file mode 100644 index 000000000..87f4568ea --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-email-invalid-changed.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if input isn't valid nor barred from constraint validation, + and its value has changed, + it should be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').value = 'foo'; + document.documentElement.className='';"> + <input id='i' class='invalid' type='email' value='bar'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-email-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-email-invalid-default.html new file mode 100644 index 000000000..d4a1c99bb --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-email-invalid-default.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input isn't valid nor barred from constraint validation, + but its default value hasn't been changed, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' type='email' value='foo'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-email-ref.html b/layout/reftests/css-ui-invalid/input/input-email-ref.html new file mode 100644 index 000000000..ecec613c2 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-email-ref.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> + <body> + <input value='foo@bar.com' style="background-color: green;"> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-email-valid.html b/layout/reftests/css-ui-invalid/input/input-email-valid.html new file mode 100644 index 000000000..8e3fbd349 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-email-valid.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input is valid and not barred from constraint validation, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' type='email' value='foo@bar.com'> + </body> +</html> + diff --git a/layout/reftests/css-ui-invalid/input/input-fieldset-legend-ref.html b/layout/reftests/css-ui-invalid/input/input-fieldset-legend-ref.html new file mode 100644 index 000000000..763c383bd --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-fieldset-legend-ref.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <body> + <fieldset> + <legend> + <input style="background-color: green;"> + </legend> + </fieldset> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-fieldset-legend.html b/layout/reftests/css-ui-invalid/input/input-fieldset-legend.html new file mode 100644 index 000000000..6f85637b4 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-fieldset-legend.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input is invalid but it's value hasn't changed, it's not + affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <fieldset disabled> + <legend> + <input class='notinvalid' required> + </legend> + </fieldset> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-fieldset-ref.html b/layout/reftests/css-ui-invalid/input/input-fieldset-ref.html new file mode 100644 index 000000000..a9e123912 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-fieldset-ref.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <body> + <fieldset> + <fieldset> + <input style="background-color: green;"> + </fieldset> + </fieldset> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-file-ref.html b/layout/reftests/css-ui-invalid/input/input-file-ref.html new file mode 100644 index 000000000..73a4fc64c --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-file-ref.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> + <body> + <input type='file' style="background-color: green;"> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-file-required-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-file-required-invalid-changed.html new file mode 100644 index 000000000..960b01b42 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-file-required-invalid-changed.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html class='reftest-wait'> + <!-- Test: if input isn't valid nor barred from constraint validation, + but its default value hasn't been changed, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').value=''; + document.documentElement.className='';"> + <input id='i' class='invalid' type='file' required> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-file-required-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-file-required-invalid-default.html new file mode 100644 index 000000000..aa1d862d4 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-file-required-invalid-default.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input isn't valid nor barred from constraint validation, + but its default value hasn't been changed, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' type='file' required> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-novalidate.html b/layout/reftests/css-ui-invalid/input/input-novalidate.html new file mode 100644 index 000000000..3f786dc7e --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-novalidate.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- When the form has @novalidate, :-moz-ui-invalid doesn't apply. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').value = ''; + document.documentElement.className = '';"> + <form novalidate> + <input id='i' class='notinvalid' required> + </form> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-pattern-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-pattern-invalid-changed.html new file mode 100644 index 000000000..997315770 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-pattern-invalid-changed.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html class='reftest-wait'> + <!-- Test: if input isn't valid nor barred from constraint validation, + and its value isn't the default value, + it should be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').value='foo'; + document.documentElement.className='';"> + <input id='i' class='invalid' pattern='bar' value='f'> + </body> +</html> + diff --git a/layout/reftests/css-ui-invalid/input/input-pattern-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-pattern-invalid-default.html new file mode 100644 index 000000000..0a1a676a8 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-pattern-invalid-default.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input isn't valid nor barred from constraint validation, + but its value is stil lthe default value, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' pattern='bar' value='foo'> + </body> +</html> + diff --git a/layout/reftests/css-ui-invalid/input/input-pattern-valid.html b/layout/reftests/css-ui-invalid/input/input-pattern-valid.html new file mode 100644 index 000000000..7def28f81 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-pattern-valid.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input is valid and not barred from constraint validation, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' pattern='foo' value='foo'> + </body> +</html> + diff --git a/layout/reftests/css-ui-invalid/input/input-radio-customerror.html b/layout/reftests/css-ui-invalid/input/input-radio-customerror.html new file mode 100644 index 000000000..c797243a2 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-radio-customerror.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if one radio in a group is suffering from a custom error, the other + radio should not be invalid. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i1').checked = false; + document.getElementById('i1').setCustomValidity('foo'); + if (!document.getElementById('i1').matches(':-moz-ui-invalid') || + document.getElementById('i2').matches(':-moz-ui-invalid')) { + document.body.textContent='FAIL'; + } else { + document.body.textContent='SUCCESS'; + } + document.documentElement.className='';"> + <input id='i1' name='foo' type='radio'> + <input id='i2' name='foo' type='radio'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-1.html b/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-1.html new file mode 100644 index 000000000..d2fd008e1 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-1.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: when there are no radio suffering from being missing in the radio + group, all radio should not suffer from being missing. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i1').checked = true; + if (document.getElementById('i1').matches(':-moz-ui-invalid') || + document.getElementById('i2').matches(':-moz-ui-invalid')) { + document.body.textContent='FAIL'; + } else { + document.body.textContent='SUCCESS'; + } + document.documentElement.className='';"> + <input id='i1' name='foo' type='radio' required> + <input id='i2' name='foo' type='radio'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-2.html b/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-2.html new file mode 100644 index 000000000..f4ee5d171 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-radio-dyn-valid-2.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: when there are no radio suffering from being missing in the radio + group, all radio should not suffer from being missing. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i1').checked = true; + document.getElementById('i1').required = false; + if (document.getElementById('i1').matches(':-moz-ui-invalid') || + document.getElementById('i2').matches(':-moz-ui-invalid')) { + document.body.textContent='FAIL'; + } else { + document.body.textContent='SUCCESS'; + } + document.documentElement.className='';"> + <input id='i1' name='foo' type='radio' required> + <input id='i2' name='foo' type='radio'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-invalid.html b/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-invalid.html new file mode 100644 index 000000000..dcad63f31 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-invalid.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').checked = true; + if (document.getElementById('i').matches(':-moz-ui-invalid')) { + document.body.textContent='FAIL'; + } else { + document.body.textContent='SUCCESS'; + } + document.documentElement.className='';"> + <input id='i' type='radio' required> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-valid.html b/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-valid.html new file mode 100644 index 000000000..fede2c1a7 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-radio-nogroup-required-valid.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').checked = false; + if (!document.getElementById('i').matches(':-moz-ui-invalid')) { + document.body.textContent='FAIL'; + } else { + document.body.textContent='SUCCESS'; + } + document.documentElement.className='';"> + <input id='i' type='radio' required> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-changed.html new file mode 100644 index 000000000..5b9cd80ac --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-changed.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if input isn't valid nor barred from constraint validation, + and its checkedness has changed, + it should be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').checked = false; + if (!document.getElementById('i').matches(':-moz-ui-invalid')) { + document.body.textContent='FAIL'; + } else { + document.body.textContent='SUCCESS'; + } + document.documentElement.className='';"> + <input id='i' type='radio' required> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-default.html new file mode 100644 index 000000000..cb2456533 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-radio-required-invalid-default.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if input isn't valid nor barred from constraint validation, + and its checkedness hasn't changed, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="if (document.getElementById('i').matches(':-moz-ui-invalid')) { + document.body.textContent='FAIL'; + } else { + document.body.textContent='SUCCESS'; + } + document.documentElement.className='';"> + <input id='i' type='radio' required> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-radio-required.html b/layout/reftests/css-ui-invalid/input/input-radio-required.html new file mode 100644 index 000000000..04b94997e --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-radio-required.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if one radio in a group has the required attribute and no radio is + checked, all radio in the group should have :-moz-ui-invalid + pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i1').checked = false; + if (!document.getElementById('i1').matches(':-moz-ui-invalid') || + !document.getElementById('i2').matches(':-moz-ui-invalid')) { + document.body.textContent='FAIL'; + } else { + document.body.textContent='SUCCESS'; + } + document.documentElement.className='';"> + <input id='i1' name='foo' type='radio' required> + <input id='i2' name='foo' type='radio'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-readonly.html b/layout/reftests/css-ui-invalid/input/input-readonly.html new file mode 100644 index 000000000..8f5ab0c3c --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-readonly.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input is readonly, it is barred from constraint validation + and should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' readonly> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-ref.html b/layout/reftests/css-ui-invalid/input/input-ref.html new file mode 100644 index 000000000..65b4b9707 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-ref.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> + <body> + <input style="background-color: green;"> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-required-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-required-invalid-changed.html new file mode 100644 index 000000000..64927141f --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-required-invalid-changed.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html class='reftest-wait'> + <!-- Test: if input isn't valid nor barred from constraint validation, + it should be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').value=''; + document.documentElement.className='';"> + <input id='i' class='invalid' required> + </body> +</html> + diff --git a/layout/reftests/css-ui-invalid/input/input-required-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-required-invalid-default.html new file mode 100644 index 000000000..3d4e17aea --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-required-invalid-default.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input isn't valid nor barred from constraint validation, + but its value is still the default value, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' required> + </body> +</html> + diff --git a/layout/reftests/css-ui-invalid/input/input-required-valid.html b/layout/reftests/css-ui-invalid/input/input-required-valid.html new file mode 100644 index 000000000..34dca4585 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-required-valid.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input is valid and not barred from constraint validation, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' value='foo' required> + </body> +</html> + diff --git a/layout/reftests/css-ui-invalid/input/input-reset.html b/layout/reftests/css-ui-invalid/input/input-reset.html new file mode 100644 index 000000000..06092d45c --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-reset.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input is of reset type, it is barred from constraint validation + and should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <!-- Setting value to the empty string let us check against input-button-ref.html --> + <input class='notinvalid' type='reset' value=''> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-type-barred.html b/layout/reftests/css-ui-invalid/input/input-type-barred.html new file mode 100644 index 000000000..145b114d6 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-type-barred.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if an input has is candidate for constraint validation then change + its type to be barred from constraint validation, it should not be + affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').type='button'; document.documentElement.className='';"> + <input class='notinvalid' id='i'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-type-invalid.html b/layout/reftests/css-ui-invalid/input/input-type-invalid.html new file mode 100644 index 000000000..e37173ede --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-type-invalid.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <!-- Test: if an input has a custom error when barred from constraint + validation then move a type candidate for constraint validation, + it should not be affected by :valid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <script> + function doTest() + { + var i = document.getElementById('i'); + i.setCustomValidity('foo'); + i.type = 'text'; + document.documentElement.className=''; + } + document.addEventListener("MozReftestInvalidate", doTest, false); + </script> + <body> + <input class='invalid' type='button' id='i'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-url-invalid-changed.html b/layout/reftests/css-ui-invalid/input/input-url-invalid-changed.html new file mode 100644 index 000000000..f00b5acbd --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-url-invalid-changed.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html class='reftest-wait'> + <!-- Test: if input isn't valid nor barred from constraint validation, + and its value is not the default value, + it should be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body onload="document.getElementById('i').value='foo'; + document.documentElement.className='';"> + <input id='i' class='invalid' type='url'> + </body> +</html> + diff --git a/layout/reftests/css-ui-invalid/input/input-url-invalid-default.html b/layout/reftests/css-ui-invalid/input/input-url-invalid-default.html new file mode 100644 index 000000000..2ce04568a --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-url-invalid-default.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input isn't valid nor barred from constraint validation, + but its value is the default value, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' type='url' value='foo'> + </body> +</html> + diff --git a/layout/reftests/css-ui-invalid/input/input-url-ref.html b/layout/reftests/css-ui-invalid/input/input-url-ref.html new file mode 100644 index 000000000..e95cdbca2 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-url-ref.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> + <body> + <input value='http://mozilla.org/' style="background-color: green;"> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-url-valid.html b/layout/reftests/css-ui-invalid/input/input-url-valid.html new file mode 100644 index 000000000..8b615a770 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-url-valid.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input is valid and not barred from constraint validation, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid' type='url' value='http://mozilla.org/'> + </body> +</html> + diff --git a/layout/reftests/css-ui-invalid/input/input-valid.html b/layout/reftests/css-ui-invalid/input/input-valid.html new file mode 100644 index 000000000..a8b4157a8 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-valid.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html> + <!-- Test: if input is valid and is not barred from constraint validation, + it should not be affected by :-moz-ui-invalid pseudo-class. --> + <link rel='stylesheet' type='text/css' href='style.css'> + <body> + <input class='notinvalid'> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/input-withtext-ref.html b/layout/reftests/css-ui-invalid/input/input-withtext-ref.html new file mode 100644 index 000000000..d54d05215 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/input-withtext-ref.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> + <body> + <input value='foo' style="background-color: green;"> + </body> +</html> diff --git a/layout/reftests/css-ui-invalid/input/reftest-stylo.list b/layout/reftests/css-ui-invalid/input/reftest-stylo.list new file mode 100644 index 000000000..993d7c245 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/reftest-stylo.list @@ -0,0 +1,48 @@ +# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing +== input-valid.html input-valid.html +== input-customerror.html input-customerror.html +skip-if(B2G||Mulet) fuzzy-if(skiaContent,1,3) == input-disabled.html input-disabled.html +# Initial mulet triage: parity with B2G/B2G Desktop +skip-if(B2G||Mulet) fuzzy-if(skiaContent,1,3) == input-dyn-disabled.html input-dyn-disabled.html +# Initial mulet triage: parity with B2G/B2G Desktop +fuzzy-if(skiaContent,1,3) == input-dyn-not-disabled.html input-dyn-not-disabled.html +fuzzy-if(skiaContent,1,3) == input-readonly.html input-readonly.html +fuzzy-if(skiaContent,1,3) == input-dyn-readonly.html input-dyn-readonly.html +fails fuzzy-if(skiaContent,1,3) == input-dyn-not-readonly-not-changed.html input-dyn-not-readonly-not-changed.html +fails fuzzy-if(skiaContent,1,3) == input-dyn-not-readonly-changed.html input-dyn-not-readonly-changed.html +skip == input-maxlength-valid.html input-maxlength-valid.html +skip == input-maxlength-invalid-changed.html input-maxlength-invalid-changed.html +skip == input-maxlength-invalid-default.html input-maxlength-invalid-default.html +== input-required-valid.html input-required-valid.html +fuzzy-if(skiaContent,1,3) == input-required-invalid-default.html input-required-invalid-default.html +fails fuzzy-if(skiaContent,1,3) == input-required-invalid-changed.html input-required-invalid-changed.html +fuzzy-if(skiaContent,2,5) == input-button.html input-button.html +skip fuzzy-if(skiaContent,2,5) == input-reset.html input-reset.html +== input-email-invalid-default.html input-email-invalid-default.html +== input-email-invalid-changed.html input-email-invalid-changed.html +fuzzy-if(skiaContent,2,5) == input-email-valid.html input-email-valid.html +== input-url-invalid-changed.html input-url-invalid-changed.html +== input-url-invalid-default.html input-url-invalid-default.html +== input-url-valid.html input-url-valid.html +== input-pattern-valid.html input-pattern-valid.html +== input-pattern-invalid-default.html input-pattern-invalid-default.html +== input-pattern-invalid-changed.html input-pattern-invalid-changed.html +fuzzy-if(skiaContent,2,5) == input-type-barred.html input-type-barred.html +== input-type-invalid.html input-type-invalid.html +== input-disabled-fieldset-1.html input-disabled-fieldset-1.html +fuzzy-if(skiaContent,1,3) == input-disabled-fieldset-2.html input-disabled-fieldset-2.html +skip fuzzy-if(skiaContent,1,3) == input-fieldset-legend.html input-fieldset-legend.html +== input-checkbox-required-invalid-changed.html input-checkbox-required-invalid-changed.html +== input-checkbox-required-invalid-default.html input-checkbox-required-invalid-default.html +== input-radio-required-invalid-changed.html input-radio-required-invalid-changed.html +== input-radio-required-invalid-default.html input-radio-required-invalid-default.html +== input-file-required-invalid-changed.html input-file-required-invalid-changed.html +== input-file-required-invalid-default.html input-file-required-invalid-default.html +== input-radio-required.html input-radio-required.html +== input-radio-customerror.html input-radio-customerror.html +== input-radio-dyn-valid-1.html input-radio-dyn-valid-1.html +== input-radio-dyn-valid-2.html input-radio-dyn-valid-2.html +== input-radio-nogroup-required-valid.html input-radio-nogroup-required-valid.html +== input-radio-nogroup-required-invalid.html input-radio-nogroup-required-invalid.html +fails fuzzy-if(skiaContent,1,3) == input-novalidate.html input-novalidate.html +# input type='hidden' shouldn't show diff --git a/layout/reftests/css-ui-invalid/input/reftest.list b/layout/reftests/css-ui-invalid/input/reftest.list new file mode 100644 index 000000000..53198ee42 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/reftest.list @@ -0,0 +1,42 @@ +== input-valid.html input-ref.html +fuzzy(64,4) == input-customerror.html input-ref.html +fuzzy-if(skiaContent,1,3) == input-disabled.html input-ref.html +fuzzy-if(skiaContent,1,3) == input-dyn-disabled.html input-ref.html +fuzzy-if(skiaContent,1,3) == input-dyn-not-disabled.html input-ref.html +fuzzy-if(skiaContent,1,3) == input-readonly.html input-ref.html +fuzzy-if(skiaContent,1,3) == input-dyn-readonly.html input-ref.html +fuzzy-if(skiaContent,1,3) == input-dyn-not-readonly-not-changed.html input-ref.html +fuzzy-if(skiaContent,1,3) == input-dyn-not-readonly-changed.html input-ref.html +== input-required-valid.html input-withtext-ref.html +fuzzy-if(skiaContent,1,3) == input-required-invalid-default.html input-ref.html +fuzzy-if(skiaContent,1,3) == input-required-invalid-changed.html input-ref.html +fuzzy-if(skiaContent,2,5) == input-button.html input-button-ref.html +fuzzy-if(skiaContent,2,5) == input-reset.html input-button-ref.html +== input-email-invalid-default.html input-withtext-ref.html +== input-email-invalid-changed.html input-withtext-ref.html +fuzzy-if(skiaContent,2,5) == input-email-valid.html input-email-ref.html +== input-url-invalid-changed.html input-withtext-ref.html +== input-url-invalid-default.html input-withtext-ref.html +== input-url-valid.html input-url-ref.html +== input-pattern-valid.html input-withtext-ref.html +== input-pattern-invalid-default.html input-withtext-ref.html +== input-pattern-invalid-changed.html input-withtext-ref.html +fuzzy-if(skiaContent,2,5) == input-type-barred.html input-button-ref.html +fuzzy(64,4) == input-type-invalid.html input-ref.html +== input-disabled-fieldset-1.html input-fieldset-ref.html +fuzzy-if(skiaContent,1,3) == input-disabled-fieldset-2.html input-fieldset-ref.html +fuzzy-if(skiaContent,1,3) == input-fieldset-legend.html input-fieldset-legend-ref.html +== input-checkbox-required-invalid-changed.html success-ref.html +== input-checkbox-required-invalid-default.html success-ref.html +== input-radio-required-invalid-changed.html success-ref.html +== input-radio-required-invalid-default.html success-ref.html +== input-file-required-invalid-changed.html input-file-ref.html +== input-file-required-invalid-default.html input-file-ref.html +== input-radio-required.html success-ref.html +== input-radio-customerror.html success-ref.html +== input-radio-dyn-valid-1.html success-ref.html +== input-radio-dyn-valid-2.html success-ref.html +== input-radio-nogroup-required-valid.html success-ref.html +== input-radio-nogroup-required-invalid.html success-ref.html +fuzzy-if(skiaContent,1,3) == input-novalidate.html input-ref.html +# input type='hidden' shouldn't show diff --git a/layout/reftests/css-ui-invalid/input/style.css b/layout/reftests/css-ui-invalid/input/style.css new file mode 100644 index 000000000..93a61a020 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/style.css @@ -0,0 +1,23 @@ +/* Override default style */ +input:-moz-ui-invalid { + box-shadow: none; +} + +input.notinvalid { + background-color: green; +} +input.notinvalid:-moz-ui-invalid { + background-color: red; +} + +input.invalid { + background-color: red; +} +input.invalid:-moz-ui-invalid { + background-color: green; +} + +input[type=checkbox], +input[type=radio] { + display: none; +} diff --git a/layout/reftests/css-ui-invalid/input/success-ref.html b/layout/reftests/css-ui-invalid/input/success-ref.html new file mode 100644 index 000000000..bfa8e0a12 --- /dev/null +++ b/layout/reftests/css-ui-invalid/input/success-ref.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> + <body> + SUCCESS + </body> +</html> |