Skip to content

Commit

Permalink
feat(tests): add zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Oct 4, 2019
1 parent 1d3403e commit cd558f2
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions cypress/integration/flow/basic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,31 @@ describe('Basic Flow Rendering', () => {

const newPosition = {
clientX: Cypress.config('viewportWidth') * 0.6,
clientY: Cypress.config('viewportHeight') * 0.6
clientY: Cypress.config('viewportHeight') * 0.7
};

const styleBeforeDrag = Cypress.$('.react-graph__nodes').css('transform');

cy.window().then((win) => {
cy.get('.react-graph__zoompane')
.trigger('mousedown', { which: 1, view: win })
.trigger('mousemove', newPosition)
.trigger('mouseup', { force: true, view: win });
.trigger('mouseup', { force: true, view: win })
.then(() => {
const styleAfterDrag = Cypress.$('.react-graph__nodes').css('transform');
expect(styleBeforeDrag).to.not.equal(styleAfterDrag);
});
});
});

it('zooms the pane', () => {
const styleBeforeZoom = Cypress.$('.react-graph__nodes').css('transform');

cy.get('.react-graph__zoompane')
.trigger('wheel','topLeft', { deltaY: -200 })
.then(() => {
const styleAfterZoom = Cypress.$('.react-graph__nodes').css('transform');
expect(styleBeforeZoom).to.not.equal(styleAfterZoom);
});
});
});

0 comments on commit cd558f2

Please sign in to comment.