react-native-testing-library
Advanced tools
Comparing version 1.13.1 to 1.13.2
{ | ||
"name": "react-native-testing-library", | ||
"version": "1.13.1", | ||
"version": "1.13.2", | ||
"description": "Simple React Native testing utilities helping you write better tests with less effort", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -39,18 +39,18 @@ <div align='center'> | ||
import { QuestionsBoard } from '../QuestionsBoard'; | ||
import { Question } from '../Question'; | ||
function setAnswer(question, answer) { | ||
fireEvent.changeText(question, answer); | ||
} | ||
test('form submits two answers', () => { | ||
const allQuestions = ['q1', 'q2']; | ||
const mockFn = jest.fn(); | ||
test('should verify two questions', () => { | ||
const { getAllByA11yRole, getByText } = render(<QuestionsBoard {...props} />); | ||
const allQuestions = getAllByA11yRole('header'); | ||
const { getAllByA11yLabel, getByText } = render( | ||
<QuestionsBoard questions={allQuestions} onSubmit={mockFn} /> | ||
); | ||
setAnswer(allQuestions[0], 'a1'); | ||
setAnswer(allQuestions[1], 'a2'); | ||
const answerInputs = getAllByA11yLabel('answer input'); | ||
fireEvent.press(getByText('submit')); | ||
fireEvent.changeText(answerInputs[0], 'a1'); | ||
fireEvent.changeText(answerInputs[1], 'a2'); | ||
fireEvent.press(getByText('Submit')); | ||
expect(props.verifyQuestions).toBeCalledWith({ | ||
expect(mockFn).toBeCalledWith({ | ||
'1': { q: 'q1', a: 'a1' }, | ||
@@ -62,2 +62,4 @@ '2': { q: 'q2', a: 'a2' }, | ||
You can find the source of `QuestionsBoard` component and this example [here](https://github.com/callstack/react-native-testing-library/blob/master/src/__tests__/questionsBoard.test.js). | ||
## Installation | ||
@@ -64,0 +66,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167443
110