Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8969affd
Commit
8969affd
authored
Dec 08, 2021
by
🕺 Winnie 🕺
Committed by
Natalia Tepluhina
Dec 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use global Vue instance in Jest (vue_shared)
parent
c60c6ed3
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
110 additions
and
176 deletions
+110
-176
ee/spec/frontend/vue_shared/components/incidents/service_level_agreement_spec.js
...ared/components/incidents/service_level_agreement_spec.js
+3
-6
ee/spec/frontend/vue_shared/license_compliance/components/delete_confirmation_modal_spec.js
...e_compliance/components/delete_confirmation_modal_spec.js
+3
-4
ee/spec/frontend/vue_shared/license_compliance/mr_widget_license_report_spec.js
...hared/license_compliance/mr_widget_license_report_spec.js
+3
-4
ee/spec/frontend/vue_shared/metrics_reports/grouped_metrics_reports_app_spec.js
...hared/metrics_reports/grouped_metrics_reports_app_spec.js
+3
-4
ee/spec/frontend/vue_shared/purchase_flow/components/checkout/payment_method_spec.js
.../purchase_flow/components/checkout/payment_method_spec.js
+2
-4
ee/spec/frontend/vue_shared/purchase_flow/components/checkout/zuora_spec.js
...ue_shared/purchase_flow/components/checkout/zuora_spec.js
+3
-4
ee/spec/frontend/vue_shared/purchase_flow/components/step_spec.js
...frontend/vue_shared/purchase_flow/components/step_spec.js
+3
-4
ee/spec/frontend/vue_shared/security_reports/components/create_jira_issue_spec.js
...red/security_reports/components/create_jira_issue_spec.js
+3
-5
spec/frontend/issuable/components/issuable_header_warnings_spec.js
...tend/issuable/components/issuable_header_warnings_spec.js
+2
-4
spec/frontend/vue_shared/components/diff_viewer/viewers/renamed_spec.js
...vue_shared/components/diff_viewer/viewers/renamed_spec.js
+3
-4
spec/frontend/vue_shared/components/gl_modal_vuex_spec.js
spec/frontend/vue_shared/components/gl_modal_vuex_spec.js
+3
-4
spec/frontend/vue_shared/components/notes/placeholder_note_spec.js
...tend/vue_shared/components/notes/placeholder_note_spec.js
+3
-4
spec/frontend/vue_shared/components/project_selector/project_list_item_spec.js
...red/components/project_selector/project_list_item_spec.js
+3
-5
spec/frontend/vue_shared/components/project_selector/project_selector_spec.js
...ared/components/project_selector/project_selector_spec.js
+1
-4
spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js
...nts/runner_instructions/runner_instructions_modal_spec.js
+4
-6
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_button_spec.js
...ponents/sidebar/labels_select_vue/dropdown_button_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js
...r/labels_select_vue/dropdown_contents_create_view_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view_spec.js
...r/labels_select_vue/dropdown_contents_labels_view_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_spec.js
...nents/sidebar/labels_select_vue/dropdown_contents_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_title_spec.js
...mponents/sidebar/labels_select_vue/dropdown_title_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_value_spec.js
...mponents/sidebar/labels_select_vue/dropdown_value_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_vue/labels_select_root_spec.js
...ents/sidebar/labels_select_vue/labels_select_root_spec.js
+3
-4
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_create_view_spec.js
...abels_select_widget/dropdown_contents_create_view_spec.js
+3
-5
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_labels_view_spec.js
...abels_select_widget/dropdown_contents_labels_view_spec.js
+3
-5
spec/frontend/vue_shared/components/user_select_spec.js
spec/frontend/vue_shared/components/user_select_spec.js
+3
-5
spec/frontend/vue_shared/components/vuex_module_provider_spec.js
...ontend/vue_shared/components/vuex_module_provider_spec.js
+3
-4
spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js
spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js
+5
-6
spec/frontend/vue_shared/translate_spec.js
spec/frontend/vue_shared/translate_spec.js
+30
-57
No files found.
ee/spec/frontend/vue_shared/components/incidents/service_level_agreement_spec.js
View file @
8969affd
import
{
createLocalVue
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
Vue
,
{
nextTick
}
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
getIncidentStateQuery
from
'
ee/graphql_shared/queries/get_incident_state.query.graphql
'
;
import
getIncidentStateQuery
from
'
ee/graphql_shared/queries/get_incident_state.query.graphql
'
;
import
ServiceLevelAgreementCell
from
'
ee/vue_shared/components/incidents/service_level_agreement.vue
'
;
import
ServiceLevelAgreementCell
from
'
ee/vue_shared/components/incidents/service_level_agreement.vue
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
{
calculateRemainingMilliseconds
,
formatTime
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
calculateRemainingMilliseconds
,
formatTime
}
from
'
~/lib/utils/datetime_utility
'
;
const
localVue
=
createLocalVue
();
const
formatTimeActual
=
jest
.
requireActual
(
'
~/lib/utils/datetime_utility
'
).
formatTime
;
const
formatTimeActual
=
jest
.
requireActual
(
'
~/lib/utils/datetime_utility
'
).
formatTime
;
jest
.
mock
(
'
~/lib/utils/datetime_utility
'
,
()
=>
({
jest
.
mock
(
'
~/lib/utils/datetime_utility
'
,
()
=>
({
...
@@ -39,7 +37,7 @@ describe('Service Level Agreement', () => {
...
@@ -39,7 +37,7 @@ describe('Service Level Agreement', () => {
};
};
function
createMockApolloProvider
(
issueState
)
{
function
createMockApolloProvider
(
issueState
)
{
local
Vue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
const
requestHandlers
=
[
const
requestHandlers
=
[
[
getIncidentStateQuery
,
jest
.
fn
().
mockResolvedValue
(
issueStateResponse
(
issueState
))],
[
getIncidentStateQuery
,
jest
.
fn
().
mockResolvedValue
(
issueStateResponse
(
issueState
))],
...
@@ -50,7 +48,6 @@ describe('Service Level Agreement', () => {
...
@@ -50,7 +48,6 @@ describe('Service Level Agreement', () => {
function
mountComponent
({
mockApollo
,
props
}
=
{})
{
function
mountComponent
({
mockApollo
,
props
}
=
{})
{
wrapper
=
shallowMount
(
ServiceLevelAgreementCell
,
{
wrapper
=
shallowMount
(
ServiceLevelAgreementCell
,
{
localVue
,
apolloProvider
:
mockApollo
,
apolloProvider
:
mockApollo
,
propsData
:
{
propsData
:
{
...
props
,
...
props
,
...
...
ee/spec/frontend/vue_shared/license_compliance/components/delete_confirmation_modal_spec.js
View file @
8969affd
import
{
GlModal
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
GlModal
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
Component
from
'
ee/vue_shared/license_compliance/components/delete_confirmation_modal.vue
'
;
import
Component
from
'
ee/vue_shared/license_compliance/components/delete_confirmation_modal.vue
'
;
import
{
approvedLicense
}
from
'
../mock_data
'
;
import
{
approvedLicense
}
from
'
../mock_data
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
describe
(
'
DeleteConfirmationModal
'
,
()
=>
{
describe
(
'
DeleteConfirmationModal
'
,
()
=>
{
let
store
;
let
store
;
...
@@ -36,7 +36,6 @@ describe('DeleteConfirmationModal', () => {
...
@@ -36,7 +36,6 @@ describe('DeleteConfirmationModal', () => {
store
=
createStore
(
initialState
);
store
=
createStore
(
initialState
);
wrapper
=
shallowMount
(
Component
,
{
wrapper
=
shallowMount
(
Component
,
{
localVue
,
store
,
store
,
stubs
:
{
stubs
:
{
GlModal
,
GlModal
,
...
...
ee/spec/frontend/vue_shared/license_compliance/mr_widget_license_report_spec.js
View file @
8969affd
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
LicenseManagement
from
'
ee/vue_shared/license_compliance/mr_widget_license_report.vue
'
;
import
LicenseManagement
from
'
ee/vue_shared/license_compliance/mr_widget_license_report.vue
'
;
import
{
stubComponent
}
from
'
helpers/stub_component
'
;
import
{
stubComponent
}
from
'
helpers/stub_component
'
;
...
@@ -13,8 +14,7 @@ import {
...
@@ -13,8 +14,7 @@ import {
generateReportGroup
,
generateReportGroup
,
}
from
'
./mock_data
'
;
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
describe
(
'
License Report MR Widget
'
,
()
=>
{
describe
(
'
License Report MR Widget
'
,
()
=>
{
const
apiUrl
=
`
${
TEST_HOST
}
/license_management`
;
const
apiUrl
=
`
${
TEST_HOST
}
/license_management`
;
...
@@ -82,7 +82,6 @@ describe('License Report MR Widget', () => {
...
@@ -82,7 +82,6 @@ describe('License Report MR Widget', () => {
},
},
});
});
wrapper
=
shallowMount
(
LicenseManagement
,
{
wrapper
=
shallowMount
(
LicenseManagement
,
{
localVue
,
propsData
:
props
,
propsData
:
props
,
store
,
store
,
stubs
,
stubs
,
...
...
ee/spec/frontend/vue_shared/metrics_reports/grouped_metrics_reports_app_spec.js
View file @
8969affd
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
MetricsReportsIssueBody
from
'
ee/vue_shared/metrics_reports/components/metrics_reports_issue_body.vue
'
;
import
MetricsReportsIssueBody
from
'
ee/vue_shared/metrics_reports/components/metrics_reports_issue_body.vue
'
;
import
GroupedMetricsReportsApp
from
'
ee/vue_shared/metrics_reports/grouped_metrics_reports_app.vue
'
;
import
GroupedMetricsReportsApp
from
'
ee/vue_shared/metrics_reports/grouped_metrics_reports_app.vue
'
;
...
@@ -7,8 +8,7 @@ import Api from '~/api';
...
@@ -7,8 +8,7 @@ import Api from '~/api';
jest
.
mock
(
'
~/api.js
'
);
jest
.
mock
(
'
~/api.js
'
);
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
describe
(
'
Grouped metrics reports app
'
,
()
=>
{
describe
(
'
Grouped metrics reports app
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
...
@@ -19,7 +19,6 @@ describe('Grouped metrics reports app', () => {
...
@@ -19,7 +19,6 @@ describe('Grouped metrics reports app', () => {
const
mountComponent
=
(
glFeatures
=
{})
=>
{
const
mountComponent
=
(
glFeatures
=
{})
=>
{
wrapper
=
mount
(
GroupedMetricsReportsApp
,
{
wrapper
=
mount
(
GroupedMetricsReportsApp
,
{
store
:
mockStore
,
store
:
mockStore
,
localVue
,
propsData
:
{
propsData
:
{
endpoint
:
'
metrics.json
'
,
endpoint
:
'
metrics.json
'
,
},
},
...
...
ee/spec/frontend/vue_shared/purchase_flow/components/checkout/payment_method_spec.js
View file @
8969affd
import
{
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
merge
}
from
'
lodash
'
;
import
{
merge
}
from
'
lodash
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
{
import
{
mockParsedNamespaces
,
mockParsedNamespaces
,
...
@@ -14,8 +14,7 @@ import { createMockApolloProvider } from 'ee_jest/vue_shared/purchase_flow/spec_
...
@@ -14,8 +14,7 @@ import { createMockApolloProvider } from 'ee_jest/vue_shared/purchase_flow/spec_
import
Zuora
from
'
ee/vue_shared/purchase_flow/components/checkout/zuora.vue
'
;
import
Zuora
from
'
ee/vue_shared/purchase_flow/components/checkout/zuora.vue
'
;
import
{
mountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
mountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
VueApollo
);
localVue
.
use
(
VueApollo
);
describe
(
'
Payment Method
'
,
()
=>
{
describe
(
'
Payment Method
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
...
@@ -36,7 +35,6 @@ describe('Payment Method', () => {
...
@@ -36,7 +35,6 @@ describe('Payment Method', () => {
});
});
return
mountExtended
(
PaymentMethod
,
{
return
mountExtended
(
PaymentMethod
,
{
localVue
,
apolloProvider
,
apolloProvider
,
});
});
};
};
...
...
ee/spec/frontend/vue_shared/purchase_flow/components/checkout/zuora_spec.js
View file @
8969affd
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
AxiosMockAdapter
from
'
axios-mock-adapter
'
;
import
AxiosMockAdapter
from
'
axios-mock-adapter
'
;
import
{
merge
}
from
'
lodash
'
;
import
{
merge
}
from
'
lodash
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
{
resolvers
}
from
'
ee/subscriptions/buy_addons_shared/graphql/resolvers
'
;
import
{
resolvers
}
from
'
ee/subscriptions/buy_addons_shared/graphql/resolvers
'
;
import
{
STEPS
}
from
'
ee/subscriptions/constants
'
;
import
{
STEPS
}
from
'
ee/subscriptions/constants
'
;
...
@@ -12,8 +13,7 @@ import { createMockApolloProvider } from 'ee_jest/vue_shared/purchase_flow/spec_
...
@@ -12,8 +13,7 @@ import { createMockApolloProvider } from 'ee_jest/vue_shared/purchase_flow/spec_
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
flushPromises
from
'
helpers/flush_promises
'
;
import
flushPromises
from
'
helpers/flush_promises
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
VueApollo
);
localVue
.
use
(
VueApollo
);
describe
(
'
Zuora
'
,
()
=>
{
describe
(
'
Zuora
'
,
()
=>
{
let
axiosMock
;
let
axiosMock
;
...
@@ -36,7 +36,6 @@ describe('Zuora', () => {
...
@@ -36,7 +36,6 @@ describe('Zuora', () => {
data
()
{
data
()
{
return
{
...
data
};
return
{
...
data
};
},
},
localVue
,
});
});
};
};
...
...
ee/spec/frontend/vue_shared/purchase_flow/components/step_spec.js
View file @
8969affd
import
{
GlButton
,
GlFormGroup
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlFormGroup
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
Step
from
'
ee/vue_shared/purchase_flow/components/step.vue
'
;
import
Step
from
'
ee/vue_shared/purchase_flow/components/step.vue
'
;
import
StepSummary
from
'
ee/vue_shared/purchase_flow/components/step_summary.vue
'
;
import
StepSummary
from
'
ee/vue_shared/purchase_flow/components/step_summary.vue
'
;
...
@@ -10,8 +11,7 @@ import flash from '~/flash';
...
@@ -10,8 +11,7 @@ import flash from '~/flash';
import
{
STEPS
}
from
'
../mock_data
'
;
import
{
STEPS
}
from
'
../mock_data
'
;
import
{
createMockApolloProvider
}
from
'
../spec_helper
'
;
import
{
createMockApolloProvider
}
from
'
../spec_helper
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
VueApollo
);
localVue
.
use
(
VueApollo
);
jest
.
mock
(
'
~/flash
'
);
jest
.
mock
(
'
~/flash
'
);
...
@@ -34,7 +34,6 @@ describe('Step', () => {
...
@@ -34,7 +34,6 @@ describe('Step', () => {
function
createComponent
(
options
=
{})
{
function
createComponent
(
options
=
{})
{
const
{
apolloProvider
,
propsData
}
=
options
;
const
{
apolloProvider
,
propsData
}
=
options
;
return
shallowMount
(
Step
,
{
return
shallowMount
(
Step
,
{
localVue
,
propsData
:
{
...
initialProps
,
...
propsData
},
propsData
:
{
...
initialProps
,
...
propsData
},
apolloProvider
,
apolloProvider
,
stubs
:
{
stubs
:
{
...
...
ee/spec/frontend/vue_shared/security_reports/components/create_jira_issue_spec.js
View file @
8969affd
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
createLocalVue
,
mount
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
Component
,
{
i18n
}
from
'
ee/vue_shared/security_reports/components/create_jira_issue.vue
'
;
import
Component
,
{
i18n
}
from
'
ee/vue_shared/security_reports/components/create_jira_issue.vue
'
;
import
vulnerabilityExternalIssueLinkCreate
from
'
ee/vue_shared/security_reports/graphql/vulnerabilityExternalIssueLinkCreate.mutation.graphql
'
;
import
vulnerabilityExternalIssueLinkCreate
from
'
ee/vue_shared/security_reports/graphql/vulnerabilityExternalIssueLinkCreate.mutation.graphql
'
;
...
@@ -7,8 +8,6 @@ import createMockApollo from 'helpers/mock_apollo_helper';
...
@@ -7,8 +8,6 @@ import createMockApollo from 'helpers/mock_apollo_helper';
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
{
vulnerabilityExternalIssueLinkCreateMockFactory
}
from
'
./apollo_mocks
'
;
import
{
vulnerabilityExternalIssueLinkCreateMockFactory
}
from
'
./apollo_mocks
'
;
const
localVue
=
createLocalVue
();
describe
(
'
create_jira_issue
'
,
()
=>
{
describe
(
'
create_jira_issue
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
...
@@ -34,7 +33,7 @@ describe('create_jira_issue', () => {
...
@@ -34,7 +33,7 @@ describe('create_jira_issue', () => {
const
pendingHandler
=
jest
.
fn
().
mockReturnValue
(
new
Promise
(()
=>
{}));
const
pendingHandler
=
jest
.
fn
().
mockReturnValue
(
new
Promise
(()
=>
{}));
function
createMockApolloProvider
(
handler
)
{
function
createMockApolloProvider
(
handler
)
{
local
Vue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
const
requestHandlers
=
[[
vulnerabilityExternalIssueLinkCreate
,
handler
]];
const
requestHandlers
=
[[
vulnerabilityExternalIssueLinkCreate
,
handler
]];
return
createMockApollo
(
requestHandlers
);
return
createMockApollo
(
requestHandlers
);
...
@@ -42,7 +41,6 @@ describe('create_jira_issue', () => {
...
@@ -42,7 +41,6 @@ describe('create_jira_issue', () => {
const
createComponent
=
(
options
=
{})
=>
{
const
createComponent
=
(
options
=
{})
=>
{
wrapper
=
mount
(
Component
,
{
wrapper
=
mount
(
Component
,
{
localVue
,
apolloProvider
:
options
.
mockApollo
,
apolloProvider
:
options
.
mockApollo
,
propsData
:
{
propsData
:
{
...
defaultProps
,
...
defaultProps
,
...
...
spec/frontend/issuable/components/issuable_header_warnings_spec.js
View file @
8969affd
import
{
createLocalVue
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
{
createMockDirective
,
getBinding
}
from
'
helpers/vue_mock_directive
'
;
import
{
createMockDirective
,
getBinding
}
from
'
helpers/vue_mock_directive
'
;
import
{
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
...
@@ -9,8 +9,7 @@ import IssuableHeaderWarnings from '~/issuable/components/issuable_header_warnin
...
@@ -9,8 +9,7 @@ import IssuableHeaderWarnings from '~/issuable/components/issuable_header_warnin
const
ISSUABLE_TYPE_ISSUE
=
'
issue
'
;
const
ISSUABLE_TYPE_ISSUE
=
'
issue
'
;
const
ISSUABLE_TYPE_MR
=
'
merge request
'
;
const
ISSUABLE_TYPE_MR
=
'
merge request
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
describe
(
'
IssuableHeaderWarnings
'
,
()
=>
{
describe
(
'
IssuableHeaderWarnings
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
...
@@ -24,7 +23,6 @@ describe('IssuableHeaderWarnings', () => {
...
@@ -24,7 +23,6 @@ describe('IssuableHeaderWarnings', () => {
const
createComponent
=
({
store
,
provide
})
=>
{
const
createComponent
=
({
store
,
provide
})
=>
{
wrapper
=
shallowMountExtended
(
IssuableHeaderWarnings
,
{
wrapper
=
shallowMountExtended
(
IssuableHeaderWarnings
,
{
store
,
store
,
localVue
,
provide
,
provide
,
directives
:
{
directives
:
{
GlTooltip
:
createMockDirective
(),
GlTooltip
:
createMockDirective
(),
...
...
spec/frontend/vue_shared/components/diff_viewer/viewers/renamed_spec.js
View file @
8969affd
import
{
createLocalVue
,
shallowMount
,
mount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
,
mount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
{
import
{
TRANSITION_LOAD_START
,
TRANSITION_LOAD_START
,
...
@@ -11,15 +12,13 @@ import {
...
@@ -11,15 +12,13 @@ import {
}
from
'
~/diffs/constants
'
;
}
from
'
~/diffs/constants
'
;
import
Renamed
from
'
~/vue_shared/components/diff_viewer/viewers/renamed.vue
'
;
import
Renamed
from
'
~/vue_shared/components/diff_viewer/viewers/renamed.vue
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
function
createRenamedComponent
({
props
=
{},
store
=
new
Vuex
.
Store
({}),
deep
=
false
})
{
function
createRenamedComponent
({
props
=
{},
store
=
new
Vuex
.
Store
({}),
deep
=
false
})
{
const
mnt
=
deep
?
mount
:
shallowMount
;
const
mnt
=
deep
?
mount
:
shallowMount
;
return
mnt
(
Renamed
,
{
return
mnt
(
Renamed
,
{
propsData
:
{
...
props
},
propsData
:
{
...
props
},
localVue
,
store
,
store
,
});
});
}
}
...
...
spec/frontend/vue_shared/components/gl_modal_vuex_spec.js
View file @
8969affd
import
{
GlModal
}
from
'
@gitlab/ui
'
;
import
{
GlModal
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
{
BV_SHOW_MODAL
,
BV_HIDE_MODAL
}
from
'
~/lib/utils/constants
'
;
import
{
BV_SHOW_MODAL
,
BV_HIDE_MODAL
}
from
'
~/lib/utils/constants
'
;
import
GlModalVuex
from
'
~/vue_shared/components/gl_modal_vuex.vue
'
;
import
GlModalVuex
from
'
~/vue_shared/components/gl_modal_vuex.vue
'
;
import
createState
from
'
~/vuex_shared/modules/modal/state
'
;
import
createState
from
'
~/vuex_shared/modules/modal/state
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
const
TEST_SLOT
=
'
Lorem ipsum modal dolar sit.
'
;
const
TEST_SLOT
=
'
Lorem ipsum modal dolar sit.
'
;
const
TEST_MODAL_ID
=
'
my-modal-id
'
;
const
TEST_MODAL_ID
=
'
my-modal-id
'
;
...
@@ -36,7 +36,6 @@ describe('GlModalVuex', () => {
...
@@ -36,7 +36,6 @@ describe('GlModalVuex', () => {
wrapper
=
shallowMount
(
GlModalVuex
,
{
wrapper
=
shallowMount
(
GlModalVuex
,
{
...
options
,
...
options
,
localVue
,
store
,
store
,
propsData
,
propsData
,
stubs
:
{
stubs
:
{
...
...
spec/frontend/vue_shared/components/notes/placeholder_note_spec.js
View file @
8969affd
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
IssuePlaceholderNote
from
'
~/vue_shared/components/notes/placeholder_note.vue
'
;
import
IssuePlaceholderNote
from
'
~/vue_shared/components/notes/placeholder_note.vue
'
;
import
{
userDataMock
}
from
'
../../../notes/mock_data
'
;
import
{
userDataMock
}
from
'
../../../notes/mock_data
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
const
getters
=
{
const
getters
=
{
getUserData
:
()
=>
userDataMock
,
getUserData
:
()
=>
userDataMock
,
...
@@ -17,7 +17,6 @@ describe('Issue placeholder note component', () => {
...
@@ -17,7 +17,6 @@ describe('Issue placeholder note component', () => {
const
createComponent
=
(
isIndividual
=
false
)
=>
{
const
createComponent
=
(
isIndividual
=
false
)
=>
{
wrapper
=
shallowMount
(
IssuePlaceholderNote
,
{
wrapper
=
shallowMount
(
IssuePlaceholderNote
,
{
localVue
,
store
:
new
Vuex
.
Store
({
store
:
new
Vuex
.
Store
({
getters
,
getters
,
}),
}),
...
...
spec/frontend/vue_shared/components/project_selector/project_list_item_spec.js
View file @
8969affd
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
mockProjects
from
'
test_fixtures_static/projects.json
'
;
import
mockProjects
from
'
test_fixtures_static/projects.json
'
;
import
{
trimText
}
from
'
helpers/text_helper
'
;
import
{
trimText
}
from
'
helpers/text_helper
'
;
import
ProjectAvatar
from
'
~/vue_shared/components/deprecated_project_avatar/default.vue
'
;
import
ProjectAvatar
from
'
~/vue_shared/components/deprecated_project_avatar/default.vue
'
;
import
ProjectListItem
from
'
~/vue_shared/components/project_selector/project_list_item.vue
'
;
import
ProjectListItem
from
'
~/vue_shared/components/project_selector/project_list_item.vue
'
;
const
localVue
=
createLocalVue
();
describe
(
'
ProjectListItem component
'
,
()
=>
{
describe
(
'
ProjectListItem component
'
,
()
=>
{
const
Component
=
local
Vue
.
extend
(
ProjectListItem
);
const
Component
=
Vue
.
extend
(
ProjectListItem
);
let
wrapper
;
let
wrapper
;
let
vm
;
let
vm
;
let
options
;
let
options
;
...
@@ -20,7 +19,6 @@ describe('ProjectListItem component', () => {
...
@@ -20,7 +19,6 @@ describe('ProjectListItem component', () => {
project
,
project
,
selected
:
false
,
selected
:
false
,
},
},
localVue
,
};
};
});
});
...
...
spec/frontend/vue_shared/components/project_selector/project_selector_spec.js
View file @
8969affd
import
{
GlSearchBoxByType
,
GlInfiniteScroll
}
from
'
@gitlab/ui
'
;
import
{
GlSearchBoxByType
,
GlInfiniteScroll
}
from
'
@gitlab/ui
'
;
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
head
}
from
'
lodash
'
;
import
{
head
}
from
'
lodash
'
;
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
mockProjects
from
'
test_fixtures_static/projects.json
'
;
import
mockProjects
from
'
test_fixtures_static/projects.json
'
;
...
@@ -7,8 +7,6 @@ import { trimText } from 'helpers/text_helper';
...
@@ -7,8 +7,6 @@ import { trimText } from 'helpers/text_helper';
import
ProjectListItem
from
'
~/vue_shared/components/project_selector/project_list_item.vue
'
;
import
ProjectListItem
from
'
~/vue_shared/components/project_selector/project_list_item.vue
'
;
import
ProjectSelector
from
'
~/vue_shared/components/project_selector/project_selector.vue
'
;
import
ProjectSelector
from
'
~/vue_shared/components/project_selector/project_selector.vue
'
;
const
localVue
=
createLocalVue
();
describe
(
'
ProjectSelector component
'
,
()
=>
{
describe
(
'
ProjectSelector component
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
let
vm
;
let
vm
;
...
@@ -28,7 +26,6 @@ describe('ProjectSelector component', () => {
...
@@ -28,7 +26,6 @@ describe('ProjectSelector component', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
wrapper
=
mount
(
Vue
.
extend
(
ProjectSelector
),
{
wrapper
=
mount
(
Vue
.
extend
(
ProjectSelector
),
{
localVue
,
propsData
:
{
propsData
:
{
projectSearchResults
:
searchResults
,
projectSearchResults
:
searchResults
,
selectedProjects
:
selected
,
selectedProjects
:
selected
,
...
...
spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js
View file @
8969affd
import
{
GlAlert
,
GlModal
,
GlButton
,
GlLoadingIcon
,
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
GlAlert
,
GlModal
,
GlButton
,
GlLoadingIcon
,
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
GlBreakpointInstance
as
bp
}
from
'
@gitlab/ui/dist/utils
'
;
import
{
GlBreakpointInstance
as
bp
}
from
'
@gitlab/ui/dist/utils
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
Vue
,
{
nextTick
}
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
...
@@ -16,8 +16,7 @@ import {
...
@@ -16,8 +16,7 @@ import {
mockGraphqlInstructionsWindows
,
mockGraphqlInstructionsWindows
,
}
from
'
./mock_data
'
;
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
VueApollo
);
localVue
.
use
(
VueApollo
);
let
resizeCallback
;
let
resizeCallback
;
const
MockResizeObserver
=
{
const
MockResizeObserver
=
{
...
@@ -33,7 +32,7 @@ const MockResizeObserver = {
...
@@ -33,7 +32,7 @@ const MockResizeObserver = {
},
},
};
};
local
Vue
.
directive
(
'
gl-resize-observer
'
,
MockResizeObserver
);
Vue
.
directive
(
'
gl-resize-observer
'
,
MockResizeObserver
);
jest
.
mock
(
'
@gitlab/ui/dist/utils
'
);
jest
.
mock
(
'
@gitlab/ui/dist/utils
'
);
...
@@ -67,7 +66,6 @@ describe('RunnerInstructionsModal component', () => {
...
@@ -67,7 +66,6 @@ describe('RunnerInstructionsModal component', () => {
registrationToken
:
'
MY_TOKEN
'
,
registrationToken
:
'
MY_TOKEN
'
,
...
props
,
...
props
,
},
},
localVue
,
apolloProvider
:
fakeApollo
,
apolloProvider
:
fakeApollo
,
...
options
,
...
options
,
}),
}),
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_button_spec.js
View file @
8969affd
import
{
GlIcon
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
GlIcon
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
DropdownButton
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_button.vue
'
;
import
DropdownButton
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_button.vue
'
;
...
@@ -9,8 +10,7 @@ import labelSelectModule from '~/vue_shared/components/sidebar/labels_select_vue
...
@@ -9,8 +10,7 @@ import labelSelectModule from '~/vue_shared/components/sidebar/labels_select_vue
import
{
mockConfig
}
from
'
./mock_data
'
;
import
{
mockConfig
}
from
'
./mock_data
'
;
let
store
;
let
store
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
const
createComponent
=
(
initialState
=
mockConfig
)
=>
{
const
createComponent
=
(
initialState
=
mockConfig
)
=>
{
store
=
new
Vuex
.
Store
(
labelSelectModule
());
store
=
new
Vuex
.
Store
(
labelSelectModule
());
...
@@ -18,7 +18,6 @@ const createComponent = (initialState = mockConfig) => {
...
@@ -18,7 +18,6 @@ const createComponent = (initialState = mockConfig) => {
store
.
dispatch
(
'
setInitialState
'
,
initialState
);
store
.
dispatch
(
'
setInitialState
'
,
initialState
);
return
shallowMount
(
DropdownButton
,
{
return
shallowMount
(
DropdownButton
,
{
localVue
,
store
,
store
,
});
});
};
};
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js
View file @
8969affd
import
{
GlButton
,
GlFormInput
,
GlLink
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlFormInput
,
GlLink
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
DropdownContentsCreateView
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue
'
;
import
DropdownContentsCreateView
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view.vue
'
;
...
@@ -8,8 +9,7 @@ import labelSelectModule from '~/vue_shared/components/sidebar/labels_select_vue
...
@@ -8,8 +9,7 @@ import labelSelectModule from '~/vue_shared/components/sidebar/labels_select_vue
import
{
mockConfig
,
mockSuggestedColors
}
from
'
./mock_data
'
;
import
{
mockConfig
,
mockSuggestedColors
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
const
createComponent
=
(
initialState
=
mockConfig
)
=>
{
const
createComponent
=
(
initialState
=
mockConfig
)
=>
{
const
store
=
new
Vuex
.
Store
(
labelSelectModule
());
const
store
=
new
Vuex
.
Store
(
labelSelectModule
());
...
@@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig) => {
...
@@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig) => {
store
.
dispatch
(
'
setInitialState
'
,
initialState
);
store
.
dispatch
(
'
setInitialState
'
,
initialState
);
return
shallowMount
(
DropdownContentsCreateView
,
{
return
shallowMount
(
DropdownContentsCreateView
,
{
localVue
,
store
,
store
,
});
});
};
};
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view_spec.js
View file @
8969affd
...
@@ -5,7 +5,8 @@ import {
...
@@ -5,7 +5,8 @@ import {
GlSearchBoxByType
,
GlSearchBoxByType
,
GlLink
,
GlLink
,
}
from
'
@gitlab/ui
'
;
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
{
UP_KEY_CODE
,
DOWN_KEY_CODE
,
ENTER_KEY_CODE
,
ESC_KEY_CODE
}
from
'
~/lib/utils/keycodes
'
;
import
{
UP_KEY_CODE
,
DOWN_KEY_CODE
,
ENTER_KEY_CODE
,
ESC_KEY_CODE
}
from
'
~/lib/utils/keycodes
'
;
import
DropdownContentsLabelsView
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue
'
;
import
DropdownContentsLabelsView
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue
'
;
...
@@ -18,8 +19,7 @@ import defaultState from '~/vue_shared/components/sidebar/labels_select_vue/stor
...
@@ -18,8 +19,7 @@ import defaultState from '~/vue_shared/components/sidebar/labels_select_vue/stor
import
{
mockConfig
,
mockLabels
,
mockRegularLabel
}
from
'
./mock_data
'
;
import
{
mockConfig
,
mockLabels
,
mockRegularLabel
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
describe
(
'
DropdownContentsLabelsView
'
,
()
=>
{
describe
(
'
DropdownContentsLabelsView
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
...
@@ -43,7 +43,6 @@ describe('DropdownContentsLabelsView', () => {
...
@@ -43,7 +43,6 @@ describe('DropdownContentsLabelsView', () => {
store
.
dispatch
(
'
receiveLabelsSuccess
'
,
mockLabels
);
store
.
dispatch
(
'
receiveLabelsSuccess
'
,
mockLabels
);
wrapper
=
shallowMount
(
DropdownContentsLabelsView
,
{
wrapper
=
shallowMount
(
DropdownContentsLabelsView
,
{
localVue
,
store
,
store
,
});
});
};
};
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_spec.js
View file @
8969affd
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
{
DropdownVariant
}
from
'
~/vue_shared/components/sidebar/labels_select_vue/constants
'
;
import
{
DropdownVariant
}
from
'
~/vue_shared/components/sidebar/labels_select_vue/constants
'
;
...
@@ -7,8 +8,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
...
@@ -7,8 +8,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
import
{
mockConfig
}
from
'
./mock_data
'
;
import
{
mockConfig
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
const
createComponent
=
(
initialState
=
mockConfig
,
propsData
=
{})
=>
{
const
createComponent
=
(
initialState
=
mockConfig
,
propsData
=
{})
=>
{
const
store
=
new
Vuex
.
Store
(
labelsSelectModule
());
const
store
=
new
Vuex
.
Store
(
labelsSelectModule
());
...
@@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig, propsData = {}) => {
...
@@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig, propsData = {}) => {
return
shallowMount
(
DropdownContents
,
{
return
shallowMount
(
DropdownContents
,
{
propsData
,
propsData
,
localVue
,
store
,
store
,
});
});
};
};
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_title_spec.js
View file @
8969affd
import
{
GlButton
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
DropdownTitle
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_title.vue
'
;
import
DropdownTitle
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_title.vue
'
;
...
@@ -8,8 +9,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
...
@@ -8,8 +9,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
import
{
mockConfig
}
from
'
./mock_data
'
;
import
{
mockConfig
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
const
createComponent
=
(
initialState
=
mockConfig
)
=>
{
const
createComponent
=
(
initialState
=
mockConfig
)
=>
{
const
store
=
new
Vuex
.
Store
(
labelsSelectModule
());
const
store
=
new
Vuex
.
Store
(
labelsSelectModule
());
...
@@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig) => {
...
@@ -17,7 +17,6 @@ const createComponent = (initialState = mockConfig) => {
store
.
dispatch
(
'
setInitialState
'
,
initialState
);
store
.
dispatch
(
'
setInitialState
'
,
initialState
);
return
shallowMount
(
DropdownTitle
,
{
return
shallowMount
(
DropdownTitle
,
{
localVue
,
store
,
store
,
propsData
:
{
propsData
:
{
labelsSelectInProgress
:
false
,
labelsSelectInProgress
:
false
,
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_value_spec.js
View file @
8969affd
import
{
GlLabel
}
from
'
@gitlab/ui
'
;
import
{
GlLabel
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
DropdownValue
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_value.vue
'
;
import
DropdownValue
from
'
~/vue_shared/components/sidebar/labels_select_vue/dropdown_value.vue
'
;
...
@@ -8,8 +9,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
...
@@ -8,8 +9,7 @@ import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vu
import
{
mockConfig
,
mockLabels
,
mockRegularLabel
,
mockScopedLabel
}
from
'
./mock_data
'
;
import
{
mockConfig
,
mockLabels
,
mockRegularLabel
,
mockScopedLabel
}
from
'
./mock_data
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
describe
(
'
DropdownValue
'
,
()
=>
{
describe
(
'
DropdownValue
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
...
@@ -23,7 +23,6 @@ describe('DropdownValue', () => {
...
@@ -23,7 +23,6 @@ describe('DropdownValue', () => {
store
.
dispatch
(
'
setInitialState
'
,
{
...
mockConfig
,
...
initialState
});
store
.
dispatch
(
'
setInitialState
'
,
{
...
mockConfig
,
...
initialState
});
wrapper
=
shallowMount
(
DropdownValue
,
{
wrapper
=
shallowMount
(
DropdownValue
,
{
localVue
,
store
,
store
,
slots
,
slots
,
});
});
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/labels_select_root_spec.js
View file @
8969affd
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
{
isInViewport
}
from
'
~/lib/utils/common_utils
'
;
import
{
isInViewport
}
from
'
~/lib/utils/common_utils
'
;
...
@@ -18,8 +19,7 @@ jest.mock('~/lib/utils/common_utils', () => ({
...
@@ -18,8 +19,7 @@ jest.mock('~/lib/utils/common_utils', () => ({
isInViewport
:
jest
.
fn
().
mockReturnValue
(
true
),
isInViewport
:
jest
.
fn
().
mockReturnValue
(
true
),
}));
}));
const
localVue
=
createLocalVue
();
Vue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
describe
(
'
LabelsSelectRoot
'
,
()
=>
{
describe
(
'
LabelsSelectRoot
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
...
@@ -27,7 +27,6 @@ describe('LabelsSelectRoot', () => {
...
@@ -27,7 +27,6 @@ describe('LabelsSelectRoot', () => {
const
createComponent
=
(
config
=
mockConfig
,
slots
=
{})
=>
{
const
createComponent
=
(
config
=
mockConfig
,
slots
=
{})
=>
{
wrapper
=
shallowMount
(
LabelsSelectRoot
,
{
wrapper
=
shallowMount
(
LabelsSelectRoot
,
{
localVue
,
slots
,
slots
,
store
,
store
,
propsData
:
config
,
propsData
:
config
,
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_create_view_spec.js
View file @
8969affd
import
{
GlLoadingIcon
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
GlLoadingIcon
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
Vue
,
{
nextTick
}
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
...
@@ -18,8 +18,7 @@ jest.mock('~/flash');
...
@@ -18,8 +18,7 @@ jest.mock('~/flash');
const
colors
=
Object
.
keys
(
mockSuggestedColors
);
const
colors
=
Object
.
keys
(
mockSuggestedColors
);
const
localVue
=
createLocalVue
();
Vue
.
use
(
VueApollo
);
localVue
.
use
(
VueApollo
);
const
userRecoverableError
=
{
const
userRecoverableError
=
{
...
createLabelSuccessfulResponse
,
...
createLabelSuccessfulResponse
,
...
@@ -63,7 +62,6 @@ describe('DropdownContentsCreateView', () => {
...
@@ -63,7 +62,6 @@ describe('DropdownContentsCreateView', () => {
});
});
wrapper
=
shallowMount
(
DropdownContentsCreateView
,
{
wrapper
=
shallowMount
(
DropdownContentsCreateView
,
{
localVue
,
apolloProvider
:
mockApollo
,
apolloProvider
:
mockApollo
,
propsData
:
{
propsData
:
{
fullPath
:
''
,
fullPath
:
''
,
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_labels_view_spec.js
View file @
8969affd
...
@@ -4,8 +4,8 @@ import {
...
@@ -4,8 +4,8 @@ import {
GlDropdownItem
,
GlDropdownItem
,
GlIntersectionObserver
,
GlIntersectionObserver
,
}
from
'
@gitlab/ui
'
;
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
Vue
,
{
nextTick
}
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
...
@@ -19,8 +19,7 @@ import { mockConfig, workspaceLabelsQueryResponse } from './mock_data';
...
@@ -19,8 +19,7 @@ import { mockConfig, workspaceLabelsQueryResponse } from './mock_data';
jest
.
mock
(
'
~/flash
'
);
jest
.
mock
(
'
~/flash
'
);
const
localVue
=
createLocalVue
();
Vue
.
use
(
VueApollo
);
localVue
.
use
(
VueApollo
);
const
localSelectedLabels
=
[
const
localSelectedLabels
=
[
{
{
...
@@ -47,7 +46,6 @@ describe('DropdownContentsLabelsView', () => {
...
@@ -47,7 +46,6 @@ describe('DropdownContentsLabelsView', () => {
const
mockApollo
=
createMockApollo
([[
projectLabelsQuery
,
queryHandler
]]);
const
mockApollo
=
createMockApollo
([[
projectLabelsQuery
,
queryHandler
]]);
wrapper
=
shallowMount
(
DropdownContentsLabelsView
,
{
wrapper
=
shallowMount
(
DropdownContentsLabelsView
,
{
localVue
,
apolloProvider
:
mockApollo
,
apolloProvider
:
mockApollo
,
provide
:
{
provide
:
{
variant
:
DropdownVariant
.
Sidebar
,
variant
:
DropdownVariant
.
Sidebar
,
...
...
spec/frontend/vue_shared/components/user_select_spec.js
View file @
8969affd
import
{
GlSearchBoxByType
,
GlDropdown
}
from
'
@gitlab/ui
'
;
import
{
GlSearchBoxByType
,
GlDropdown
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
cloneDeep
}
from
'
lodash
'
;
import
{
cloneDeep
}
from
'
lodash
'
;
import
{
nextTick
}
from
'
vue
'
;
import
Vue
,
{
nextTick
}
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
...
@@ -33,8 +33,7 @@ const waitForSearch = async () => {
...
@@ -33,8 +33,7 @@ const waitForSearch = async () => {
await
waitForPromises
();
await
waitForPromises
();
};
};
const
localVue
=
createLocalVue
();
Vue
.
use
(
VueApollo
);
localVue
.
use
(
VueApollo
);
describe
(
'
User select dropdown
'
,
()
=>
{
describe
(
'
User select dropdown
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
...
@@ -62,7 +61,6 @@ describe('User select dropdown', () => {
...
@@ -62,7 +61,6 @@ describe('User select dropdown', () => {
[
getIssueParticipantsQuery
,
participantsQueryHandler
],
[
getIssueParticipantsQuery
,
participantsQueryHandler
],
]);
]);
wrapper
=
shallowMount
(
UserSelect
,
{
wrapper
=
shallowMount
(
UserSelect
,
{
localVue
,
apolloProvider
:
fakeApollo
,
apolloProvider
:
fakeApollo
,
propsData
:
{
propsData
:
{
headerText
:
'
test
'
,
headerText
:
'
test
'
,
...
...
spec/frontend/vue_shared/components/vuex_module_provider_spec.js
View file @
8969affd
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VuexModuleProvider
from
'
~/vue_shared/components/vuex_module_provider.vue
'
;
import
VuexModuleProvider
from
'
~/vue_shared/components/vuex_module_provider.vue
'
;
...
@@ -38,10 +38,9 @@ describe('~/vue_shared/components/vuex_module_provider', () => {
...
@@ -38,10 +38,9 @@ describe('~/vue_shared/components/vuex_module_provider', () => {
it
(
'
does not blow up when used with vue-apollo
'
,
()
=>
{
it
(
'
does not blow up when used with vue-apollo
'
,
()
=>
{
// See https://github.com/vuejs/vue-apollo/pull/1153 for details
// See https://github.com/vuejs/vue-apollo/pull/1153 for details
const
localVue
=
createLocalVue
();
Vue
.
use
(
VueApollo
);
localVue
.
use
(
VueApollo
);
createComponent
(
{
localVue
}
);
createComponent
();
expect
(
findProvidedVuexModule
()).
toBe
(
TEST_VUEX_MODULE
);
expect
(
findProvidedVuexModule
()).
toBe
(
TEST_VUEX_MODULE
);
});
});
});
});
spec/frontend/vue_shared/gl_feature_flags_plugin_spec.js
View file @
8969affd
import
{
createLocalVue
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
GlFeatureFlags
from
'
~/vue_shared/gl_feature_flags_plugin
'
;
import
GlFeatureFlags
from
'
~/vue_shared/gl_feature_flags_plugin
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
const
localVue
=
createLocalVue
();
describe
(
'
GitLab Feature Flags Plugin
'
,
()
=>
{
describe
(
'
GitLab Feature Flags Plugin
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
window
.
gon
=
{
window
.
gon
=
{
...
@@ -17,7 +16,7 @@ describe('GitLab Feature Flags Plugin', () => {
...
@@ -17,7 +16,7 @@ describe('GitLab Feature Flags Plugin', () => {
},
},
};
};
local
Vue
.
use
(
GlFeatureFlags
);
Vue
.
use
(
GlFeatureFlags
);
});
});
it
(
'
should provide glFeatures to components
'
,
()
=>
{
it
(
'
should provide glFeatures to components
'
,
()
=>
{
...
@@ -25,7 +24,7 @@ describe('GitLab Feature Flags Plugin', () => {
...
@@ -25,7 +24,7 @@ describe('GitLab Feature Flags Plugin', () => {
template
:
`<span></span>`
,
template
:
`<span></span>`
,
inject
:
[
'
glFeatures
'
],
inject
:
[
'
glFeatures
'
],
};
};
const
wrapper
=
shallowMount
(
component
,
{
localVue
}
);
const
wrapper
=
shallowMount
(
component
);
expect
(
wrapper
.
vm
.
glFeatures
).
toEqual
({
expect
(
wrapper
.
vm
.
glFeatures
).
toEqual
({
aFeature
:
true
,
aFeature
:
true
,
bFeature
:
false
,
bFeature
:
false
,
...
@@ -39,7 +38,7 @@ describe('GitLab Feature Flags Plugin', () => {
...
@@ -39,7 +38,7 @@ describe('GitLab Feature Flags Plugin', () => {
template
:
`<span></span>`
,
template
:
`<span></span>`
,
mixins
:
[
glFeatureFlagsMixin
()],
mixins
:
[
glFeatureFlagsMixin
()],
};
};
const
wrapper
=
shallowMount
(
component
,
{
localVue
}
);
const
wrapper
=
shallowMount
(
component
);
expect
(
wrapper
.
vm
.
glFeatures
).
toEqual
({
expect
(
wrapper
.
vm
.
glFeatures
).
toEqual
({
aFeature
:
true
,
aFeature
:
true
,
bFeature
:
false
,
bFeature
:
false
,
...
...
spec/frontend/vue_shared/translate_spec.js
View file @
8969affd
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
Vue
from
'
vue
'
;
import
locale
from
'
~/locale
'
;
import
locale
from
'
~/locale
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
const
localVue
=
createLocalVue
();
Vue
.
use
(
Translate
);
localVue
.
use
(
Translate
);
describe
(
'
Vue translate filter
'
,
()
=>
{
describe
(
'
Vue translate filter
'
,
()
=>
{
const
createTranslationMock
=
(
key
,
...
translations
)
=>
{
const
createTranslationMock
=
(
key
,
...
translations
)
=>
{
...
@@ -26,16 +26,13 @@ describe('Vue translate filter', () => {
...
@@ -26,16 +26,13 @@ describe('Vue translate filter', () => {
const
translation
=
'
singular_translated
'
;
const
translation
=
'
singular_translated
'
;
createTranslationMock
(
key
,
translation
);
createTranslationMock
(
key
,
translation
);
const
wrapper
=
mount
(
const
wrapper
=
mount
({
{
template
:
`
template
:
`
<span>
<span>
{{ __('
${
key
}
') }}
{{ __('
${
key
}
') }}
</span>
</span>
`
,
`
,
},
});
{
localVue
},
);
expect
(
wrapper
.
text
()).
toBe
(
translation
);
expect
(
wrapper
.
text
()).
toBe
(
translation
);
});
});
...
@@ -45,16 +42,13 @@ describe('Vue translate filter', () => {
...
@@ -45,16 +42,13 @@ describe('Vue translate filter', () => {
const
translationPlural
=
'
plural_multiple translation
'
;
const
translationPlural
=
'
plural_multiple translation
'
;
createTranslationMock
(
key
,
'
plural_singular translation
'
,
translationPlural
);
createTranslationMock
(
key
,
'
plural_singular translation
'
,
translationPlural
);
const
wrapper
=
mount
(
const
wrapper
=
mount
({
{
template
:
`
template
:
`
<span>
<span>
{{ n__('
${
key
}
', 'plurals', 2) }}
{{ n__('
${
key
}
', 'plurals', 2) }}
</span>
</span>
`
,
`
,
},
});
{
localVue
},
);
expect
(
wrapper
.
text
()).
toBe
(
translationPlural
);
expect
(
wrapper
.
text
()).
toBe
(
translationPlural
);
});
});
...
@@ -67,31 +61,25 @@ describe('Vue translate filter', () => {
...
@@ -67,31 +61,25 @@ describe('Vue translate filter', () => {
});
});
it
(
'
and n === 1
'
,
()
=>
{
it
(
'
and n === 1
'
,
()
=>
{
const
wrapper
=
mount
(
const
wrapper
=
mount
({
{
template
:
`
template
:
`
<span>
<span>
{{ n__('
${
key
}
', '%d days', 1) }}
{{ n__('
${
key
}
', '%d days', 1) }}
</span>
</span>
`
,
`
,
},
});
{
localVue
},
);
expect
(
wrapper
.
text
()).
toBe
(
'
1 singular translated
'
);
expect
(
wrapper
.
text
()).
toBe
(
'
1 singular translated
'
);
});
});
it
(
'
and n > 1
'
,
()
=>
{
it
(
'
and n > 1
'
,
()
=>
{
const
wrapper
=
mount
(
const
wrapper
=
mount
({
{
template
:
`
template
:
`
<span>
<span>
{{ n__('
${
key
}
', '%d days', 2) }}
{{ n__('
${
key
}
', '%d days', 2) }}
</span>
</span>
`
,
`
,
},
});
{
localVue
},
);
expect
(
wrapper
.
text
()).
toBe
(
'
2 plural translated
'
);
expect
(
wrapper
.
text
()).
toBe
(
'
2 plural translated
'
);
});
});
...
@@ -107,31 +95,25 @@ describe('Vue translate filter', () => {
...
@@ -107,31 +95,25 @@ describe('Vue translate filter', () => {
});
});
it
(
'
and using two parameters
'
,
()
=>
{
it
(
'
and using two parameters
'
,
()
=>
{
const
wrapper
=
mount
(
const
wrapper
=
mount
({
{
template
:
`
template
:
`
<span>
<span>
{{ s__('Context', 'Foobar') }}
{{ s__('Context', 'Foobar') }}
</span>
</span>
`
,
`
,
},
});
{
localVue
},
);
expect
(
wrapper
.
text
()).
toBe
(
expectation
);
expect
(
wrapper
.
text
()).
toBe
(
expectation
);
});
});
it
(
'
and using the pipe syntax
'
,
()
=>
{
it
(
'
and using the pipe syntax
'
,
()
=>
{
const
wrapper
=
mount
(
const
wrapper
=
mount
({
{
template
:
`
template
:
`
<span>
<span>
{{ s__('
${
key
}
') }}
{{ s__('
${
key
}
') }}
</span>
</span>
`
,
`
,
},
});
{
localVue
},
);
expect
(
wrapper
.
text
()).
toBe
(
expectation
);
expect
(
wrapper
.
text
()).
toBe
(
expectation
);
});
});
...
@@ -141,9 +123,8 @@ describe('Vue translate filter', () => {
...
@@ -141,9 +123,8 @@ describe('Vue translate filter', () => {
const
translation
=
'
multiline string translated
'
;
const
translation
=
'
multiline string translated
'
;
createTranslationMock
(
'
multiline string
'
,
translation
);
createTranslationMock
(
'
multiline string
'
,
translation
);
const
wrapper
=
mount
(
const
wrapper
=
mount
({
{
template
:
`
template
:
`
<span>
<span>
{{ __(\`
{{ __(\`
multiline
multiline
...
@@ -151,9 +132,7 @@ describe('Vue translate filter', () => {
...
@@ -151,9 +132,7 @@ describe('Vue translate filter', () => {
\`) }}
\`) }}
</span>
</span>
`
,
`
,
},
});
{
localVue
},
);
expect
(
wrapper
.
text
()).
toBe
(
translation
);
expect
(
wrapper
.
text
()).
toBe
(
translation
);
});
});
...
@@ -163,9 +142,8 @@ describe('Vue translate filter', () => {
...
@@ -163,9 +142,8 @@ describe('Vue translate filter', () => {
createTranslationMock
(
'
multiline string
'
,
'
multiline string singular
'
,
translation
);
createTranslationMock
(
'
multiline string
'
,
'
multiline string singular
'
,
translation
);
const
wrapper
=
mount
(
const
wrapper
=
mount
({
{
template
:
`
template
:
`
<span>
<span>
{{ n__(
{{ n__(
\`
\`
...
@@ -180,9 +158,7 @@ describe('Vue translate filter', () => {
...
@@ -180,9 +158,7 @@ describe('Vue translate filter', () => {
) }}
) }}
</span>
</span>
`
,
`
,
},
});
{
localVue
},
);
expect
(
wrapper
.
text
()).
toBe
(
translation
);
expect
(
wrapper
.
text
()).
toBe
(
translation
);
});
});
...
@@ -192,9 +168,8 @@ describe('Vue translate filter', () => {
...
@@ -192,9 +168,8 @@ describe('Vue translate filter', () => {
createTranslationMock
(
'
Context| multiline string
'
,
translation
);
createTranslationMock
(
'
Context| multiline string
'
,
translation
);
const
wrapper
=
mount
(
const
wrapper
=
mount
({
{
template
:
`
template
:
`
<span>
<span>
{{ s__(
{{ s__(
\`
\`
...
@@ -205,9 +180,7 @@ describe('Vue translate filter', () => {
...
@@ -205,9 +180,7 @@ describe('Vue translate filter', () => {
) }}
) }}
</span>
</span>
`
,
`
,
},
});
{
localVue
},
);
expect
(
wrapper
.
text
()).
toBe
(
translation
);
expect
(
wrapper
.
text
()).
toBe
(
translation
);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment