(el, dir, w, h, gutterOrGutters, sizes)
| 58 | ////////////////////////////////////////// |
| 59 | |
| 60 | export function checkSplitDirAndSizes(el, dir, w, h, gutterOrGutters, sizes) { |
| 61 | const gutters = Array.isArray(gutterOrGutters) ? gutterOrGutters : new Array(sizes.length - 1).fill(gutterOrGutters) |
| 62 | |
| 63 | cy.log(`-- NEW SPLIT CHECK (${dir},${w},${h},[${gutters.join(',')}],[${sizes.join(',')}])`) |
| 64 | |
| 65 | const propGridDir = dir === 'vertical' ? 'grid-template-rows' : 'grid-template-columns' |
| 66 | cy.get(el).should('have.css', propGridDir).should('include', ' ') |
| 67 | |
| 68 | const propSize = dir === 'horizontal' ? 'width' : 'height' |
| 69 | const propSize2 = propSize === 'width' ? 'height' : 'width' |
| 70 | const propValue2 = propSize === 'width' ? h : w |
| 71 | |
| 72 | const round = (value) => Math.round(value * 10) / 10 |
| 73 | |
| 74 | cy.get(`${el} > .as-split-gutter`).should('have.length', sizes.length - 1) |
| 75 | |
| 76 | cy.get(`${el} > .as-split-gutter`).each(($el, index) => { |
| 77 | const rect = $el[0].getBoundingClientRect() |
| 78 | |
| 79 | expect(rect[propSize]).to.be.eq(gutters[index]) |
| 80 | expect(round(rect[propSize2])).to.be.eq(round(propValue2)) |
| 81 | }) |
| 82 | |
| 83 | cy.get(`${el} > .as-split-area`) |
| 84 | .should('have.length', sizes.length) |
| 85 | .each(($li, index) => { |
| 86 | const rect = $li[0].getBoundingClientRect() |
| 87 | |
| 88 | expect(round(rect[propSize])).to.be.eq(round(sizes[index])) |
| 89 | expect(round(rect[propSize2])).to.be.eq(round(propValue2)) |
| 90 | }) |
| 91 | } |
no test coverage detected
searching dependent graphs…