diff --git a/src/ChipInput.spec.js b/src/ChipInput.spec.js
index 4c50db8..a8596d1 100644
--- a/src/ChipInput.spec.js
+++ b/src/ChipInput.spec.js
@@ -72,6 +72,39 @@ describe('uncontrolled mode', () => {
tree.find('Cancel').first().simulate('click')
expect(handleChange).toBeCalledWith(['bar'])
})
+
+ it('does not add empty chips', () => {
+ const handleChange = jest.fn()
+ const tree = mount(
+
+ )
+
+ tree.find('input').getDOMNode().value = ' '
+ tree.find('input').simulate('keyDown', { keyCode: 13 }) // press enter
+ expect(handleChange).not.toBeCalled()
+ })
+
+ it('does not add duplicate chips by default', () => {
+ const handleChange = jest.fn()
+ const tree = mount(
+
+ )
+
+ tree.find('input').getDOMNode().value = 'a'
+ tree.find('input').simulate('keyDown', { keyCode: 13 }) // press enter
+ expect(handleChange).not.toBeCalled()
+ })
+
+ it('does add duplicate chips if allowDuplicates is set to true', () => {
+ const handleChange = jest.fn()
+ const tree = mount(
+
+ )
+
+ tree.find('input').getDOMNode().value = 'a'
+ tree.find('input').simulate('keyDown', { keyCode: 13 }) // press enter
+ expect(handleChange).toBeCalledWith(['a', 'a'])
+ })
})
describe('chip focusing', () => {
@@ -148,7 +181,7 @@ describe('chip focusing', () => {
tree.find('input').simulate('keyDown', { keyCode: 39 }) // arrow right
expect(getFocusedChip(tree).text()).toBe('c')
- // onfocus all chips if the right arrow key is pressed when focusing the last chip
+ // unfocus all chips if the right arrow key is pressed when focusing the last chip
tree.find('input').simulate('keyDown', { keyCode: 39 }) // arrow right
expect(getFocusedChip(tree).length).toBe(0)
})
@@ -234,3 +267,12 @@ describe('floating label', () => {
expect(tree.find('InputLabel').prop('shrink')).toBe(true)
})
})
+
+describe('helper text', () => {
+ it('is displayed', () => {
+ const tree = mount(
+
+ )
+ expect(tree.find('FormHelperText').text()).toBe('Helper text')
+ })
+})