Skip to content

Commit 63c1034

Browse files
committed
Start updating integration tests
1 parent 7d8980a commit 63c1034

File tree

1 file changed

+38
-23
lines changed

1 file changed

+38
-23
lines changed
Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,45 @@
1-
describe('useIsInViewport', () => {
2-
beforeEach(() => {
3-
cy.visit('/')
4-
cy.scrollTo(0, 0)
5-
})
1+
before(() => {
2+
cy.visit('/')
3+
})
64

7-
it('should work for element with a custom viewport', () => {
8-
cy.get('[data-testid="div-viewport-parent-el"]').should(
9-
'contain',
10-
'Not intersecting with parent'
11-
)
12-
cy.get('[data-testid="toggle-container-size"]').click()
13-
cy.get('[data-testid="div-viewport-parent-el"]').should('contain', 'Intersecting with parent')
14-
cy.get('[data-testid="toggle-container-size"]').click()
15-
cy.get('[data-testid="div-viewport-parent-el"]').should(
5+
describe('useIsInViewport', () => {
6+
it('should report correctly when an element is visible in parent document', () => {
7+
cy.get('[data-testid="toggle-simple-parent-doc-test"]').should(
168
'contain',
17-
'Not intersecting with parent'
9+
'Hide simple parent doc test'
1810
)
11+
cy.get('[data-testid="box"]').should('contain', 'In viewport')
12+
cy.get('[data-testid="toggle-box-position"]').click()
13+
cy.get('[data-testid="box"]').should('contain', 'Out of viewport')
14+
cy.scrollTo(0, 430)
15+
cy.get('[data-testid="box"]').should('contain', 'In viewport')
16+
cy.scrollTo(0, 600)
17+
cy.get('[data-testid="box"]').should('contain', 'In viewport')
1918
})
2019

21-
it('should work for elements that intersect with their parent document', () => {
22-
cy.get('[data-testid="div-viewport-window"]')
23-
.should('contain', 'Hidden')
24-
.scrollIntoView()
25-
.should('contain', 'Visible')
20+
// it('should report correctly when ')
2621

27-
cy.scrollTo(0, 0)
28-
cy.get('[data-testid="div-viewport-window"]').should('contain', 'Hidden')
29-
})
22+
// it('should work for element with a custom viewport', () => {
23+
// cy.get('[data-testid="div-viewport-parent-el"]').should(
24+
// 'contain',
25+
// 'Not intersecting with parent'
26+
// )
27+
// cy.get('[data-testid="toggle-container-size"]').click()
28+
// cy.get('[data-testid="div-viewport-parent-el"]').should('contain', 'Intersecting with parent')
29+
// cy.get('[data-testid="toggle-container-size"]').click()
30+
// cy.get('[data-testid="div-viewport-parent-el"]').should(
31+
// 'contain',
32+
// 'Not intersecting with parent'
33+
// )
34+
// })
35+
36+
// it('should work for elements that intersect with their parent document', () => {
37+
// cy.get('[data-testid="div-viewport-window"]')
38+
// .should('contain', 'Hidden')
39+
// .scrollIntoView()
40+
// .should('contain', 'Visible')
41+
42+
// cy.scrollTo(0, 0)
43+
// cy.get('[data-testid="div-viewport-window"]').should('contain', 'Hidden')
44+
// })
3045
})

0 commit comments

Comments
 (0)