Skip to content

Commit 2415736

Browse files
retyuimeta-codesync[bot]
authored andcommitted
chore: Add onabort tests (#57431)
Summary: Add test for `onabort` prop ## Changelog: [INTERNAL] [ADDED] - Add `AbortSignal::onabort` test Pull Request resolved: #57431 Test Plan: ```bash yarn fantom abort-api/__tests__/AbortController-itest.js --watch ``` Reviewed By: javache Differential Revision: D110787344 Pulled By: Abbondanzo fbshipit-source-id: 1d9b02faa62d7ddb22fb3fccdf5efb6570b924f4
1 parent ef37f40 commit 2415736

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

packages/react-native/src/private/webapis/dom/abort-api/__tests__/AbortController-itest.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,22 @@ describe('AbortController', () => {
8686
);
8787
});
8888

89+
describe("'onabort' prop", () => {
90+
it('should call event lisnters in correct order', () => {
91+
const listener = jest.fn();
92+
const c = new AbortController();
93+
c.signal.addEventListener('abort', () => listener(1));
94+
c.signal.onabort = () => listener(2);
95+
c.signal.addEventListener('abort', () => listener(3));
96+
97+
c.abort();
98+
99+
expect(listener).toHaveBeenNthCalledWith(1, 1);
100+
expect(listener).toHaveBeenNthCalledWith(2, 2);
101+
expect(listener).toHaveBeenNthCalledWith(3, 3);
102+
});
103+
});
104+
89105
describe("'signal' property", () => {
90106
let signal: AbortSignal;
91107

0 commit comments

Comments
 (0)