summaryrefslogtreecommitdiffstats
path: root/dom/html/test/test_bug605124-1.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/html/test/test_bug605124-1.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/html/test/test_bug605124-1.html')
-rw-r--r--dom/html/test/test_bug605124-1.html107
1 files changed, 107 insertions, 0 deletions
diff --git a/dom/html/test/test_bug605124-1.html b/dom/html/test/test_bug605124-1.html
new file mode 100644
index 000000000..7c3a8ee9b
--- /dev/null
+++ b/dom/html/test/test_bug605124-1.html
@@ -0,0 +1,107 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=605124
+-->
+<head>
+ <title>Test for Bug 605124</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=605124">Mozilla Bug 605124</a>
+<p id="display"></p>
+<div id="content">
+ <form>
+ <textarea required></textarea>
+ <input required>
+ <select required></select>
+ <button type='submit'></button>
+ </form>
+
+ <table>
+ <form>
+ <tr>
+ <textarea required></textarea>
+ <input required>
+ <select required></select>
+ <button type='submit'></button>
+ </tr>
+ </form>
+ </table>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 605124 **/
+
+function checkPseudoClass(aElement, aExpected)
+{
+ is(aElement.matches(":-moz-ui-invalid"), aExpected,
+ "matches(':-moz-ui-invalid') should return " + aExpected + " for " + aElement);
+}
+
+var os = SpecialPowers.Cc['@mozilla.org/observer-service;1']
+ .getService(SpecialPowers.Ci.nsIObserverService);
+var observers = os.enumerateObservers("invalidformsubmit");
+
+if (observers.hasMoreElements()) {
+ var content = document.getElementById('content');
+ var textarea = document.getElementsByTagName('textarea')[0];
+ var input = document.getElementsByTagName('input')[0];
+ var select = document.getElementsByTagName('select')[0];
+ var button = document.getElementsByTagName('button')[0];
+ var form = document.forms[0];
+
+ checkPseudoClass(textarea, false);
+ checkPseudoClass(input, false);
+ checkPseudoClass(select, false);
+
+ // Try to submit.
+ button.click();
+ checkPseudoClass(textarea, true);
+ checkPseudoClass(input, true);
+ checkPseudoClass(select, true);
+
+ // No longer in the form.
+ content.appendChild(textarea);
+ content.appendChild(input);
+ content.appendChild(select);
+ checkPseudoClass(textarea, false);
+ checkPseudoClass(input, false);
+ checkPseudoClass(select, false);
+
+ // Back in the form.
+ form.appendChild(textarea);
+ form.appendChild(input);
+ form.appendChild(select);
+ checkPseudoClass(textarea, true);
+ checkPseudoClass(input, true);
+ checkPseudoClass(select, true);
+
+ /* Case when elements get orphaned. */
+ var textarea = document.getElementsByTagName('textarea')[1];
+ var input = document.getElementsByTagName('input')[1];
+ var select = document.getElementsByTagName('select')[1];
+ var button = document.getElementsByTagName('button')[1];
+ var form = document.forms[1];
+
+ // Try to submit.
+ button.click();
+ checkPseudoClass(textarea, true);
+ checkPseudoClass(input, true);
+ checkPseudoClass(select, true);
+
+ // Remove the form.
+ document.getElementsByTagName('table')[0].removeChild(form);
+ checkPseudoClass(textarea, false);
+ checkPseudoClass(input, false);
+ checkPseudoClass(select, false);
+} else {
+ todo(false, "No 'invalidformsubmit' observers. Skip test.");
+}
+
+</script>
+</pre>
+</body>
+</html>