2021-01-31 16:09:10 -05:00
|
|
|
import { setHTMLFixture } from 'helpers/fixtures';
|
|
|
|
import mount from '~/search_settings/mount';
|
|
|
|
import { expandSection, closeSection } from '~/settings_panels';
|
|
|
|
|
|
|
|
jest.mock('~/settings_panels');
|
|
|
|
|
|
|
|
describe('search_settings/mount', () => {
|
|
|
|
let app;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const el = document.createElement('div');
|
|
|
|
|
|
|
|
setHTMLFixture('<div id="content-body"></div>');
|
|
|
|
|
|
|
|
app = mount({ el });
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
app.$destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('calls settings_panel.onExpand when expand event is emitted', () => {
|
|
|
|
const section = { name: 'section' };
|
|
|
|
app.$refs.searchSettings.$emit('expand', section);
|
|
|
|
|
2021-02-10 16:09:24 -05:00
|
|
|
expect(expandSection).toHaveBeenCalledWith(section);
|
2021-01-31 16:09:10 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('calls settings_panel.closeSection when collapse event is emitted', () => {
|
|
|
|
const section = { name: 'section' };
|
|
|
|
app.$refs.searchSettings.$emit('collapse', section);
|
|
|
|
|
2021-02-10 16:09:24 -05:00
|
|
|
expect(closeSection).toHaveBeenCalledWith(section);
|
2021-01-31 16:09:10 -05:00
|
|
|
});
|
|
|
|
});
|