Test this out.
This file contains 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
import { MissingFieldHandler } from 'relay-runtime/lib/store/RelayStoreTypes'; | |
// missingFieldHandlers debug only | |
export const missingFieldHandlers: ReadonlyArray<MissingFieldHandler> = [ | |
{ | |
kind: 'scalar', | |
handle( | |
field, | |
record, | |
args, |
This file contains 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
## @tag :integration | |
To integrate this into an existing test just use the following: | |
1. The Entire "Test" file | |
<img width="360" alt="Screen Shot 2020-07-22 at 1 57 53 PM" src="https://user-images.githubusercontent.com/15013243/88229612-e2d9c400-cc25-11ea-8f65-cce1b0fe6e7f.png"> | |
2. The Entire "Describe" block | |
<img width="693" alt="Screen Shot 2020-07-22 at 1 56 52 PM" src="https://user-images.githubusercontent.com/15013243/88229629-eb31ff00-cc25-11ea-8935-250a9a0ac808.png"> | |
3. The Single "Test" block |
- NordVPN access for testing in AUS on Marketing Ops
This file contains 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
import React from 'react' | |
import { cleanup, render } from 'react-testing-library' | |
import TextAreaInput from './TextAreaInput' | |
const defaultProps = { | |
labelText: 'I am a label', | |
name: 'comment', | |
className: 'textarea-box', | |
labelClassName: 'small-heading', | |
handleOnChange: () => {} |
This file contains 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
it('renders the value prop in the textarea as text', () => { | |
const value = 'This is a comment' | |
const { getByLabelText } = render(<TextAreaInput {…defaultProps} value={value} />) | |
const textareaInput = getByLabelText(defaultProps.labelText) | |
expect(textareaInput.value).toEqual(value) | |
}) |
This file contains 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
it('renders a placeholder correctly', () => { | |
const placeholderText = 'I am placeholder text' | |
const { getByLabelText } = render(<TextAreaInput {…defaultProps} placeholder={placeholderText} />) | |
const textareaInput = getByLabelText(defaultProps.labelText) | |
expect(textareaInput.placeholder).toEqual(placeholderText) | |
}) |
This file contains 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
it('does not have a disabled textarea input by default', () => { | |
const { getByLabelText } = render(<TextAreaInput {…defaultProps} />) | |
const textareaInput = getByLabelText(defaultProps.labelText) | |
expect(textareaInput.disabled).toEqual(false) | |
}) |
This file contains 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
it('has a disabled textarea if disabled prop is present', () => { | |
const { getByLabelText } = render(<TextAreaInput {…defaultProps} disabled />) | |
const textareaInput = getByLabelText(defaultProps.labelText) | |
expect(textareaInput.disabled).toEqual(true) | |
}) |
This file contains 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
it('will use the name prop to connect label to textarea tag if id prop is not present', () => { | |
const { getByLabelText, getByText } = render(<TextAreaInput {…defaultProps} id={null} />) | |
const label = getByText(defaultProps.labelText) | |
const textareaInput = getByLabelText(defaultProps.labelText) | |
expect(label.htmlFor).toEqual(defaultProps.name) | |
expect(textareaInput.id).toEqual(defaultProps.name) | |
}) |
NewerOlder