Fix formatting

This commit is contained in:
tomdds
2019-07-12 12:13:22 -04:00
parent 38a01f7db3
commit 0682411954
4 changed files with 78 additions and 79 deletions

View File

@@ -5,30 +5,30 @@ import checkboxinput from '../checkbox_input'
import { makeTestWrapper } from '../../test_utils/component_test_helpers'
const WrapperComponent = makeTestWrapper({
components: {
checkboxinput
},
templatePath: 'checkbox_input_template.html',
components: {
checkboxinput,
},
templatePath: 'checkbox_input_template.html',
})
describe('CheckboxInput Renders Correctly', () => {
it('Should initialize checked', () => {
const wrapper = mount(WrapperComponent, {
propsData: {
name: 'testCheck',
initialData: true
}
})
expect(wrapper.find('.usa-input input').element.checked).toBe(true)
it('Should initialize checked', () => {
const wrapper = mount(WrapperComponent, {
propsData: {
name: 'testCheck',
initialData: true,
},
})
expect(wrapper.find('.usa-input input').element.checked).toBe(true)
})
it('Should initialize unchecked', () => {
const wrapper = mount(WrapperComponent, {
propsData: {
name: 'testCheck',
initialData: false
}
})
expect(wrapper.find('.usa-input input').element.checked).toBe(false)
it('Should initialize unchecked', () => {
const wrapper = mount(WrapperComponent, {
propsData: {
name: 'testCheck',
initialData: false,
},
})
expect(wrapper.find('.usa-input input').element.checked).toBe(false)
})
})

View File

@@ -5,45 +5,45 @@ import uploadinput from '../upload_input'
import { makeTestWrapper } from '../../test_utils/component_test_helpers'
const UploadWrapper = makeTestWrapper({
components: { uploadinput },
templatePath: 'upload_input_template.html'
components: { uploadinput },
templatePath: 'upload_input_template.html',
})
const UploadErrorWrapper = makeTestWrapper({
components: { uploadinput },
templatePath: 'upload_input_error_template.html'
components: { uploadinput },
templatePath: 'upload_input_error_template.html',
})
describe('UploadInput Test', () => {
it('should show input and button when no attachment present', () => {
const wrapper = mount(UploadWrapper, {
propsData: {
initialData: null
}
})
const fileInput = wrapper.find('input[type=file]').element
expect(fileInput).not.toBe(undefined)
it('should show input and button when no attachment present', () => {
const wrapper = mount(UploadWrapper, {
propsData: {
initialData: null,
},
})
it('should show file name and hide input', () => {
const wrapper = mount(UploadWrapper, {
propsData: {
initialData: 'somepdf.pdf'
}
})
const fileInput = wrapper.find('input[type=file]').element
expect(fileInput).not.toBe(undefined)
})
const fileInput = wrapper.find('input[type=file]').element
const fileNameSpan = wrapper.find('.uploaded-file__name')
expect(fileInput).toBe(undefined)
expect(fileNameSpan.html()).toContain('somepdf.pdf')
it('should show file name and hide input', () => {
const wrapper = mount(UploadWrapper, {
propsData: {
initialData: 'somepdf.pdf',
},
})
it('should correctly display error treatment', () => {
const wrapper = mount(UploadErrorWrapper)
const fileInput = wrapper.find('input[type=file]').element
const fileNameSpan = wrapper.find('.uploaded-file__name')
const messageArea = wrapper.find('.usa-input__message')
expect(messageArea.html()).toContain('Test Error Message')
})
expect(fileInput).toBe(undefined)
expect(fileNameSpan.html()).toContain('somepdf.pdf')
})
it('should correctly display error treatment', () => {
const wrapper = mount(UploadErrorWrapper)
const messageArea = wrapper.find('.usa-input__message')
expect(messageArea.html()).toContain('Test Error Message')
})
})