tests: properly check element transforms

This commit is contained in:
braks
2022-10-13 23:23:43 +02:00
committed by Braks
parent 5aa94e2e13
commit e0016db07a
3 changed files with 25 additions and 10 deletions
+13 -2
View File
@@ -1,8 +1,11 @@
import { useVueFlow } from '@vue-flow/core'
import { getElements } from '../../utils'
const { nodes } = getElements(1, 1)
describe('Check if nodes are draggable', () => {
const store = useVueFlow({ id: 'test' })
beforeEach(() => {
cy.vueFlow({
modelValue: [nodes[0]],
@@ -10,7 +13,7 @@ describe('Check if nodes are draggable', () => {
})
it('drags nodes', () => {
cy.window().then((win) => {
cy.window().then(async (win) => {
cy.get(`[data-id="${nodes[0].id}"]`)
.trigger('mousedown', {
which: 1,
@@ -27,7 +30,15 @@ describe('Check if nodes are draggable', () => {
view: win,
})
cy.get(`[data-id="${nodes[0].id}"]`).should('not.have.css', 'transform', 'matrix(1, 0, 0, 1, 0, 0)')
await cy.tryAssertion(() => {
cy.get(`[data-id="${nodes[0].id}"]`)
.should('be.visible')
.should(
'have.css',
'transform',
`matrix(1, 0, 0, 1, ${store.nodes.value[0].computedPosition.x}, ${store.nodes.value[0].computedPosition.x})`,
)
})
})
})
})