Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ruggi committed Dec 13, 2024
1 parent 0f413af commit 7a4717a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ export var storyboard = (
data-testid='blue'
data-label='blue'
/>
</Grid>
</div>
</Scene>
</Storyboard>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,25 @@ import { Storyboard } from 'utopia-api'
export var storyboard = (
<Storyboard data-uid='sb' data-testid='sb'>
<Grid
style={{
backgroundColor: '#aaaaaa33',
position: 'absolute',
left: 100,
top: 100,
width: 300,
height: 300,
padding: 10,
}}
data-uid='grid'
data-testid='grid'
${insideGrid == null ? '/>' : `>${insideGrid}</Grid>`}
${extraCode ?? ''}
</Storyboard>
)
export function Grid(props) {
return (
<div
style={{
display: 'grid',
Expand All @@ -955,13 +974,12 @@ export var storyboard = (
gridGap: 10,
...props.style,
}}
data-uid='grid'
data-testid='grid'
data-uid='59069a6cd70fcd33ce17f5ff0be43a07'
>
${insideGrid == null ? '/>' : `>${insideGrid}</Grid>`}
${extraCode ?? ''}
</Storyboard>
)
{props.children}
</div>
)
}
`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,8 @@ export async function runGridMoveTest(
},
midDragCallback?: (editor: EditorRenderResult) => void,
) {
await selectComponentsForTest(editor, [EP.fromString(props.gridPath)])
const elementPathToDrag = EP.appendToPath(EP.fromString(props.gridPath), props.testId)

await selectComponentsForTest(editor, [elementPathToDrag])

if (props.scale !== 1) {
await editor.dispatch([CanvasActions.zoom(props.scale)], true)
}

// trigger the grid controls so we know where to find the cells
const { sourceGridCell, dragFrom, dragTo } = await getSafeGridMoveTestEndpoints(
editor,
Expand All @@ -46,6 +40,12 @@ export async function runGridMoveTest(
},
)

await selectComponentsForTest(editor, [elementPathToDrag])

if (props.scale !== 1) {
await editor.dispatch([CanvasActions.zoom(props.scale)], true)
}

await mouseDownAtPoint(sourceGridCell, dragFrom)
await mouseMoveToPoint(sourceGridCell, dragTo)
if (props.tab) {
Expand Down

0 comments on commit 7a4717a

Please sign in to comment.