|
| 1 | +import React from 'react'; |
| 2 | +import renderer from 'react-test-renderer'; |
| 3 | +import sinon from 'sinon'; |
| 4 | +import {Machine} from '../src' |
| 5 | +import { |
| 6 | + getByLabelText, |
| 7 | + getByText, |
| 8 | + getByTestId, |
| 9 | + queryByTestId, |
| 10 | + // Tip: all queries are also exposed on an object |
| 11 | + // called "queries" which you could import here as well |
| 12 | + wait, |
| 13 | +} from 'dom-testing-library' |
| 14 | +// import Enzyme, { mount } from 'enzyme'; |
| 15 | +// import Adapter from 'enzyme-adapter-react-16'; |
| 16 | +// Enzyme.configure({ adapter: new Adapter() }); |
| 17 | + |
| 18 | +test('Link changes the class when hovered', () => { |
| 19 | + // const component = renderer.create(<div>"Hello"</div>); |
| 20 | + // let tree = component.toJSON(); |
| 21 | + // expect(tree).toMatchSnapshot(); |
| 22 | + const onButtonClick = sinon.spy(); |
| 23 | + const wrapper = mount(( |
| 24 | + <div onButtonClick={onButtonClick}>"Hello"</div> |
| 25 | + )); |
| 26 | + wrapper.find('div').simulate('click'); |
| 27 | + expect(onButtonClick).to.have.property('callCount', 1); |
| 28 | +}); |
| 29 | + |
| 30 | +// TODO : use Qunit to test in the browser |
| 31 | +// qunit index.html to add id for test location (with data-id : module name) |
| 32 | +// render the react component in the DOM |
| 33 | +// use dom-testing-library to do the input simulation and wait for outputs |
| 34 | +// test output vs expected outputs |
| 35 | +// consume all input sequence! |
| 36 | +// first try set up with a small trivial example |
| 37 | +// then with one input sequence by hand |
| 38 | +// then automate it for any input sequence |
| 39 | + |
0 commit comments