Normalize event callback function names in search and sort components

This commit is contained in:
mabashian
2019-03-14 13:36:50 -04:00
parent 3596d776fc
commit fc80470e5d
4 changed files with 26 additions and 26 deletions

View File

@@ -39,7 +39,7 @@ describe('<Search />', () => {
expect(onSearch).toBeCalledWith('test-321');
});
test('onSearchDropdownToggle properly updates state', async () => {
test('handleDropdownToggle properly updates state', async () => {
const columns = [{ name: 'Name', key: 'name', isSortable: true }];
const onSearch = jest.fn();
const wrapper = mount(
@@ -52,11 +52,11 @@ describe('<Search />', () => {
</I18nProvider>
).find('Search');
expect(wrapper.state('isSearchDropdownOpen')).toEqual(false);
wrapper.instance().onSearchDropdownToggle(true);
wrapper.instance().handleDropdownToggle(true);
expect(wrapper.state('isSearchDropdownOpen')).toEqual(true);
});
test('onSearchDropdownSelect properly updates state', async () => {
test('handleDropdownSelect properly updates state', async () => {
const columns = [
{ name: 'Name', key: 'name', isSortable: true },
{ name: 'Description', key: 'description', isSortable: true }
@@ -72,7 +72,7 @@ describe('<Search />', () => {
</I18nProvider>
).find('Search');
expect(wrapper.state('searchKey')).toEqual('name');
wrapper.instance().onSearchDropdownSelect({ target: { innerText: 'Description' } });
wrapper.instance().handleDropdownSelect({ target: { innerText: 'Description' } });
expect(wrapper.state('searchKey')).toEqual('description');
});
});

View File

@@ -110,7 +110,7 @@ describe('<Sort />', () => {
</I18nProvider>
).find('Sort');
wrapper.instance().onSortDropdownSelect({ target: { innerText: 'Bar' } });
wrapper.instance().handleDropdownSelect({ target: { innerText: 'Bar' } });
expect(onSort).toBeCalledWith('bar', 'ascending');
});
@@ -135,7 +135,7 @@ describe('<Sort />', () => {
</I18nProvider>
).find('Sort');
expect(wrapper.state('isSortDropdownOpen')).toEqual(false);
wrapper.instance().onSortDropdownToggle(true);
wrapper.instance().handleDropdownToggle(true);
expect(wrapper.state('isSortDropdownOpen')).toEqual(true);
});