Skip to content

Commit 1583391

Browse files
committed
Fix position
1 parent c4e19db commit 1583391

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/codegen/props/__tests__/position.test.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
import { describe, expect, it } from 'vitest'
1+
import { describe, expect, it, vi } from 'vitest'
22
import { canBeAbsolute, getPositionProps } from '../position'
33

4+
vi.mock('../../utils/check-asset-node', () => ({
5+
checkAssetNode: () => null,
6+
}))
7+
8+
vi.mock('../../utils/is-page-root', () => ({
9+
isPageRoot: () => false,
10+
}))
11+
412
describe('position', () => {
513
describe('canBeAbsolute', () => {
614
it('should return true for ABSOLUTE positioned node', () => {
@@ -183,12 +191,10 @@ describe('position', () => {
183191

184192
it('should return relative position for parent with absolute children', () => {
185193
const node = {
186-
type: 'COMPONENT_SET',
187-
parent: null,
194+
type: 'FRAME',
188195
children: [
189196
{
190197
layoutPositioning: 'ABSOLUTE',
191-
visible: true,
192198
},
193199
],
194200
} as any
@@ -201,13 +207,11 @@ describe('position', () => {
201207

202208
it('should return relative position for freelayout parent with AUTO children', () => {
203209
const node = {
204-
type: 'COMPONENT_SET',
210+
type: 'FRAME',
205211
layoutPositioning: 'AUTO',
206-
parent: null,
207212
children: [
208213
{
209214
layoutPositioning: 'AUTO',
210-
visible: true,
211215
},
212216
],
213217
} as any

0 commit comments

Comments
 (0)