updates based on pr feedback

run prettier
update hasContentError to contentError in all the places
function naming updates
This commit is contained in:
John Mitchell
2019-07-26 10:03:46 -04:00
parent 357887417c
commit bdfeb2cb9c
31 changed files with 929 additions and 664 deletions

View File

@@ -12,7 +12,9 @@ describe('<Search />', () => {
});
test('it triggers the expected callbacks', () => {
const columns = [{ name: 'Name', key: 'name', isSortable: true, isSearchable: true }];
const columns = [
{ name: 'Name', key: 'name', isSortable: true, isSearchable: true },
];
const searchBtn = 'button[aria-label="Search submit button"]';
const searchTextInput = 'input[aria-label="Search text input"]';
@@ -20,11 +22,7 @@ describe('<Search />', () => {
const onSearch = jest.fn();
search = mountWithContexts(
<Search
sortedColumnKey="name"
columns={columns}
onSearch={onSearch}
/>
<Search sortedColumnKey="name" columns={columns} onSearch={onSearch} />
);
search.find(searchTextInput).instance().value = 'test-321';
@@ -36,14 +34,12 @@ describe('<Search />', () => {
});
test('handleDropdownToggle properly updates state', async () => {
const columns = [{ name: 'Name', key: 'name', isSortable: true, isSearchable: true }];
const columns = [
{ name: 'Name', key: 'name', isSortable: true, isSearchable: true },
];
const onSearch = jest.fn();
const wrapper = mountWithContexts(
<Search
sortedColumnKey="name"
columns={columns}
onSearch={onSearch}
/>
<Search sortedColumnKey="name" columns={columns} onSearch={onSearch} />
).find('Search');
expect(wrapper.state('isSearchDropdownOpen')).toEqual(false);
wrapper.instance().handleDropdownToggle(true);
@@ -53,18 +49,21 @@ describe('<Search />', () => {
test('handleDropdownSelect properly updates state', async () => {
const columns = [
{ name: 'Name', key: 'name', isSortable: true, isSearchable: true },
{ name: 'Description', key: 'description', isSortable: true, isSearchable: true }
{
name: 'Description',
key: 'description',
isSortable: true,
isSearchable: true,
},
];
const onSearch = jest.fn();
const wrapper = mountWithContexts(
<Search
sortedColumnKey="name"
columns={columns}
onSearch={onSearch}
/>
<Search sortedColumnKey="name" columns={columns} onSearch={onSearch} />
).find('Search');
expect(wrapper.state('searchKey')).toEqual('name');
wrapper.instance().handleDropdownSelect({ target: { innerText: 'Description' } });
wrapper
.instance()
.handleDropdownSelect({ target: { innerText: 'Description' } });
expect(wrapper.state('searchKey')).toEqual('description');
});
});