summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Tests/DOM/AbortController.js
blob: 44c77443a624753092302ad35f64e27672ca9c6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
describe("AbortController", () => {
    loadLocalPage("/res/html/misc/blank.html");

    afterInitialPageLoad(page => {
        test("Basic functionality", () => {
            const abortController = new page.AbortController();
            let timesCallbackCalled = 0;
            abortController.signal.addEventListener("abort", () => {
                timesCallbackCalled++;
            });

            abortController.abort();
            expect(abortController.signal.aborted).toBeTrue();

            abortController.abort();
            expect(timesCallbackCalled).toBe(1);
        });
    });
    waitForPageToLoad();
});