wix-style-react
Version:
wix-style-react
43 lines (41 loc) • 1.44 kB
JavaScript
import React from 'react';
import ReactTestUtils from 'react-dom/test-utils';
import TextField from './TextField';
import Input from '../Input';
import { textFieldTestkitFactory } from '../../testkit';
import { textFieldTestkitFactory as enzymeTextFieldTestkitFactory } from '../../testkit/enzyme';
import { mount } from 'enzyme';
describe('TextField', function () {
describe('testkit', function () {
it('should exist', function () {
var div = document.createElement('div');
var dataHook = 'compHook';
var wrapper = div.appendChild(ReactTestUtils.renderIntoDocument(React.createElement(
'div',
null,
React.createElement(
TextField,
{ dataHook: dataHook },
React.createElement(Input, null)
)
)));
var textFieldTestkit = textFieldTestkitFactory({ wrapper: wrapper, dataHook: dataHook });
expect(textFieldTestkit.exists()).toBeTruthy();
});
describe('enzyme testkit', function () {
it('should exist', function () {
var dataHook = 'myDataHook';
var wrapper = mount(React.createElement(
TextField,
{ dataHook: dataHook },
React.createElement(Input, null)
));
var textFieldTestkit = enzymeTextFieldTestkitFactory({
wrapper: wrapper,
dataHook: dataHook
});
expect(textFieldTestkit.exists()).toBeTruthy();
});
});
});
});