Skip to content

Commit

Permalink
feat #3 - Fix tests and decrease font size of field label
Browse files Browse the repository at this point in the history
Closes #3
  • Loading branch information
github-actions committed Aug 21, 2020
1 parent 247a051 commit 12501bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/components/InputField/InputField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Input } from 'antd'
import React from 'react'
import Skeleton from 'react-loading-skeleton'
import InputField, { InputFieldProps } from './index'
import { mount, ReactWrapper } from 'enzyme'
import { mount, ReactWrapper, shallow } from 'enzyme'

let wrapper: ReactWrapper

Expand All @@ -28,7 +28,15 @@ describe('InputField', () => {
})

it('throws an error if value is passed without an onClick', () => {
expect(() => mount(<InputField value='abc' />)).toThrow()
expect(() => shallow(<InputField value='abc' />)).toThrow()
})

it('should pass onChange and value to the input component if the props exist', () => {
const mockOnChange = jest.fn()
wrapper = mount(<InputField onChange={mockOnChange} value='abc' />)

expect(wrapper.find(Input).props().onChange).toEqual(mockOnChange)
expect(wrapper.find(Input).props().value).toEqual('abc')
})

it('correctly passes the disabled prop', () => {
Expand Down Expand Up @@ -71,7 +79,7 @@ describe('InputField', () => {

describe('fullWidth', () => {
beforeEach(() => {
// Avoid `attachTo: document.body` Warning
// Mounting to document.body throws a React error, so create a temporary container div for the tests to mount the element to
const div = document.createElement('div')
div.setAttribute('id', 'container')
document.body.appendChild(div)
Expand Down
1 change: 1 addition & 0 deletions src/components/InputField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const useStyles = createUseStyles({
padding: '8.5px 14px'
},
label: {
fontSize: '14px',
paddingBottom: '5px'
},
required: {
Expand Down

0 comments on commit 12501bd

Please sign in to comment.