|
10 | 10 |
|
11 | 11 | import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; |
12 | 12 |
|
13 | | -import Event from 'react-native/src/private/webapis/dom/events/Event'; |
14 | 13 | import { |
15 | 14 | setEventInitTimeStamp, |
16 | 15 | setInPassiveListenerFlag, |
17 | 16 | } from 'react-native/src/private/webapis/dom/events/internals/EventInternals'; |
18 | 17 |
|
| 18 | +type EventOptions = Event$Init & { |
| 19 | + rnIsDirect?: boolean, |
| 20 | +}; |
| 21 | + |
19 | 22 | describe('Event', () => { |
20 | 23 | it('provides read-only constants for event phases', () => { |
21 | 24 | 'use strict'; |
@@ -121,13 +124,12 @@ describe('Event', () => { |
121 | 124 | }).not.toThrow(); |
122 | 125 |
|
123 | 126 | expect(() => { |
124 | | - // $FlowExpectedError[incompatible-exact] |
125 | | - // $FlowExpectedError[prop-missing] |
| 127 | + // $FlowExpectedError[incompatible-type] |
126 | 128 | return new Event('custom', class {}); |
127 | 129 | }).not.toThrow(); |
128 | 130 |
|
129 | 131 | expect(() => { |
130 | | - // $FlowExpectedError[incompatible-exact] |
| 132 | + // $FlowExpectedError[incompatible-type] |
131 | 133 | return new Event('custom', () => {}); |
132 | 134 | }).not.toThrow(); |
133 | 135 | }); |
@@ -238,15 +240,15 @@ describe('Event', () => { |
238 | 240 |
|
239 | 241 | it('should use a custom timestamp when set via setEventInitTimeStamp', () => { |
240 | 242 | const customTimestamp = 12345.678; |
241 | | - const options = {}; |
| 243 | + const options: EventOptions = {}; |
242 | 244 | setEventInitTimeStamp(options, customTimestamp); |
243 | 245 | const event = new Event('custom', options); |
244 | 246 |
|
245 | 247 | expect(event.timeStamp).toBe(customTimestamp); |
246 | 248 | }); |
247 | 249 |
|
248 | 250 | it('should accept zero as a valid custom timestamp', () => { |
249 | | - const options = {}; |
| 251 | + const options: EventOptions = {}; |
250 | 252 | setEventInitTimeStamp(options, 0); |
251 | 253 | const event = new Event('custom', options); |
252 | 254 |
|
@@ -300,6 +302,7 @@ describe('Event', () => { |
300 | 302 |
|
301 | 303 | expect(event.defaultPrevented).toBe(false); |
302 | 304 |
|
| 305 | + // $FlowFixMe[incompatible-type] The global is backed by this implementation. |
303 | 306 | setInPassiveListenerFlag(event, true); |
304 | 307 |
|
305 | 308 | event.preventDefault(); |
|
0 commit comments