|
| 1 | +/// <reference types="Cypress" /> |
| 2 | + |
| 3 | +import { moveGutterByMouse, checkSplitDirAndSizes } from '../support/splitUtils' |
| 4 | + |
| 5 | +context('Toggling DOM and visibility example page tests', () => { |
| 6 | + const W = 1076 |
| 7 | + const H = 150 |
| 8 | + const GUTTER = 15 |
| 9 | + |
| 10 | + beforeEach(() => { |
| 11 | + cy.visit('/examples/toggling-dom-and-visibility') |
| 12 | + }) |
| 13 | + |
| 14 | + it('Display initial state', () => { |
| 15 | + checkSplitDirAndSizes('.split-example > as-split', 'horizontal', W, H, GUTTER, [348.66, 348.66, 348.66]) |
| 16 | + }) |
| 17 | + |
| 18 | + it('Hide first area and move gutter', () => { |
| 19 | + getVisibilityButton(0).click() |
| 20 | + checkSplitDirAndSizes('.split-example > as-split', 'horizontal', W, H, [0, GUTTER], [0, 530.5, 530.5]) |
| 21 | + |
| 22 | + moveGutterByMouse('.as-split-gutter', 1, 50, 0) |
| 23 | + checkSplitDirAndSizes('.split-example > as-split', 'horizontal', W, H, [0, GUTTER], [0, 580.5, 480.5]) |
| 24 | + |
| 25 | + moveGutterByMouse('.as-split-gutter', 1, -100, 0) |
| 26 | + checkSplitDirAndSizes('.split-example > as-split', 'horizontal', W, H, [0, GUTTER], [0, 480.5, 580.5]) |
| 27 | + }) |
| 28 | + |
| 29 | + it('Hide mid area and move gutter', () => { |
| 30 | + getVisibilityButton(1).click() |
| 31 | + checkSplitDirAndSizes('.split-example > as-split', 'horizontal', W, H, [GUTTER, 0], [530.5, 0, 530.5]) |
| 32 | + |
| 33 | + moveGutterByMouse('.as-split-gutter', 0, 50, 0) |
| 34 | + checkSplitDirAndSizes('.split-example > as-split', 'horizontal', W, H, [GUTTER, 0], [580.5, 0, 480.5]) |
| 35 | + |
| 36 | + moveGutterByMouse('.as-split-gutter', 0, -100, 0) |
| 37 | + checkSplitDirAndSizes('.split-example > as-split', 'horizontal', W, H, [GUTTER, 0], [480.5, 0, 580.5]) |
| 38 | + }) |
| 39 | + |
| 40 | + it('Hide last area and move gutter', () => { |
| 41 | + getVisibilityButton(2).click() |
| 42 | + checkSplitDirAndSizes('.split-example > as-split', 'horizontal', W, H, [GUTTER, 0], [530.5, 530.5, 0]) |
| 43 | + |
| 44 | + moveGutterByMouse('.as-split-gutter', 0, 50, 0) |
| 45 | + checkSplitDirAndSizes('.split-example > as-split', 'horizontal', W, H, [GUTTER, 0], [580.5, 480.5, 0]) |
| 46 | + |
| 47 | + moveGutterByMouse('.as-split-gutter', 0, -100, 0) |
| 48 | + checkSplitDirAndSizes('.split-example > as-split', 'horizontal', W, H, [GUTTER, 0], [480.5, 580.5, 0]) |
| 49 | + }) |
| 50 | +}) |
| 51 | + |
| 52 | +function getVisibilityButton(index) { |
| 53 | + return cy.get('.btn-group:first').find('> .btn').eq(index) |
| 54 | +} |
0 commit comments