Last active
October 28, 2018 21:48
-
-
Save Robdel12/0f676dc69ef32c9d9c0d0ec19e2b54ad to your computer and use it in GitHub Desktop.
For this blog post: https://medium.com/@robdel12/jest-bigtest-interactor-component-test-%EF%B8%8F-11b1947954c8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//...typical imports | |
import { mount } from '@bigtest/react'; | |
import CheckboxInteractor from './interactor'; | |
describe("Checkbox", () => { | |
let checkbox = new CheckboxInteractor("label"); | |
it("calls onFocus() when focus is set", async () => { | |
let handleFocus = jest.fn(); | |
await mount(() => <Checkbox onFocus={handleFocus} />); | |
await checkbox.focusCheckbox(); | |
expect(handleFocus).toBeCalled(); | |
expect(checkbox.hasFocus).toBe(true); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment