chore: Add onabort tests (#57431)

Summary:
Add test for `onabort` prop

## Changelog:

[INTERNAL] [ADDED] - Add `AbortSignal::onabort` test

Pull Request resolved: https://github.com/react/react-native/pull/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
This commit is contained in:
D N authored and meta-codesync[bot] committed 2026-07-06 12:02:10 -07:00
1 parent ef37f40e8d
commit 2415736fee
1 file changed
+16
@@ -86,6 +86,22 @@ describe('AbortController', () => {
);
});
describe("'onabort' prop", () => {
it('should call event lisnters in correct order', () => {
const listener = jest.fn();
const c = new AbortController();
c.signal.addEventListener('abort', () => listener(1));
c.signal.onabort = () => listener(2);
c.signal.addEventListener('abort', () => listener(3));
c.abort();
expect(listener).toHaveBeenNthCalledWith(1, 1);
expect(listener).toHaveBeenNthCalledWith(2, 2);
expect(listener).toHaveBeenNthCalledWith(3, 3);
});
});
describe("'signal' property", () => {
let signal: AbortSignal;