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

Create a test object in wheel event tests #21118

Merged
merged 1 commit into from Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 10 additions & 7 deletions uievents/order-of-events/mouse-events/wheel-basic-manual.html
Expand Up @@ -37,6 +37,7 @@
<script>
var wheelbox = document.getElementById("wheelbox");
var scrollbox = document.getElementById("scrollbox");
var test_wheel = async_test("wheel event test");

EventRecorder.configure({
mergeEventTypes: ['wheel'],
Expand All @@ -55,18 +56,20 @@
e.stopPropagation();
this.className = "green";
endTest();
done();
test_wheel.done();
});

function endTest() {
EventRecorder.stop();
var results = EventRecorder.getRecords();
// Check results:
assert_equals(results.length, 2, "Two mousemove events");
assert_equals(results[0].event.type, 'wheel', "First event is a wheel event");
assert_equals(results[1].event.type, 'wheel', "Second event is a wheel event");
assert_equals(results[0].event.target, 'div#wheelbox', "First event targetted wheelbox");
assert_equals(results[1].event.target, 'div#scrollbox', "Second event targetted scrollbox");
test_wheel.step(function () {
// Check results:
assert_equals(results.length, 2, "Two mousemove events");
assert_equals(results[0].event.type, 'wheel', "First event is a wheel event");
assert_equals(results[1].event.type, 'wheel', "Second event is a wheel event");
assert_equals(results[0].event.target, 'div#wheelbox', "First event targetted wheelbox");
assert_equals(results[1].event.target, 'div#scrollbox', "Second event targetted scrollbox");
});
}

EventRecorder.start();
Expand Down
Expand Up @@ -34,6 +34,7 @@

<script>
var wheelbox = document.getElementById("wheelbox");
var test_wheel_scrolling = async_test("wheel scrolling test");

EventRecorder.configure({
mergeEventTypes: ['wheel'],
Expand All @@ -46,16 +47,18 @@
e.stopPropagation();
this.className = "green";
endTest();
done();
test_wheel_scrolling.done();
});

function endTest() {
EventRecorder.stop();
var results = EventRecorder.getRecords();
// Check results:
assert_equals(results.length, 1, "One mousemove event");
assert_equals(results[0].event.type, 'wheel', "First event is a wheel event");
assert_equals(results[0].event.target, 'div#wheelbox', "First event targetted wheelbox");
test_wheel_scrolling.step(function () {
// Check results:
assert_equals(results.length, 1, "One mousemove event");
assert_equals(results[0].event.type, 'wheel', "First event is a wheel event");
assert_equals(results[0].event.target, 'div#wheelbox', "First event targetted wheelbox");
});
}

EventRecorder.start();
Expand Down