node/test/fixtures/wpt/dom/events/Event-timestamp-high-resolution.https.html
Daiki Nishikawa 8dce6ad7a5
test: add WPT tests for dom/events
PR-URL: https://github.com/nodejs/node/pull/43151
Refs: https://github.com/nodejs/node/issues/40678
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-06-22 09:28:59 +01:00

16 lines
790 B
HTML

<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript">
'use strict';
for (let eventType of ["GamepadEvent"]) {
test(function() {
let before = performance.now();
let e = new window[eventType]('test');
let after = performance.now();
assert_greater_than_equal(e.timeStamp, before, "Event timestamp should be greater than performance.now() timestamp taken before its creation");
assert_less_than_equal(e.timeStamp, after, "Event timestamp should be less than performance.now() timestamp taken after its creation");
}, `Constructed ${eventType} timestamp should be high resolution and have the same time origin as performance.now()`);
}
</script>