From ecbe7d69bf6ae4757a5731daa15c170d956ea2da Mon Sep 17 00:00:00 2001 From: Mudit Ameta Date: Thu, 28 Nov 2019 04:06:28 +0100 Subject: [PATCH] Update button text and initial paint in example app --- cypress/integration/useIntersectionObserver.test.js | 5 +++++ examples/cra/src/index.js | 2 +- examples/cra/src/viewportAnotherElement.js | 4 ++-- examples/cra/src/viewportParentDocument.js | 4 ++-- package.json | 4 ++++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cypress/integration/useIntersectionObserver.test.js b/cypress/integration/useIntersectionObserver.test.js index b708d9e..7e74d53 100644 --- a/cypress/integration/useIntersectionObserver.test.js +++ b/cypress/integration/useIntersectionObserver.test.js @@ -4,6 +4,11 @@ before(() => { describe('useIsInViewport', () => { it('should report correctly when an element is visible in parent document', () => { + cy.get('[data-testid="toggle-simple-parent-doc-test"]').should( + 'contain', + 'Show simple parent doc test' + ) + cy.get('[data-testid="toggle-simple-parent-doc-test"]').click() cy.get('[data-testid="toggle-simple-parent-doc-test"]').should( 'contain', 'Hide simple parent doc test' diff --git a/examples/cra/src/index.js b/examples/cra/src/index.js index d93fab2..264f4ce 100755 --- a/examples/cra/src/index.js +++ b/examples/cra/src/index.js @@ -11,7 +11,7 @@ import { } from './viewportAnotherElement' function App() { - const [testToShow, setTestToShow] = React.useState(1) + const [testToShow, setTestToShow] = React.useState(0) const forwardedTargetRef = node => { window.forwardedTargetRef = window.forwardedTargetRef || [] window.forwardedTargetRef.push(node) diff --git a/examples/cra/src/viewportAnotherElement.js b/examples/cra/src/viewportAnotherElement.js index d9072f5..846aa84 100644 --- a/examples/cra/src/viewportAnotherElement.js +++ b/examples/cra/src/viewportAnotherElement.js @@ -23,7 +23,7 @@ export function SimpleElement() { onClick={() => toggleHide(h => !h)} data-testid="toggle-box-position" > - {hidden ? 'Show box' : 'Hide box'} + {hidden ? 'Show box (or scroll to show it)' : 'Hide box'}
toggleHide(h => !h)} data-testid="toggle-boxes-positions" > - {hidden ? 'Show boxes' : 'Hide boxes'} + {hidden ? "Show boxes (or scroll to show 'em)" : 'Hide boxes'}
toggleHide(h => !h)} data-testid="toggle-box-position" > - {hidden ? 'Show box' : 'Hide box'} + {hidden ? 'Show box (or scroll to show it)' : 'Hide box'}
toggleHide(h => !h)} data-testid="toggle-box-position" > - {hidden ? 'Show box' : 'Hide box'} + {hidden ? 'Show box (or scroll to show it)' : 'Hide box'}