From 7e9884598fe3475a45de00d4684540615676cb6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 7 Aug 2021 20:38:00 +0200 Subject: [PATCH] test: update WPT abort tests PR-URL: https://github.com/nodejs/node/pull/39697 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- test/fixtures/wpt/README.md | 2 +- test/fixtures/wpt/dom/abort/AbortSignal.any.js | 12 ++++++++++++ test/fixtures/wpt/dom/abort/event.any.js | 5 ----- test/fixtures/wpt/versions.json | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 test/fixtures/wpt/dom/abort/AbortSignal.any.js diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index d958521f581c90..7c795981d793a6 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -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 diff --git a/test/fixtures/wpt/dom/abort/AbortSignal.any.js b/test/fixtures/wpt/dom/abort/AbortSignal.any.js new file mode 100644 index 00000000000000..1d7d7678eb1a6e --- /dev/null +++ b/test/fixtures/wpt/dom/abort/AbortSignal.any.js @@ -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"); diff --git a/test/fixtures/wpt/dom/abort/event.any.js b/test/fixtures/wpt/dom/abort/event.any.js index 2589ba1ce45091..a67e6f400fcf1d 100644 --- a/test/fixtures/wpt/dom/abort/event.any.js +++ b/test/fixtures/wpt/dom/abort/event.any.js @@ -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(); diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index 7984088f395b3a..2eda2919ea9908 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -8,7 +8,7 @@ "path": "console" }, "dom/abort": { - "commit": "1728d198c92834d92f7f399ef35e7823d5bfa0e4", + "commit": "c49cafb491d99d6318f8f24a26936cc66501f412", "path": "dom/abort" }, "encoding": {