-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: cannot save nullish values for required fields (#2003)
- Loading branch information
1 parent
659c544
commit e1a5497
Showing
3 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2016-present, Parse, LLC | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the LICENSE file in | ||
* the root directory of this source tree. | ||
*/ | ||
jest.dontMock('../../components/BrowserCell/BrowserCell.react'); | ||
|
||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
const BrowserCell = require('../../components/BrowserCell/BrowserCell.react').default; | ||
|
||
describe('BrowserCell', () => { | ||
|
||
describe('Required fields', () => { | ||
|
||
it('should not highlight 0 value', () => { | ||
const component = renderer.create( | ||
<BrowserCell value={0} markRequiredField={true} isRequired={true}/> | ||
).toJSON(); | ||
expect(component.props.className).not.toContain('required'); | ||
}); | ||
|
||
it('should not highlight false value', () => { | ||
const component = renderer.create( | ||
<BrowserCell value={false} markRequiredField={true} isRequired={true}/> | ||
).toJSON(); | ||
expect(component.props.className).not.toContain('required'); | ||
}); | ||
|
||
it('should not highlight empty string value', () => { | ||
const component = renderer.create( | ||
<BrowserCell value="" markRequiredField={true} isRequired={true}/> | ||
).toJSON(); | ||
expect(component.props.className).not.toContain('required'); | ||
}); | ||
|
||
it('should highlight null value', () => { | ||
const component = renderer.create( | ||
<BrowserCell value={null} markRequiredField={true} isRequired={true}/> | ||
).toJSON(); | ||
expect(component.props.className).toContain('required'); | ||
}); | ||
|
||
it('should highlight undefined value', () => { | ||
const component = renderer.create( | ||
<BrowserCell markRequiredField={true} isRequired={true}/> | ||
).toJSON(); | ||
expect(component.props.className).toContain('required'); | ||
}); | ||
}); | ||
}); |