Repository URL to install this package:
|
Version:
3.5.5 ▾
|
import './_setup'
import * as React from 'react'
import { isObj } from 'exotic'
import { render, cleanup } from 'react-testing-library'
import { InputState } from '../new-forms/inputs/InputState'
import { OneFormState, OneObserverForm } from '..//new-forms/OneForm/OneForm'
import { PluginsContext } from '../new-forms/plugins/PluginsContext'
import { TextBoxPlugin } from '../new-forms/plugins/TextPlugin'
describe('@skava/forms - refs', () => {
afterEach(cleanup)
it.skip('should pass refs for input & form', () => {
const inputRef = React.createRef()
const formRef = React.createRef()
const formState = new OneFormState().setInputsList([
{
ref: inputRef,
identifier: '0',
value: 'testing',
type: 'text',
},
])
const view = (
<PluginsContext.Provider value={[TextBoxPlugin]}>
<OneObserverForm ref={formRef} state={formState} />
</PluginsContext.Provider>
)
const { container } = render(view)
const found = container.querySelector('input')!
// means it has been rendered and passed as ref
expect(isObj(inputRef.current)).toEqual(true)
expect(isObj(formRef.current)).toEqual(true)
})
})