diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html/semantics/interactive-elements | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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 'testing/web-platform/tests/html/semantics/interactive-elements')
14 files changed, 498 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/.gitkeep b/testing/web-platform/tests/html/semantics/interactive-elements/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/.gitkeep diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/commands/.gitkeep b/testing/web-platform/tests/html/semantics/interactive-elements/commands/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/commands/.gitkeep diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/commands/contains.json b/testing/web-platform/tests/html/semantics/interactive-elements/commands/contains.json new file mode 100644 index 000000000..b2ca2e771 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/commands/contains.json @@ -0,0 +1,38 @@ +[ + { + "id": "using-the-a-element-to-define-a-command", + "original_id": "using-the-a-element-to-define-a-command" + }, + { + "id": "using-the-button-element-to-define-a-command", + "original_id": "using-the-button-element-to-define-a-command" + }, + { + "id": "using-the-input-element-to-define-a-command", + "original_id": "using-the-input-element-to-define-a-command" + }, + { + "id": "using-the-option-element-to-define-a-command", + "original_id": "using-the-option-element-to-define-a-command" + }, + { + "id": "using-the-command-element-to-define-a-command", + "original_id": "using-the-command-element-to-define-a-command" + }, + { + "id": "using-the-command-attribute-on-command-elements-to-define-a-command-indirectly", + "original_id": "using-the-command-attribute-on-command-elements-to-define-a-command-indirectly" + }, + { + "id": "using-the-accesskey-attribute-on-a-label-element-to-define-a-command", + "original_id": "using-the-accesskey-attribute-on-a-label-element-to-define-a-command" + }, + { + "id": "using-the-accesskey-attribute-on-a-legend-element-to-define-a-command", + "original_id": "using-the-accesskey-attribute-on-a-legend-element-to-define-a-command" + }, + { + "id": "using-the-accesskey-attribute-to-define-a-command-on-other-elements", + "original_id": "using-the-accesskey-attribute-to-define-a-command-on-other-elements" + } +]
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-command-element/.gitkeep b/testing/web-platform/tests/html/semantics/interactive-elements/the-command-element/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-command-element/.gitkeep diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-details-element/.gitkeep b/testing/web-platform/tests/html/semantics/interactive-elements/the-details-element/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-details-element/.gitkeep diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-details-element/details.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-details-element/details.html new file mode 100644 index 000000000..5ed14c53a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-details-element/details.html @@ -0,0 +1,47 @@ +<!doctype html> +<html> + <head> + <title>HTML details element API</title> + <style>#one, #two { visibility: hidden; }</style> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + + <!-- Used in parsing tests --> + <div id='one'><details></details><details></details></div> + <div id='two'><p><details></details></div> + + <script type="text/javascript"> + +function makeDetails () { + return document.createElement('details'); +} + + +// <details> +test(function () { + var times = document.getElementById('one').getElementsByTagName('details'); + assert_equals( times.length, 2 ); +}, 'HTML parsing should locate 2 details elements in this document'); + +test(function () { + assert_equals( document.getElementById('two').getElementsByTagName('p')[0].innerHTML, '' ); +}, 'HTML parsing should close an unclosed <p> before <details>'); + +test(function () { + assert_true( !!window.HTMLDetailsElement ); +}, 'HTMLDetailsElement should be exposed for prototyping'); + +test(function () { + assert_true( makeDetails() instanceof window.HTMLDetailsElement); +}, 'a dynamically created details element should be instanceof HTMLDetailsElement'); + +test(function () { + assert_true( document.getElementById('one').getElementsByTagName('details')[0] instanceof window.HTMLDetailsElement); +}, 'a details element from the parser should be instanceof HTMLDetailsElement'); + </script> + + </body> +</html> diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html new file mode 100644 index 000000000..da255a384 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html @@ -0,0 +1,157 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>The details element</title> +<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org"> +<link rel=help href="https://html.spec.whatwg.org/multipage/#the-details-element"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<details id=details1> + <summary>Lorem ipsum</summary> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> +</details> +<details id=details2 open> + <summary>Lorem ipsum</summary> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> +</details> +<details id=details3 style="display:none;"> + <summary>Lorem ipsum</summary> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> +</details> +<details id=details4> +</details> +<details id=details6> + <summary>Lorem ipsum</summary> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> +</details> +<details id=details7> + <summary>Lorem ipsum</summary> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> +</details> +<details id=details8 open> + <summary>Lorem ipsum</summary> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> +</details> +<details id=details9 open> + <summary>Lorem ipsum</summary> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> +</details> +<details id=details10> + <summary>Lorem ipsum</summary> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> +</details> +<script> + var t1 = async_test("Adding open to 'details' should fire a toggle event at the 'details' element"), + t2 = async_test("Removing open from 'details' should fire a toggle event at the 'details' element"), + t3 = async_test("Adding open to 'details' (display:none) should fire a toggle event at the 'details' element"), + t4 = async_test("Adding open from 'details' (no children) should fire a toggle event at the 'details' element"), + t6 = async_test("Calling open twice on 'details' fires only one toggle event"), + t7 = async_test("Calling setAttribute('open', '') to 'details' should fire a toggle event at the 'details' element"), + t8 = async_test("Calling removeAttribute('open') to 'details' should fire a toggle event at the 'details' element"), + t9 = async_test("Setting open=true to opened 'details' element should not fire a toggle event at the 'details' element"), + t10 = async_test("Setting open=false to closed 'details' element should not fire a toggle event at the 'details' element"), + + details1 = document.getElementById('details1'), + details2 = document.getElementById('details2'), + details3 = document.getElementById('details3'), + details4 = document.getElementById('details4'), + details6 = document.getElementById('details6'), + details7 = document.getElementById('details7'), + details8 = document.getElementById('details8'), + details9 = document.getElementById('details9'), + details10 = document.getElementById('details10'), + loop=false; + + function testEvent(evt) { + assert_true(evt.isTrusted, "event is trusted"); + assert_false(evt.bubbles, "event doesn't bubble"); + assert_false(evt.cancelable, "event is not cancelable"); + assert_equals(Object.getPrototypeOf(evt), Event.prototype, "Prototype of toggle event is Event.prototype"); + } + + details1.ontoggle = t1.step_func_done(function(evt) { + assert_true(details1.open); + testEvent(evt) + }); + details1.open = true; // opens details1 + + details2.ontoggle = t2.step_func_done(function(evt) { + assert_false(details2.open); + testEvent(evt); + }); + details2.open = false; // closes details2 + + details3.ontoggle = t3.step_func_done(function(evt) { + assert_true(details3.open); + testEvent(evt); + }); + details3.open = true; // opens details3 + + details4.ontoggle = t4.step_func_done(function(evt) { + assert_true(details4.open); + testEvent(evt); + }); + details4.open = true; // opens details4 + + async_test(function(t) { + var details5 = document.createElement("details"); + details5.ontoggle = t.step_func_done(function(evt) { + assert_true(details5.open); + testEvent(evt); + }) + details5.open = true; + }, "Adding open to 'details' (not in the document) should fire a toggle event at the 'details' element"); + + details6.open = true; + details6.open = false; + details6.ontoggle = t6.step_func(function() { + if (loop) { + assert_unreached("toggle event fired twice"); + } else { + loop = true; + } + }); + setTimeout(t6.step_func(function() { + assert_true(loop); + t6.done(); + }), 0); + + details7.ontoggle = t7.step_func_done(function(evt) { + assert_true(details7.open); + testEvent(evt) + }); + details7.setAttribute('open', ''); // opens details7 + + details8.ontoggle = t8.step_func_done(function(evt) { + assert_false(details8.open); + testEvent(evt) + }); + details8.removeAttribute('open'); // closes details8 + + var toggleFiredOnDetails9 = false; + details9.ontoggle = t9.step_func_done(function(evt) { + if (toggleFiredOnDetails9) { + assert_unreached("toggle event fired twice on opened details element"); + } else { + toggleFiredOnDetails9 = true; + } + }); + // The toggle event should be fired once when declaring details9 with open + // attribute. + details9.open = true; // opens details9 + setTimeout(t9.step_func(function() { + assert_true(details9.open); + assert_true(toggleFiredOnDetails9); + t9.done(); + }), 0); + + details10.ontoggle = t10.step_func_done(function(evt) { + assert_unreached("toggle event fired on closed details element"); + }); + details10.open = false; // closes details10 + setTimeout(t10.step_func(function() { + assert_false(details10.open); + t10.done(); + }), 0); + +</script> diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/contains.json b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/contains.json new file mode 100644 index 000000000..c865c8588 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/contains.json @@ -0,0 +1,6 @@ +[ + { + "id": "anchor-points", + "original_id": "anchor-points" + } +]
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-close.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-close.html new file mode 100644 index 000000000..9029612b2 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-close.html @@ -0,0 +1,77 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>dialog element: close()</title> +<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org"> +<link rel=help href="https://html.spec.whatwg.org/multipage/#the-dialog-element"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<dialog id="d1"> + <p>foobar</p> + <button>OK</button> +</dialog> +<dialog id="d2" open> + <p>foobar</p> + <button>OK</button> +</dialog> +<dialog id="d3" open> + <p>foobar</p> + <button>OK</button> +</dialog> +<dialog id="d4" open> + <p>foobar</p> + <button>OK</button> +</dialog> +<dialog id="d5" open> + <p>foobar</p> + <button>OK</button> +</dialog> +<script> + var d1 = document.getElementById('d1'), + d2 = document.getElementById('d2'), + d3 = document.getElementById('d3'), + d4 = document.getElementById('d4'), + d5 = document.getElementById('d5'), + t = async_test("close() fires a close event"), + was_queued = false; + + test(function(){ + d1.close("closedialog"); + assert_equals(d1.returnValue, ""); + }, "close() on a <dialog> that doesn't have an open attribute aborts the steps"); + + test(function(){ + assert_true(d2.open); + assert_equals(d2.returnValue, ""); + d2.close("closedialog"); + assert_false(d2.hasAttribute("open")); + assert_equals(d2.returnValue, "closedialog"); + }, "close() removes the open attribute and set the returnValue to the first argument"); + + test(function(){ + assert_true(d3.open); + assert_equals(d3.returnValue, ""); + d3.returnValue = "foobar"; + d3.close(); + assert_false(d3.hasAttribute("open")); + assert_equals(d3.returnValue, "foobar"); + }, "close() without argument removes the open attribute and there's no returnValue"); + + d4.onclose = t.step_func_done(function(e) { + assert_true(was_queued, "close event should be queued"); + assert_true(e.isTrusted, "close event is trusted"); + assert_false(e.bubbles, "close event doesn't bubble"); + assert_false(e.cancelable, "close event is not cancelable"); + }); + + t.step(function() { + d4.close(); + was_queued = true; + }) + + test(function(){ + Object.defineProperty(HTMLDialogElement.prototype, 'returnValue', { set: function(v) { assert_unreached('JS-defined setter returnValue on the prototype was invoked'); }, configurable:true }); + Object.defineProperty(d5, 'returnValue', { set: function(v) { assert_unreached('JS-defined setter returnValue on the instance was invoked'); }, configurable:true }); + d5.close('foo'); + }, "close() should set the returnValue IDL attribute but not the JS property"); +</script> diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-open.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-open.html new file mode 100644 index 000000000..4719f63b8 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-open.html @@ -0,0 +1,30 @@ +<!doctype html> +<meta charset="utf-8"> +<title>dialog element: open</title> +<link rel=help href="https://html.spec.whatwg.org/multipage/forms.html#dom-dialog-open"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<dialog id="d1"> + <p>foobar</p> + <button>OK</button> +</dialog> +<dialog id="d2" open> + <p>foobar</p> + <button>OK</button> +</dialog> +<script> + var d1 = document.getElementById('d1'); + var d2 = document.getElementById('d2'); + + test(function(){ + assert_false(d1.open); + assert_true(d2.open); + }, "On getting, the IDL open attribute must return true if the content open attribute is set, and false if it is absent."); + + test(function(){ + d1.open = true; + assert_true(d1.hasAttribute("open")); + d2.open = false; + assert_false(d2.hasAttribute("open")); + }, "On setting, the content open attribute must be removed if the IDL open attribute is set to false, and must be present if the IDL open attribute is set to true."); +</script> diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html new file mode 100644 index 000000000..6ca9189c0 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html @@ -0,0 +1,125 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>dialog element: showModal()</title> +<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org"> +<link rel=help href="https://html.spec.whatwg.org/multipage/#the-dialog-element"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<button id="b0">OK</button> +<dialog id="d1"> + <p>foobar</p> + <button id="b1">OK</button> +</dialog> +<dialog id="d2" open> + <p>foobar</p> + <button>OK</button> +</dialog> +<dialog id="d3"> + <p>foobar</p> + <button id="b3">OK</button> +</dialog> +<dialog id="d4"> + <p>foobar</p> + <button id="b4">OK</button> +</dialog> +<dialog id="d5"> + <p>foobar</p> + <button id="b5">OK</button> +</dialog> +<dialog id="d6"></dialog> +<dialog id="d7"> + <input id="i71" value="foobar"> + <input id="i72" value="foobar"> + <button id="b7">OK</button> +</dialog> +<dialog id="d8"> + <input id="i81" value="foobar"> + <input id="i82" value="foobar" autofocus> + <button id="b8">OK</button> +</dialog> +<script> + var d1 = document.getElementById('d1'), + d2 = document.getElementById('d2'), + d3 = document.getElementById('d3'), + d4 = document.getElementById('d4'), + d5 = document.getElementById('d5'), + d6 = document.getElementById('d6'), + d7 = document.getElementById('d7'), + d8 = document.getElementById('d8'), + b0 = document.getElementById('b0'), + b1 = document.getElementById('b1'), + b3 = document.getElementById('b3'), + b4 = document.getElementById('b4'), + b5 = document.getElementById('b5'); + + test(function(){ + assert_false(d1.open); + assert_false(b0.commandDisabled); + d1.showModal(); + this.add_cleanup(function() { d1.close(); }); + assert_true(d1.open); + assert_true(b0.commandDisabled); + assert_equals(document.activeElement, b1); + }); + + test(function(){ + assert_throws("INVALID_STATE_ERR", function() { + d2.showModal(); + this.add_cleanup(function() { d2.close(); }); + }); + }, "showModal() on a <dialog> that already has an open attribute throws an InvalidStateError exception"); + + test(function(){ + var d = document.createElement("dialog"); + assert_throws("INVALID_STATE_ERR", function() { + d.showModal(); + this.add_cleanup(function() { d.close(); }); + }); + }, "showModal() on a <dialog> not in a Document throws an InvalidStateError exception"); + + test(function(){ + assert_false(d3.open); + assert_false(b3.commandDisabled); + assert_false(d4.open); + assert_false(b4.commandDisabled); + assert_false(d5.open); + assert_false(b5.commandDisabled); + d3.showModal(); + this.add_cleanup(function() { d3.close(); }); + d4.showModal(); + this.add_cleanup(function() { d4.close(); }); + d5.showModal(); + this.add_cleanup(function() { d5.close(); }); + assert_true(d3.open); + assert_true(b3.commandDisabled); + assert_true(d4.open); + assert_true(b4.commandDisabled); + assert_true(d5.open); + assert_false(b5.commandDisabled); + }, "when opening multiple dialogs, only the newest one is non-inert"); + + test(function(){ + assert_false(d6.open); + d6.showModal(); + this.add_cleanup(function() { d6.close(); }); + assert_true(d6.open); + assert_equals(document.activeElement, d6); + }, "opening dialog without focusable children"); + + test(function(){ + assert_false(d7.open); + d7.showModal(); + this.add_cleanup(function() { d7.close(); }); + assert_true(d7.open); + assert_equals(document.activeElement, document.getElementById("i71")); + }, "opening dialog with multiple focusable children"); + + test(function(){ + assert_false(d8.open); + d8.showModal(); + this.add_cleanup(function() { d8.close(); }); + assert_true(d8.open); + assert_equals(document.activeElement, document.getElementById("i82")); + }, "opening dialog with multiple focusable children, one having the autofocus attribute"); +</script> diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-menu-element/.gitkeep b/testing/web-platform/tests/html/semantics/interactive-elements/the-menu-element/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-menu-element/.gitkeep diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-menu-element/contains.json b/testing/web-platform/tests/html/semantics/interactive-elements/the-menu-element/contains.json new file mode 100644 index 000000000..20f2439f6 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-menu-element/contains.json @@ -0,0 +1,18 @@ +[ + { + "id": "menus-intro", + "original_id": "menus-intro" + }, + { + "id": "building-menus-and-toolbars", + "original_id": "building-menus-and-toolbars" + }, + { + "id": "context-menus", + "original_id": "context-menus" + }, + { + "id": "toolbars", + "original_id": "toolbars" + } +]
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-summary-element/.gitkeep b/testing/web-platform/tests/html/semantics/interactive-elements/the-summary-element/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-summary-element/.gitkeep |