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
de531b4f
Commit
de531b4f
authored
Sep 08, 2020
by
Illya Klymov
Committed by
Vitaly Slobodin
Sep 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deprecated methods in vue_shared tests
parent
4e0d6868
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
33 deletions
+24
-33
ee/app/assets/javascripts/vue_shared/metrics_reports/store/index.js
...ets/javascripts/vue_shared/metrics_reports/store/index.js
+8
-7
ee/spec/frontend/vue_shared/metrics_reports/grouped_metrics_reports_app_spec.js
...hared/metrics_reports/grouped_metrics_reports_app_spec.js
+2
-2
spec/frontend/vue_shared/components/confirm_modal_spec.js
spec/frontend/vue_shared/components/confirm_modal_spec.js
+13
-9
spec/frontend/vue_shared/components/diff_viewer/viewers/renamed_spec.js
...vue_shared/components/diff_viewer/viewers/renamed_spec.js
+1
-15
No files found.
ee/app/assets/javascripts/vue_shared/metrics_reports/store/index.js
View file @
de531b4f
...
@@ -7,10 +7,11 @@ import state from './state';
...
@@ -7,10 +7,11 @@ import state from './state';
Vue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
export
default
()
=>
export
const
getStoreConfig
=
()
=>
({
new
Vuex
.
Store
({
actions
,
actions
,
mutations
,
mutations
,
getters
,
getters
,
state
:
state
(),
state
:
state
(),
});
});
export
default
()
=>
new
Vuex
.
Store
(
getStoreConfig
());
ee/spec/frontend/vue_shared/metrics_reports/grouped_metrics_reports_app_spec.js
View file @
de531b4f
...
@@ -2,7 +2,7 @@ import { mount, createLocalVue } from '@vue/test-utils';
...
@@ -2,7 +2,7 @@ import { mount, createLocalVue } from '@vue/test-utils';
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
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
'
;
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
store
from
'
ee/vue_shared/metrics_reports/store
'
;
import
{
getStoreConfig
}
from
'
ee/vue_shared/metrics_reports/store
'
;
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
...
@@ -25,7 +25,7 @@ describe('Grouped metrics reports app', () => {
...
@@ -25,7 +25,7 @@ describe('Grouped metrics reports app', () => {
};
};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mockStore
=
store
(
);
mockStore
=
new
Vuex
.
Store
(
getStoreConfig
()
);
mountComponent
();
mountComponent
();
});
});
...
...
spec/frontend/vue_shared/components/confirm_modal_spec.js
View file @
de531b4f
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlModal
}
from
'
@gitlab/ui
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
ConfirmModal
from
'
~/vue_shared/components/confirm_modal.vue
'
;
import
ConfirmModal
from
'
~/vue_shared/components/confirm_modal.vue
'
;
...
@@ -21,9 +20,14 @@ describe('vue_shared/components/confirm_modal', () => {
...
@@ -21,9 +20,14 @@ describe('vue_shared/components/confirm_modal', () => {
selector
:
'
.test-button
'
,
selector
:
'
.test-button
'
,
};
};
const
actionSpies
=
{
const
popupMethods
=
{
openModal
:
jest
.
fn
(),
hide
:
jest
.
fn
(),
closeModal
:
jest
.
fn
(),
show
:
jest
.
fn
(),
};
const
GlModalStub
=
{
template
:
'
<div><slot></slot></div>
'
,
methods
:
popupMethods
,
};
};
let
wrapper
;
let
wrapper
;
...
@@ -34,8 +38,8 @@ describe('vue_shared/components/confirm_modal', () => {
...
@@ -34,8 +38,8 @@ describe('vue_shared/components/confirm_modal', () => {
...
defaultProps
,
...
defaultProps
,
...
props
,
...
props
,
},
},
method
s
:
{
stub
s
:
{
...
actionSpies
,
GlModal
:
GlModalStub
,
},
},
});
});
};
};
...
@@ -44,7 +48,7 @@ describe('vue_shared/components/confirm_modal', () => {
...
@@ -44,7 +48,7 @@ describe('vue_shared/components/confirm_modal', () => {
wrapper
.
destroy
();
wrapper
.
destroy
();
});
});
const
findModal
=
()
=>
wrapper
.
find
(
GlModal
);
const
findModal
=
()
=>
wrapper
.
find
(
GlModal
Stub
);
const
findForm
=
()
=>
wrapper
.
find
(
'
form
'
);
const
findForm
=
()
=>
wrapper
.
find
(
'
form
'
);
const
findFormData
=
()
=>
const
findFormData
=
()
=>
findForm
()
findForm
()
...
@@ -103,7 +107,7 @@ describe('vue_shared/components/confirm_modal', () => {
...
@@ -103,7 +107,7 @@ describe('vue_shared/components/confirm_modal', () => {
});
});
it
(
'
does not close modal
'
,
()
=>
{
it
(
'
does not close modal
'
,
()
=>
{
expect
(
actionSpies
.
closeModal
).
not
.
toHaveBeenCalled
();
expect
(
popupMethods
.
hide
).
not
.
toHaveBeenCalled
();
});
});
describe
(
'
when modal closed
'
,
()
=>
{
describe
(
'
when modal closed
'
,
()
=>
{
...
@@ -112,7 +116,7 @@ describe('vue_shared/components/confirm_modal', () => {
...
@@ -112,7 +116,7 @@ describe('vue_shared/components/confirm_modal', () => {
});
});
it
(
'
closes modal
'
,
()
=>
{
it
(
'
closes modal
'
,
()
=>
{
expect
(
actionSpies
.
closeModal
).
toHaveBeenCalled
();
expect
(
popupMethods
.
hide
).
toHaveBeenCalled
();
});
});
});
});
});
});
...
...
spec/frontend/vue_shared/components/diff_viewer/viewers/renamed_spec.js
View file @
de531b4f
...
@@ -14,19 +14,13 @@ import {
...
@@ -14,19 +14,13 @@ import {
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
function
createRenamedComponent
({
function
createRenamedComponent
({
props
=
{},
store
=
new
Vuex
.
Store
({}),
deep
=
false
})
{
props
=
{},
methods
=
{},
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
,
localVue
,
store
,
store
,
methods
,
});
});
}
}
...
@@ -258,25 +252,17 @@ describe('Renamed Diff Viewer', () => {
...
@@ -258,25 +252,17 @@ describe('Renamed Diff Viewer', () => {
'
includes a link to the full file for alternate viewer type "$altType"
'
,
'
includes a link to the full file for alternate viewer type "$altType"
'
,
({
altType
,
linkText
})
=>
{
({
altType
,
linkText
})
=>
{
const
file
=
{
...
diffFile
};
const
file
=
{
...
diffFile
};
const
clickMock
=
jest
.
fn
().
mockImplementation
(()
=>
{});
file
.
alternate_viewer
.
name
=
altType
;
file
.
alternate_viewer
.
name
=
altType
;
wrapper
=
createRenamedComponent
({
wrapper
=
createRenamedComponent
({
deep
:
true
,
deep
:
true
,
props
:
{
diffFile
:
file
},
props
:
{
diffFile
:
file
},
methods
:
{
clickLink
:
clickMock
,
},
});
});
const
link
=
wrapper
.
find
(
'
a
'
);
const
link
=
wrapper
.
find
(
'
a
'
);
expect
(
link
.
text
()).
toEqual
(
linkText
);
expect
(
link
.
text
()).
toEqual
(
linkText
);
expect
(
link
.
attributes
(
'
href
'
)).
toEqual
(
DIFF_FILE_VIEW_PATH
);
expect
(
link
.
attributes
(
'
href
'
)).
toEqual
(
DIFF_FILE_VIEW_PATH
);
link
.
vm
.
$emit
(
'
click
'
);
expect
(
clickMock
).
toHaveBeenCalled
();
},
},
);
);
});
});
...
...
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