Commit 4ed2dadb authored by mfluharty's avatar mfluharty

Suggested changes from review

Use Vue's built-in .once instead of importing and using lodash's once
Remove localVue.extend from grouped reports app specs
parent 4b2f3022
<script> <script>
import { once } from 'lodash';
import { componentNames } from 'ee/reports/components/issue_body'; import { componentNames } from 'ee/reports/components/issue_body';
import ReportSection from '~/reports/components/report_section.vue'; import ReportSection from '~/reports/components/report_section.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -46,13 +45,11 @@ export default { ...@@ -46,13 +45,11 @@ export default {
}, },
}, },
componentNames, componentNames,
computed: { methods: {
handleLoadPerformanceToggleEvent() { handleLoadPerformanceToggleEvent() {
return once(() => { if (this.glFeatures.usageDataITestingLoadPerformanceWidgetTotal) {
if (this.glFeatures.usageDataITestingLoadPerformanceWidgetTotal) { api.trackRedisHllUserEvent(this.$options.expandEvent);
api.trackRedisHllUserEvent(this.$options.expandEvent); }
}
});
}, },
}, },
expandEvent: 'i_testing_load_performance_widget_total', expandEvent: 'i_testing_load_performance_widget_total',
...@@ -71,6 +68,6 @@ export default { ...@@ -71,6 +68,6 @@ export default {
:component="$options.componentNames.PerformanceIssueBody" :component="$options.componentNames.PerformanceIssueBody"
should-emit-toggle-event should-emit-toggle-event
class="js-load-performance-widget mr-widget-border-top mr-report" class="js-load-performance-widget mr-widget-border-top mr-report"
@toggleEvent="handleLoadPerformanceToggleEvent" @toggleEvent.once="handleLoadPerformanceToggleEvent"
/> />
</template> </template>
...@@ -7,11 +7,10 @@ jest.mock('~/api.js'); ...@@ -7,11 +7,10 @@ jest.mock('~/api.js');
const localVue = createLocalVue(); const localVue = createLocalVue();
describe('Grouped test reports app', () => { describe('Grouped test reports app', () => {
const Component = localVue.extend(GroupedBrowserPerformanceReportsApp);
let wrapper; let wrapper;
const mountComponent = ({ usageDataITestingWebPerformanceWidgetTotal = false } = {}) => { const mountComponent = ({ usageDataITestingWebPerformanceWidgetTotal = false } = {}) => {
wrapper = mount(Component, { wrapper = mount(GroupedBrowserPerformanceReportsApp, {
localVue, localVue,
propsData: { propsData: {
status: '', status: '',
......
...@@ -7,11 +7,10 @@ jest.mock('~/api.js'); ...@@ -7,11 +7,10 @@ jest.mock('~/api.js');
const localVue = createLocalVue(); const localVue = createLocalVue();
describe('Grouped load performance reports app', () => { describe('Grouped load performance reports app', () => {
const Component = localVue.extend(GroupedLoadPerformanceReportsApp);
let wrapper; let wrapper;
const mountComponent = ({ usageDataITestingLoadPerformanceWidgetTotal = false } = {}) => { const mountComponent = ({ usageDataITestingLoadPerformanceWidgetTotal = false } = {}) => {
wrapper = mount(Component, { wrapper = mount(GroupedLoadPerformanceReportsApp, {
localVue, localVue,
propsData: { propsData: {
status: '', status: '',
......
...@@ -9,7 +9,6 @@ const localVue = createLocalVue(); ...@@ -9,7 +9,6 @@ const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
describe('Grouped code quality reports app', () => { describe('Grouped code quality reports app', () => {
const Component = localVue.extend(GroupedCodequalityReportsApp);
let wrapper; let wrapper;
let mockStore; let mockStore;
...@@ -22,7 +21,7 @@ describe('Grouped code quality reports app', () => { ...@@ -22,7 +21,7 @@ describe('Grouped code quality reports app', () => {
}; };
const mountComponent = (props = {}) => { const mountComponent = (props = {}) => {
wrapper = mount(Component, { wrapper = mount(GroupedCodequalityReportsApp, {
store: mockStore, store: mockStore,
localVue, localVue,
propsData: { propsData: {
......
...@@ -18,12 +18,11 @@ localVue.use(Vuex); ...@@ -18,12 +18,11 @@ localVue.use(Vuex);
describe('Grouped test reports app', () => { describe('Grouped test reports app', () => {
const endpoint = 'endpoint.json'; const endpoint = 'endpoint.json';
const pipelinePath = '/path/to/pipeline'; const pipelinePath = '/path/to/pipeline';
const Component = localVue.extend(GroupedTestReportsApp);
let wrapper; let wrapper;
let mockStore; let mockStore;
const mountComponent = ({ props = { pipelinePath } } = {}) => { const mountComponent = ({ props = { pipelinePath } } = {}) => {
wrapper = mount(Component, { wrapper = mount(GroupedTestReportsApp, {
store: mockStore, store: mockStore,
localVue, localVue,
propsData: { propsData: {
......
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