Bug 1245424 Part 3 - Add reftest for click events with actions in capturing phase. r=bz

These tests modify details or summary elements in the 'click' event
listener in capturing phase higher up in the DOM tree.

MozReview-Commit-ID: Lp5OzXnNgL4

--HG--
extra : rebase_source : 5772a84795b1b8b6b9bb6cbf928bfb612eb07971
This commit is contained in:
Ting-Yu Lin 2016-03-24 15:05:29 +08:00
Родитель 577ce8ed43
Коммит a7ea8a84ac
6 изменённых файлов: 123 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,29 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html class="reftest-wait">
<script>
function runTest() {
// Both Chrome and Safari add the 'open' attribute to the details element.
var details = document.getElementById("details");
var summary = document.getElementById("summary");
document.body.addEventListener("click", function () {
// Change details to display: none in capturing phase.
details.style.display = "none";
}, true);
summary.dispatchEvent(new MouseEvent("click"));
details.style.display = "block";
document.documentElement.removeAttribute("class");
}
</script>
<body onload="runTest();">
<details id="details">
<summary id="summary">Summary</summary>
<p>This is the details.</p>
</details>
</body>
</html>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<body>
<div>
<p>This is the details.</p>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,29 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html class="reftest-wait">
<script>
function runTest() {
// Both Chrome and Safari add the 'open' attribute to the details element.
// Firefox has the same behavior.
var details = document.getElementById("details");
var summary = document.getElementById("summary");
document.body.addEventListener("click", function () {
// Change summary to display: none in capturing phase.
summary.style.display = "none";
}, true);
summary.dispatchEvent(new MouseEvent("click"));
document.documentElement.removeAttribute("class");
}
</script>
<body onload="runTest();">
<details id="details">
<summary id="summary">Summary</summary>
<p>This is the details.</p>
</details>
</body>
</html>

Просмотреть файл

@ -0,0 +1,16 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html>
<body>
<details open>
<summary>Summary 2</summary>
<summary>Summary 1</summary>
<p>This is the details 1.</p>
</details>
<details>
<p>This is the details 2.</p>
</details>
</body>
</html>

Просмотреть файл

@ -0,0 +1,35 @@
<!DOCTYPE html>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<html class="reftest-wait">
<script>
function runTest() {
// Both Chrome and Safari do not add the 'open' attribute to details1
// element, but Firefox does add 'open' to details1 since summary2 had been
// moved to details1 before receiving the 'click' event.
var details1 = document.getElementById("details1");
var summary2 = document.getElementById("summary2");
document.body.addEventListener("click", function () {
// Move summary2 into details1 at capture phase, and summary2 will be the
// main summary of details1 at target phase.
details1.insertBefore(summary2, details1.children[0]);
}, true);
summary2.dispatchEvent(new MouseEvent("click"));
document.documentElement.removeAttribute("class");
}
</script>
<body onload="runTest();">
<details id="details1">
<summary id="summary1">Summary 1</summary>
<p>This is the details 1.</p>
</details>
<details>
<summary id="summary2">Summary 2</summary>
<p>This is the details 2.</p>
</details>
</body>
</html>

Просмотреть файл

@ -66,6 +66,9 @@ pref(dom.details_element.enabled,true) == mouse-click-twice-overflow-hidden-deta
pref(dom.details_element.enabled,true) == mouse-click-overflow-auto-details.html overflow-auto-open-details.html pref(dom.details_element.enabled,true) == mouse-click-overflow-auto-details.html overflow-auto-open-details.html
pref(dom.details_element.enabled,true) == mouse-click-twice-overflow-auto-details.html overflow-auto-details.html pref(dom.details_element.enabled,true) == mouse-click-twice-overflow-auto-details.html overflow-auto-details.html
pref(dom.details_element.enabled,true) == mouse-click-display-none-details.html open-single-summary.html pref(dom.details_element.enabled,true) == mouse-click-display-none-details.html open-single-summary.html
pref(dom.details_element.enabled,true) == mouse-click-change-details-to-display-none.html open-single-summary.html
pref(dom.details_element.enabled,true) == mouse-click-change-summary-to-display-none.html mouse-click-change-summary-to-display-none-ref.html
pref(dom.details_element.enabled,true) == mouse-click-move-summary-to-different-details.html mouse-click-move-summary-to-different-details-ref.html
# Dispatch mouse click to out-of-flow details or summary # Dispatch mouse click to out-of-flow details or summary
pref(dom.details_element.enabled,true) == mouse-click-fixed-summary.html open-fixed-summary.html pref(dom.details_element.enabled,true) == mouse-click-fixed-summary.html open-fixed-summary.html