Commit c63d6532 authored by Mark Florian's avatar Mark Florian Committed by Illya Klymov

Make all ProjectSelector props required

This addresses https://gitlab.com/gitlab-org/gitlab/-/issues/217987,
which is part of the larger [effort][1] to reduce duplication and
increase consistency in dashboards that use the ProjectSelector.

[1]: https://gitlab.com/groups/gitlab-org/-/epics/3330
parent acd2c7ad
...@@ -24,28 +24,23 @@ export default { ...@@ -24,28 +24,23 @@ export default {
}, },
showNoResultsMessage: { showNoResultsMessage: {
type: Boolean, type: Boolean,
required: false, required: true,
default: false,
}, },
showMinimumSearchQueryMessage: { showMinimumSearchQueryMessage: {
type: Boolean, type: Boolean,
required: false, required: true,
default: false,
}, },
showLoadingIndicator: { showLoadingIndicator: {
type: Boolean, type: Boolean,
required: false, required: true,
default: false,
}, },
showSearchErrorMessage: { showSearchErrorMessage: {
type: Boolean, type: Boolean,
required: false, required: true,
default: false,
}, },
totalResults: { totalResults: {
type: Number, type: Number,
required: false, required: true,
default: 0,
}, },
}, },
data() { data() {
......
import Vuex from 'vuex'; import Vuex from 'vuex';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import { merge } from 'lodash';
import createDefaultState from 'ee/security_dashboard/store/modules/project_selector/state'; import createDefaultState from 'ee/security_dashboard/store/modules/project_selector/state';
...@@ -42,8 +43,7 @@ describe('Project Manager component', () => { ...@@ -42,8 +43,7 @@ describe('Project Manager component', () => {
isUpdatingProjects: jest.fn().mockReturnValue(isUpdatingProjects), isUpdatingProjects: jest.fn().mockReturnValue(isUpdatingProjects),
}, },
state: { state: {
...createDefaultState(), ...merge(createDefaultState(), state),
...state,
}, },
}, },
}, },
...@@ -155,11 +155,11 @@ describe('Project Manager component', () => { ...@@ -155,11 +155,11 @@ describe('Project Manager component', () => {
}); });
it('passes the list of projects to the project-list component', () => { it('passes the list of projects to the project-list component', () => {
const projects = [{}]; const projects = [{ foo: true }];
factory({ state: { projects } }); factory({ state: { projects } });
expect(getProjectList().props('projects')).toBe(projects); expect(getProjectList().props('projects')).toEqual(projects);
}); });
it.each([false, true])( it.each([false, true])(
......
...@@ -29,6 +29,7 @@ describe('ProjectSelector component', () => { ...@@ -29,6 +29,7 @@ describe('ProjectSelector component', () => {
showMinimumSearchQueryMessage: false, showMinimumSearchQueryMessage: false,
showLoadingIndicator: false, showLoadingIndicator: false,
showSearchErrorMessage: false, showSearchErrorMessage: false,
totalResults: searchResults.length,
}, },
attachToDocument: true, attachToDocument: true,
}); });
......
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