Commit 967a403c authored by David O'Regan's avatar David O'Regan

Merge branch '229519-integration-vue-app-specs' into 'master'

Refactor `spec/frontend/integrations/edit/components/active_checkbox_spec.js` to not mock Vuex getter

See merge request gitlab-org/gitlab!61080
parents e865a2fa 7d7fd437
...@@ -6,31 +6,27 @@ import { createStore } from '~/integrations/edit/store'; ...@@ -6,31 +6,27 @@ import { createStore } from '~/integrations/edit/store';
describe('ActiveCheckbox', () => { describe('ActiveCheckbox', () => {
let wrapper; let wrapper;
const createComponent = (customStateProps = {}, isInheriting = false) => { const createComponent = (customStateProps = {}, { isInheriting = false } = {}) => {
wrapper = mount(ActiveCheckbox, { wrapper = mount(ActiveCheckbox, {
store: createStore({ store: createStore({
customState: { ...customStateProps }, customState: { ...customStateProps },
override: !isInheriting,
defaultState: isInheriting ? {} : undefined,
}), }),
computed: {
isInheriting: () => isInheriting,
},
}); });
}; };
afterEach(() => { afterEach(() => {
if (wrapper) {
wrapper.destroy(); wrapper.destroy();
wrapper = null;
}
}); });
const findGlFormCheckbox = () => wrapper.find(GlFormCheckbox); const findGlFormCheckbox = () => wrapper.findComponent(GlFormCheckbox);
const findInputInCheckbox = () => findGlFormCheckbox().find('input'); const findInputInCheckbox = () => findGlFormCheckbox().find('input');
describe('template', () => { describe('template', () => {
describe('is inheriting adminSettings', () => { describe('is inheriting adminSettings', () => {
it('renders GlFormCheckbox as disabled', () => { it('renders GlFormCheckbox as disabled', () => {
createComponent({}, true); createComponent({}, { isInheriting: true });
expect(findGlFormCheckbox().exists()).toBe(true); expect(findGlFormCheckbox().exists()).toBe(true);
expect(findInputInCheckbox().attributes('disabled')).toBe('disabled'); expect(findInputInCheckbox().attributes('disabled')).toBe('disabled');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment