also looking at this
fix(native): preserve explicit grid row tracks
#2092
5 files
+42
-4
| @@ -2,6 +2,27 @@ import { describe, expect, it } from 'bun:test' | ||
| 2 | 2 | import { compileNativeScreen, mountNativeScreen } from '../../src/native/testing' |
| 3 | 3 | |
| 4 | 4 | describe.each([false, true])('reactive native inline styles (minify=%s)', (minify) => { |
| 5 | it('delivers explicit grid rows through the compiled native bundle and clears changed tracks', async () => { | |
| 6 | const { code } = await compileNativeScreen(`<script client> | |
| 7 | const tracks = state({ gridTemplateRows: 'repeat(2, 1fr)' }) | |
| 8 | </script><View testID="grid" style="display:grid;height:84px" :style="tracks"> | |
| 9 | <View testID="static-grid" style={{"display":"grid","gridTemplateRows":"repeat(2, 1fr)","height":84}} /> | |
| 10 | <Button testID="change" @click="tracks.set({gridTemplateRows:3})">Change rows</Button> | |
| 11 | <Button testID="clear" @click="tracks.set({})">Clear rows</Button> | |
| 12 | </View>`, { minify }) | |
| 13 | const phone = mountNativeScreen(code, 'Screen') | |
| 14 | await phone.settle() | |
| 15 | expect(phone.byTestID('static-grid')!.style).toMatchObject({ display: 'grid', height: 84, gridTemplateRows: 'repeat(2, 1fr)' }) | |
| 16 | expect(phone.byTestID('grid')!.style).toMatchObject({ display: 'grid', height: 84, gridTemplateRows: 'repeat(2, 1fr)' }) | |
| 17 | phone.press(phone.byTestID('change')!) | |
| 18 | await phone.settle() | |
| 19 | expect(phone.byTestID('grid')!.style.gridTemplateRows).toBe(3) | |
| 20 | phone.press(phone.byTestID('clear')!) | |
| 21 | await phone.settle() | |
| 22 | expect(phone.byTestID('grid')!.style.gridTemplateRows).toBeNull() | |
| 23 | phone.unmount() | |
| 24 | }, 30_000) | |
| 25 | ||
| 5 | 26 | it('normalizes CSS and objects, clears previous values, and protects hidden nodes', async () => { |
| 6 | 27 | const { code } = await compileNativeScreen(`<script client> |
| 7 | 28 | const styles = state('padding-left:12px;font-size:1.5rem;width:50%;font-weight:700') |