test: update WPT abort tests

PR-URL: https://github.com/nodejs/node/pull/39697
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Michaël Zasso
2021-08-07 20:38:00 +02:00
committed by Node.js GitHub Bot
parent 24673ace8a
commit 45420013ee
4 changed files with 14 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ Last update:
- common: https://github.com/web-platform-tests/wpt/tree/03c5072aff/common
- console: https://github.com/web-platform-tests/wpt/tree/3b1f72e99a/console
- dom/abort: https://github.com/web-platform-tests/wpt/tree/1728d198c9/dom/abort
- dom/abort: https://github.com/web-platform-tests/wpt/tree/c49cafb491/dom/abort
- encoding: https://github.com/web-platform-tests/wpt/tree/35f70910d3/encoding
- FileAPI: https://github.com/web-platform-tests/wpt/tree/3b279420d4/FileAPI
- hr-time: https://github.com/web-platform-tests/wpt/tree/9910784394/hr-time

View File

@@ -0,0 +1,12 @@
test(t => {
const signal = AbortSignal.abort();
assert_true(signal instanceof AbortSignal, "returned object is an AbortSignal");
assert_true(signal.aborted, "returned signal is already aborted");
}, "the AbortSignal.abort() static returns an already aborted signal");
async_test(t => {
const s = AbortSignal.abort();
s.addEventListener("abort", t.unreached_func("abort event listener called"));
s.onabort = t.unreached_func("abort event handler called");
t.step_timeout(() => { t.done(); }, 2000);
}, "signal returned by AbortSignal.abort() should not fire abort event");

View File

@@ -64,9 +64,4 @@ test(t => {
controller.abort();
}, "the abort event should have the right properties");
test(t => {
const signal = AbortSignal.abort();
assert_true(signal.aborted);
}, "the AbortSignal.abort() static returns an already aborted signal");
done();

View File

@@ -8,7 +8,7 @@
"path": "console"
},
"dom/abort": {
"commit": "1728d198c92834d92f7f399ef35e7823d5bfa0e4",
"commit": "c49cafb491d99d6318f8f24a26936cc66501f412",
"path": "dom/abort"
},
"encoding": {