Skip to content

Commit ecbe7d6

Browse files
committedNov 28, 2019
Update button text and initial paint in example app
1 parent e67b471 commit ecbe7d6

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed
 

‎cypress/integration/useIntersectionObserver.test.js

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ before(() => {
44

55
describe('useIsInViewport', () => {
66
it('should report correctly when an element is visible in parent document', () => {
7+
cy.get('[data-testid="toggle-simple-parent-doc-test"]').should(
8+
'contain',
9+
'Show simple parent doc test'
10+
)
11+
cy.get('[data-testid="toggle-simple-parent-doc-test"]').click()
712
cy.get('[data-testid="toggle-simple-parent-doc-test"]').should(
813
'contain',
914
'Hide simple parent doc test'

‎examples/cra/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from './viewportAnotherElement'
1212

1313
function App() {
14-
const [testToShow, setTestToShow] = React.useState(1)
14+
const [testToShow, setTestToShow] = React.useState(0)
1515
const forwardedTargetRef = node => {
1616
window.forwardedTargetRef = window.forwardedTargetRef || []
1717
window.forwardedTargetRef.push(node)

‎examples/cra/src/viewportAnotherElement.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function SimpleElement() {
2323
onClick={() => toggleHide(h => !h)}
2424
data-testid="toggle-box-position"
2525
>
26-
{hidden ? 'Show box' : 'Hide box'}
26+
{hidden ? 'Show box (or scroll to show it)' : 'Hide box'}
2727
</button>
2828
<div ref={viewportRef} data-testid="viewport" className={container}>
2929
<div
@@ -65,7 +65,7 @@ export const RefForwardingElement = React.forwardRef(function RefForwardingEleme
6565
onClick={() => toggleHide(h => !h)}
6666
data-testid="toggle-boxes-positions"
6767
>
68-
{hidden ? 'Show boxes' : 'Hide boxes'}
68+
{hidden ? "Show boxes (or scroll to show 'em)" : 'Hide boxes'}
6969
</button>
7070
<div ref={finalParentRef} data-testid="viewport" className={cx('viewport', container)}>
7171
<div

‎examples/cra/src/viewportParentDocument.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function SimpleElement() {
1414
onClick={() => toggleHide(h => !h)}
1515
data-testid="toggle-box-position"
1616
>
17-
{hidden ? 'Show box' : 'Hide box'}
17+
{hidden ? 'Show box (or scroll to show it)' : 'Hide box'}
1818
</button>
1919
<div
2020
className={cx(box, {
@@ -57,7 +57,7 @@ export const RefForwardingElement = React.forwardRef(function RefForwardingEleme
5757
onClick={() => toggleHide(h => !h)}
5858
data-testid="toggle-box-position"
5959
>
60-
{hidden ? 'Show box' : 'Hide box'}
60+
{hidden ? 'Show box (or scroll to show it)' : 'Hide box'}
6161
</button>
6262
<div
6363
className={cx('target-div', box, {

‎package.json

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
"tslint --fix",
4545
"git add"
4646
],
47+
"cypress/integration/**/*.js": [
48+
"prettier --write",
49+
"git add"
50+
],
4751
"*.{json,md,html,css}": [
4852
"prettier --write",
4953
"git add"

0 commit comments

Comments
 (0)