|
22 | 22 | * SOFTWARE. |
23 | 23 | */ |
24 | 24 | import React from 'react' |
25 | | -import { Pagination, ScreenReaderContent } from '../../packages/ui' |
| 25 | +import { Pagination, ScreenReaderContent } from '@instructure/ui' |
26 | 26 |
|
27 | 27 | import '../support/component' |
28 | 28 | import 'cypress-real-events' |
@@ -68,4 +68,54 @@ describe('<Pagination/>', () => { |
68 | 68 | }) |
69 | 69 | }) |
70 | 70 | }) |
| 71 | + |
| 72 | + it('should wrap at a small viewport width', () => { |
| 73 | + cy.mount( |
| 74 | + <Pagination |
| 75 | + as="nav" |
| 76 | + margin="small" |
| 77 | + variant="compact" |
| 78 | + currentPage={4} |
| 79 | + totalPageNumber={100000} |
| 80 | + siblingCount={3} |
| 81 | + boundaryCount={2} |
| 82 | + /> |
| 83 | + ) |
| 84 | + |
| 85 | + cy.viewport(1000, 800) |
| 86 | + |
| 87 | + cy.get('[role="navigation"]').within(() => { |
| 88 | + cy.get('button').then(($items) => { |
| 89 | + const firstItem = $items[0] |
| 90 | + const firstItemTop = firstItem.getBoundingClientRect().top |
| 91 | + |
| 92 | + let hasWrapped = false |
| 93 | + $items.each((index, item) => { |
| 94 | + const itemTop = item.getBoundingClientRect().top |
| 95 | + if (index > 0 && itemTop > firstItemTop) { |
| 96 | + hasWrapped = true |
| 97 | + } |
| 98 | + }) |
| 99 | + expect(hasWrapped).to.be.false |
| 100 | + }) |
| 101 | + }) |
| 102 | + |
| 103 | + cy.viewport(300, 800) |
| 104 | + |
| 105 | + cy.get('[role="navigation"]').within(() => { |
| 106 | + cy.get('button').then(($items) => { |
| 107 | + const firstItem = $items[0] |
| 108 | + const firstItemTop = firstItem.getBoundingClientRect().top |
| 109 | + |
| 110 | + let hasWrapped = false |
| 111 | + $items.each((index, item) => { |
| 112 | + const itemTop = item.getBoundingClientRect().top |
| 113 | + if (index > 0 && itemTop > firstItemTop) { |
| 114 | + hasWrapped = true |
| 115 | + } |
| 116 | + }) |
| 117 | + expect(hasWrapped).to.be.true |
| 118 | + }) |
| 119 | + }) |
| 120 | + }) |
71 | 121 | }) |
0 commit comments