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
a2537e0f
Commit
a2537e0f
authored
Mar 12, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate review_app_link_spec to VTU
parent
195d5f87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
spec/frontend/vue_mr_widget/components/review_app_link_spec.js
...frontend/vue_mr_widget/components/review_app_link_spec.js
+11
-15
No files found.
spec/frontend/vue_mr_widget/components/review_app_link_spec.js
View file @
a2537e0f
import
Vue
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
mockTracking
,
triggerEvent
}
from
'
helpers/tracking_helper
'
;
import
{
mockTracking
,
triggerEvent
}
from
'
helpers/tracking_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
ReviewAppLink
from
'
~/vue_merge_request_widget/components/review_app_link.vue
'
;
import
component
from
'
~/vue_merge_request_widget/components/review_app_link.vue
'
;
describe
(
'
review app link
'
,
()
=>
{
describe
(
'
review app link
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
component
);
const
props
=
{
const
props
=
{
link
:
'
/review
'
,
link
:
'
/review
'
,
cssClass
:
'
js-link
'
,
cssClass
:
'
js-link
'
,
...
@@ -13,37 +11,35 @@ describe('review app link', () => {
...
@@ -13,37 +11,35 @@ describe('review app link', () => {
tooltip
:
''
,
tooltip
:
''
,
},
},
};
};
let
vm
;
let
wrapper
;
let
el
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
props
);
wrapper
=
shallowMount
(
ReviewAppLink
,
{
propsData
:
props
});
el
=
vm
.
$el
;
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
vm
.
$
destroy
();
wrapper
.
destroy
();
});
});
it
(
'
renders provided link as href attribute
'
,
()
=>
{
it
(
'
renders provided link as href attribute
'
,
()
=>
{
expect
(
el
.
getAttribute
(
'
href
'
)).
toEqual
(
props
.
link
);
expect
(
wrapper
.
attributes
(
'
href
'
)).
toBe
(
props
.
link
);
});
});
it
(
'
renders provided cssClass as class attribute
'
,
()
=>
{
it
(
'
renders provided cssClass as class attribute
'
,
()
=>
{
expect
(
el
.
getAttribute
(
'
class
'
)).
toContain
(
props
.
cssClass
);
expect
(
wrapper
.
classes
(
'
js-link
'
)).
toBe
(
true
);
});
});
it
(
'
renders View app text
'
,
()
=>
{
it
(
'
renders View app text
'
,
()
=>
{
expect
(
el
.
textContent
.
trim
()).
toEqual
(
'
View app
'
);
expect
(
wrapper
.
text
().
trim
()).
toBe
(
'
View app
'
);
});
});
it
(
'
renders svg icon
'
,
()
=>
{
it
(
'
renders svg icon
'
,
()
=>
{
expect
(
el
.
querySelector
(
'
svg
'
)).
not
.
toBeNull
();
expect
(
wrapper
.
find
(
'
svg
'
)).
not
.
toBeNull
();
});
});
it
(
'
tracks an event when clicked
'
,
()
=>
{
it
(
'
tracks an event when clicked
'
,
()
=>
{
const
spy
=
mockTracking
(
'
_category_
'
,
el
,
jest
.
spyOn
);
const
spy
=
mockTracking
(
'
_category_
'
,
wrapper
.
element
,
jest
.
spyOn
);
triggerEvent
(
el
);
triggerEvent
(
wrapper
.
element
);
expect
(
spy
).
toHaveBeenCalledWith
(
'
_category_
'
,
'
open_review_app
'
,
{
expect
(
spy
).
toHaveBeenCalledWith
(
'
_category_
'
,
'
open_review_app
'
,
{
label
:
'
review_app
'
,
label
:
'
review_app
'
,
...
...
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