-
Notifications
You must be signed in to change notification settings - Fork 941
dev: update dependencies and pipeline node versions #1667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,8 @@ | |
| "plugins": [ | ||
| "cypress" | ||
| ], | ||
| "env": { | ||
| "cypress/globals": true | ||
| "globals": { | ||
| "cy": true, | ||
| "Cypress": true | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |||||||||
| // but we still want to have tested. | ||||||||||
|
|
||||||||||
| import * as React from 'react' | ||||||||||
| import * as ReactDOM from 'react-dom' | ||||||||||
| import * as ReactDOM from 'react-dom/client' | ||||||||||
| import {act, render} from '@testing-library/react' | ||||||||||
| import Downshift from '../' | ||||||||||
|
|
||||||||||
|
|
@@ -68,21 +68,38 @@ test('toggleMenu can take no arguments at all', () => { | |||||||||
| ) | ||||||||||
| }) | ||||||||||
|
|
||||||||||
| test('clearItems clears the all items', () => { | ||||||||||
| test('clearItems clears all items', () => { | ||||||||||
| const item = 'Chess' | ||||||||||
|
|
||||||||||
| const children = ({getItemProps}) => ( | ||||||||||
| <div> | ||||||||||
| <div key={item} {...getItemProps({item})}> | ||||||||||
| {item} | ||||||||||
| </div> | ||||||||||
| </div> | ||||||||||
| ) | ||||||||||
| // IMPLEMENTATION DETAIL TEST :-( | ||||||||||
| // eslint-disable-next-line react/no-render-return-value | ||||||||||
| const downshiftInstance = ReactDOM.render( | ||||||||||
| <Downshift>{children}</Downshift>, | ||||||||||
| document.createElement('div'), | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| // Wrap Downshift to expose its instance methods through a ref | ||||||||||
| const DownshiftWrapper = React.forwardRef((_props, ref) => { | ||||||||||
| const innerRef = React.useRef(null) | ||||||||||
|
|
||||||||||
| React.useImperativeHandle(ref, () => innerRef.current) | ||||||||||
|
|
||||||||||
| return <Downshift ref={innerRef}>{children}</Downshift> | ||||||||||
| }) | ||||||||||
|
|
||||||||||
| const container = document.createElement('div') | ||||||||||
| const root = ReactDOM.createRoot(container) | ||||||||||
|
|
||||||||||
| const dsRef = React.createRef() | ||||||||||
|
|
||||||||||
| // eslint-disable-next-line testing-library/no-unnecessary-act | ||||||||||
| act(() => { | ||||||||||
| root.render(<DownshiftWrapper ref={dsRef} />) | ||||||||||
| }) | ||||||||||
|
Comment on lines
+91
to
+99
|
||||||||||
|
|
||||||||||
| const downshiftInstance = dsRef.current | ||||||||||
|
|
||||||||||
| expect(downshiftInstance.items).toEqual([item]) | ||||||||||
| downshiftInstance.clearItems() | ||||||||||
|
||||||||||
| downshiftInstance.clearItems() | |
| act(() => { | |
| downshiftInstance.clearItems() | |
| }) |
Uh oh!
There was an error while loading. Please reload this page.