()
| 400 | }); |
| 401 | |
| 402 | const Toggle = () => { |
| 403 | const [ext, setExt] = useState(false); |
| 404 | |
| 405 | const doAction = React.useCallback(() => { |
| 406 | expect(ext).toBeTruthy(); |
| 407 | resolve(); |
| 408 | }, [ext]); |
| 409 | |
| 410 | const [, send] = useActor( |
| 411 | toggleMachine.provide({ |
| 412 | actions: { |
| 413 | doAction |
| 414 | } |
| 415 | }) |
| 416 | ); |
| 417 | |
| 418 | return ( |
| 419 | <> |
| 420 | <button |
| 421 | data-testid="extbutton" |
| 422 | onClick={(_) => { |
| 423 | setExt(true); |
| 424 | }} |
| 425 | /> |
| 426 | <button |
| 427 | data-testid="button" |
| 428 | onClick={(_) => { |
| 429 | send({ type: 'TOGGLE' }); |
| 430 | }} |
| 431 | /> |
| 432 | </> |
| 433 | ); |
| 434 | }; |
| 435 | |
| 436 | render(<Toggle />); |
| 437 |