fix(ui): cannot remove node (#15770)
* fix: remove fragments * chore: update react * fix: componentWillMount errorspull/15775/head
parent
72df235ee3
commit
73d185af00
|
|
@ -153,7 +153,7 @@
|
|||
"papaparse": "^4.6.3",
|
||||
"prop-types": "^15.6.1",
|
||||
"qs": "^6.5.2",
|
||||
"react": "^16.8.2",
|
||||
"react": "^16.11.0",
|
||||
"react-codemirror2": "^4.2.1",
|
||||
"react-copy-to-clipboard": "^5.0.1",
|
||||
"react-datepicker": "^2.1.0",
|
||||
|
|
|
|||
|
|
@ -20,15 +20,15 @@ export interface Props {
|
|||
}
|
||||
|
||||
@ErrorHandling
|
||||
class ListeningResults extends PureComponent<Props> {
|
||||
class ConnectionInformation extends PureComponent<Props> {
|
||||
public render() {
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<h4 className={`wizard-step--text-state ${this.className}`}>
|
||||
{this.header}
|
||||
</h4>
|
||||
<p>{this.additionalText}</p>
|
||||
</>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -70,4 +70,4 @@ class ListeningResults extends PureComponent<Props> {
|
|||
}
|
||||
}
|
||||
|
||||
export default ListeningResults
|
||||
export default ConnectionInformation
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ class GetResources extends PureComponent<Props, StateProps> {
|
|||
loading={remoteDataState}
|
||||
spinnerComponent={<TechnoSpinner />}
|
||||
>
|
||||
<>{children}</>
|
||||
{children}
|
||||
</SpinnerContainer>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
import React from 'react'
|
||||
import {shallow} from 'enzyme'
|
||||
import KeyboardShortcuts from 'src/shared/components/KeyboardShortcuts'
|
||||
|
||||
const map = {
|
||||
keydown: null,
|
||||
}
|
||||
|
||||
const setup = (override?) => {
|
||||
const props = {
|
||||
onControlEnter: () => {},
|
||||
children: <div />,
|
||||
...override,
|
||||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
document.addEventListener = jest.fn((event, cb) => {
|
||||
map[event] = cb
|
||||
})
|
||||
|
||||
const wrapper = shallow(<KeyboardShortcuts {...props} />)
|
||||
|
||||
return {
|
||||
wrapper,
|
||||
}
|
||||
}
|
||||
|
||||
describe('Shared.Comonents.KeyboardShortcuts', () => {
|
||||
describe('rendering', () => {
|
||||
it('renders without errors', () => {
|
||||
const {wrapper} = setup()
|
||||
expect(wrapper.exists()).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('user interraction', () => {
|
||||
describe('control + shift', () => {
|
||||
const onControlEnter = jest.fn()
|
||||
setup({onControlEnter})
|
||||
|
||||
const event = {ctrlKey: true, key: 'Enter', preventDefault: () => {}}
|
||||
map.keydown(event)
|
||||
|
||||
expect(onControlEnter).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
import {PureComponent, ReactNode} from 'react'
|
||||
|
||||
interface Props {
|
||||
children: ReactNode
|
||||
onControlEnter: () => void
|
||||
}
|
||||
|
||||
class KeyboardShortcuts extends PureComponent<Props> {
|
||||
public componentWillMount() {
|
||||
document.addEventListener('keydown', this.handleKeyboardShortcuts)
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
document.removeEventListener('keydown', this.handleKeyboardShortcuts)
|
||||
}
|
||||
|
||||
public render() {
|
||||
return this.props.children
|
||||
}
|
||||
|
||||
private handleKeyboardShortcuts = (e: KeyboardEvent) => {
|
||||
if (e.ctrlKey && e.key === 'Enter') {
|
||||
this.props.onControlEnter()
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default KeyboardShortcuts
|
||||
|
|
@ -45,7 +45,7 @@ class SearchWidget extends Component<Props, State> {
|
|||
}
|
||||
}
|
||||
|
||||
public componentWillMount() {
|
||||
public UNSAFE_componentWillMount() {
|
||||
this.handleSearch = _.debounce(this.handleSearch, 50)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9633,15 +9633,14 @@ react-virtualized@^9.18.5:
|
|||
prop-types "^15.6.0"
|
||||
react-lifecycles-compat "^3.0.4"
|
||||
|
||||
react@^16.8.2:
|
||||
version "16.8.2"
|
||||
resolved "https://registry.yarnpkg.com/react/-/react-16.8.2.tgz#83064596feaa98d9c2857c4deae1848b542c9c0c"
|
||||
integrity sha512-aB2ctx9uQ9vo09HVknqv3DGRpI7OIGJhCx3Bt0QqoRluEjHSaObJl+nG12GDdYH6sTgE7YiPJ6ZUyMx9kICdXw==
|
||||
react@^16.11.0:
|
||||
version "16.11.0"
|
||||
resolved "https://registry.yarnpkg.com/react/-/react-16.11.0.tgz#d294545fe62299ccee83363599bf904e4a07fdbb"
|
||||
integrity sha512-M5Y8yITaLmU0ynd0r1Yvfq98Rmll6q8AxaEe88c8e7LxO8fZ2cNgmFt0aGAS9wzf1Ao32NKXtCl+/tVVtkxq6g==
|
||||
dependencies:
|
||||
loose-envify "^1.1.0"
|
||||
object-assign "^4.1.1"
|
||||
prop-types "^15.6.2"
|
||||
scheduler "^0.13.2"
|
||||
|
||||
read-pkg-up@^4.0.0:
|
||||
version "4.0.0"
|
||||
|
|
|
|||
Loading…
Reference in New Issue