| @@ -5,6 +5,36 @@ import { compileSharedScreenBundle } from '../../src/native/compiler/bundle' |
| 5 | 5 | import { compileNativeScreen, mountNativeScreen } from '../../src/native/testing' |
| 6 | 6 | import { createTempDir } from '../../src/temp-dir' |
| 7 | 7 | |
| 8 | +it.each([false, true])('keeps authored native popup presentation and dismisses only the requested layer (minify=%s)', async (minify) => { |
| 9 | + const { code } = await compileNativeScreen(`<script client> |
| 10 | +const shown = state(true) |
| 11 | +const closeReason = state('') |
| 12 | +window.popupProbe = { shown, closeReason } |
| 13 | +</script> |
| 14 | +<Modal testID="authored-parent" :visible="true" animationType="none"> |
| 15 | + <Modal testID="authored-popup" :visible="shown" nonModal dismissOnOutsideTap animationType="none" |
| 16 | + @request-close="closeReason.set($event.reason);shown.set(false)"> |
| 17 | + <Text>Choose a layer</Text> |
| 18 | + </Modal> |
| 19 | +</Modal>`, { minify }) |
| 20 | + const phone = mountNativeScreen(code) |
| 21 | + try { |
| 22 | + await phone.settle() |
| 23 | + const popup = phone.byTestID('authored-popup')! |
| 24 | + expect(popup.type).toBe('Modal') |
| 25 | + expect(popup.props).toMatchObject({ visible: true, nonModal: true, dismissOnOutsideTap: true }) |
| 26 | + expect(popup.props.nonmodal).toBeUndefined() |
| 27 | + expect(popup.props.dismissonoutsidetap).toBeUndefined() |
| 28 | + phone.press(popup, 'onRequestClose', { reason: 'backdrop' }) |
| 29 | + await phone.settle() |
| 30 | + expect(phone.context.popupProbe.closeReason()).toBe('backdrop') |
| 31 | + expect(phone.byTestID('authored-popup')!.props.visible).toBe(false) |
| 32 | + expect(phone.byTestID('authored-parent')!.props.visible).toBe(true) |
| 33 | + expect(phone.mutationErrors).toEqual([]) |
| 34 | + } |
| 35 | + finally { phone.unmount() } |
| 36 | +}, 30_000) |
| 37 | + |
| 8 | 38 | it.each([false, true])('presents capability-gated non-modal layers without stealing focus (minify=%s)', async (minify) => { |
| 9 | 39 | const { code } = await compileNativeScreen(`<script client> |
| 10 | 40 | const outer = useRef('outer') |