Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=252373 #41549

Merged
merged 1 commit into from
Aug 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
<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"),
var t1 = async_test("Adding open to 'details' should fire a toggle event at the 'details' element, with 'oldState: closed' and 'newState: open'"),
t2 = async_test("Removing open from 'details' should fire a toggle event at the 'details' element, with 'oldState: open' and 'newState: closed'"),
t3 = async_test("Adding open to 'details' (display:none) should fire a toggle event at the 'details' element, with 'oldState: closed' and 'newState: open'"),
t4 = async_test("Adding open to 'details' (no children) should fire a toggle event at the 'details' element, with 'oldState: closed' and 'newState: open'"),
t6 = async_test("Calling open twice on 'details' fires only one toggle event, with 'oldState: closed' and 'newState: open'"),
t7 = async_test("Calling setAttribute('open', '') from 'details' should fire a toggle event at the 'details' element, with 'oldState: closed' and 'newState: open'"),
t8 = async_test("Calling removeAttribute('open') from 'details' should fire a toggle event at the 'details' element, with 'oldState: open' and 'newState: closed'"),
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"),

Expand All @@ -71,10 +71,12 @@
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");
assert_equals(Object.getPrototypeOf(evt), ToggleEvent.prototype, "Prototype of toggle event is ToggleEvent.prototype");
}

details1.ontoggle = t1.step_func_done(function(evt) {
assert_equals(evt.oldState, "closed");
assert_equals(evt.newState, "open");+
assert_true(details1.open);
testEvent(evt)
});
Expand All @@ -87,12 +89,16 @@
details2.open = false; // closes details2

details3.ontoggle = t3.step_func_done(function(evt) {
assert_equals(evt.oldState, "closed");
assert_equals(evt.newState, "open");+
assert_true(details3.open);
testEvent(evt);
});
details3.open = true; // opens details3

details4.ontoggle = t4.step_func_done(function(evt) {
assert_equals(evt.oldState, "closed");
assert_equals(evt.newState, "open");
assert_true(details4.open);
testEvent(evt);
});
Expand All @@ -105,11 +111,11 @@
testEvent(evt);
})
details5.open = true;
}, "Adding open to 'details' (not in the document) should fire a toggle event at the 'details' element");
}, "Adding open to 'details' (not in the document) should fire a toggle event at the 'details' element, with 'oldState: closed' and 'newState: open'");

details6.open = true;
details6.open = false;
details6.ontoggle = t6.step_func(function() {
details6.ontoggle = t6.step_func(function(evt) {
if (loop) {
assert_unreached("toggle event fired twice");
} else {
Expand All @@ -122,6 +128,8 @@
}, 0);

details7.ontoggle = t7.step_func_done(function(evt) {
assert_equals(evt.oldState, "closed");
assert_equals(evt.newState, "open");
assert_true(details7.open);
testEvent(evt)
});
Expand Down