Commit 0335e0c4 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/fixFailingMasterMRWidgetOptions' into 'master'

Fixed failing Jest master

See merge request gitlab-org/gitlab!71386
parents 7a2f033b 47a3318e
...@@ -46,6 +46,8 @@ export default { ...@@ -46,6 +46,8 @@ export default {
return true; return true;
}, },
statusIconName() { statusIconName() {
if (this.isLoadingSummary) return null;
return this.statusIcon(this.collapsedData); return this.statusIcon(this.collapsedData);
}, },
}, },
......
...@@ -19,7 +19,8 @@ export default { ...@@ -19,7 +19,8 @@ export default {
}, },
iconName: { iconName: {
type: String, type: String,
required: true, required: false,
default: null,
}, },
}, },
computed: { computed: {
......
...@@ -10,7 +10,10 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -10,7 +10,10 @@ import axios from '~/lib/utils/axios_utils';
import { setFaviconOverlay } from '~/lib/utils/favicon'; import { setFaviconOverlay } from '~/lib/utils/favicon';
import notify from '~/lib/utils/notify'; import notify from '~/lib/utils/notify';
import SmartInterval from '~/smart_interval'; import SmartInterval from '~/smart_interval';
import { registerExtension } from '~/vue_merge_request_widget/components/extensions'; import {
registerExtension,
registeredExtensions,
} from '~/vue_merge_request_widget/components/extensions';
import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/constants'; import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/constants';
import eventHub from '~/vue_merge_request_widget/event_hub'; import eventHub from '~/vue_merge_request_widget/event_hub';
import MrWidgetOptions from '~/vue_merge_request_widget/mr_widget_options.vue'; import MrWidgetOptions from '~/vue_merge_request_widget/mr_widget_options.vue';
...@@ -886,20 +889,22 @@ describe('MrWidgetOptions', () => { ...@@ -886,20 +889,22 @@ describe('MrWidgetOptions', () => {
describe('mock extension', () => { describe('mock extension', () => {
beforeEach(() => { beforeEach(() => {
registerExtension(testExtension);
createComponent(); createComponent();
}); });
it('renders collapsed data', async () => { afterEach(() => {
registerExtension(testExtension); registeredExtensions.extensions = [];
});
it('renders collapsed data', async () => {
await waitForPromises(); await waitForPromises();
expect(wrapper.text()).toContain('Test extension summary count: 1'); expect(wrapper.text()).toContain('Test extension summary count: 1');
}); });
it('renders full data', async () => { it('renders full data', async () => {
registerExtension(testExtension);
await waitForPromises(); await waitForPromises();
wrapper wrapper
......
import { EXTENSION_ICONS } from '~/vue_merge_request_widget/constants';
export default { export default {
name: 'WidgetTestExtension', name: 'WidgetTestExtension',
props: ['targetProjectFullPath'], props: ['targetProjectFullPath'],
...@@ -6,7 +8,7 @@ export default { ...@@ -6,7 +8,7 @@ export default {
return `Test extension summary count: ${count} & ${targetProjectFullPath}`; return `Test extension summary count: ${count} & ${targetProjectFullPath}`;
}, },
statusIcon({ count }) { statusIcon({ count }) {
return count > 0 ? 'warning' : 'success'; return count > 0 ? EXTENSION_ICONS.warning : EXTENSION_ICONS.success;
}, },
}, },
methods: { methods: {
......
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