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
479c8216
Commit
479c8216
authored
Mar 19, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate cycle-analytics/banner_spec to VTU
parent
de555479
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
22 deletions
+24
-22
spec/frontend/cycle_analytics/banner_spec.js
spec/frontend/cycle_analytics/banner_spec.js
+24
-22
No files found.
spec/frontend/cycle_analytics/banner_spec.js
View file @
479c8216
import
Vue
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
Banner
from
'
~/cycle_analytics/components/banner.vue
'
;
import
banner
from
'
~/cycle_analytics/components/banner.vue
'
;
describe
(
'
Value Stream Analytics banner
'
,
()
=>
{
describe
(
'
Value Stream Analytics banner
'
,
()
=>
{
let
vm
;
let
wrapper
;
beforeEach
(()
=>
{
const
createComponent
=
()
=>
{
const
Component
=
Vue
.
extend
(
banner
);
wrapper
=
shallowMount
(
Banner
,
{
vm
=
mountComponent
(
Component
,
{
propsData
:
{
documentationLink
:
'
path
'
,
documentationLink
:
'
path
'
,
},
});
});
};
beforeEach
(()
=>
{
createComponent
();
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
vm
.
$
destroy
();
wrapper
.
destroy
();
});
});
it
(
'
should render value stream analytics information
'
,
()
=>
{
it
(
'
should render value stream analytics information
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
h4
'
).
textContent
.
trim
()).
toEqual
(
expect
(
wrapper
.
find
(
'
h4
'
).
text
().
trim
()).
toBe
(
'
Introducing Value Stream Analytics
'
);
'
Introducing Value Stream Analytics
'
,
);
expect
(
expect
(
vm
.
$el
wrapper
.
querySelector
(
'
p
'
)
.
find
(
'
p
'
)
.
textContent
.
trim
()
.
text
()
.
trim
()
.
replace
(
/
[\r\n]
+/g
,
'
'
),
.
replace
(
/
[\r\n]
+/g
,
'
'
),
).
toContain
(
).
toContain
(
'
Value Stream Analytics gives an overview of how much time it takes to go from idea to production in your project.
'
,
'
Value Stream Analytics gives an overview of how much time it takes to go from idea to production in your project.
'
,
);
);
expect
(
vm
.
$el
.
querySelector
(
'
a
'
).
textContent
.
trim
()).
toEqual
(
'
Read more
'
);
expect
(
wrapper
.
find
(
'
a
'
).
text
().
trim
()).
toBe
(
'
Read more
'
);
expect
(
wrapper
.
find
(
'
a
'
).
attributes
(
'
href
'
)).
toBe
(
'
path
'
);
expect
(
vm
.
$el
.
querySelector
(
'
a
'
).
getAttribute
(
'
href
'
)).
toEqual
(
'
path
'
);
});
});
it
(
'
should emit an event when close button is clicked
'
,
()
=>
{
it
(
'
should emit an event when close button is clicked
'
,
async
()
=>
{
jest
.
spyOn
(
vm
,
'
$emit
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
wrapper
.
vm
,
'
$emit
'
).
mockImplementation
(()
=>
{});
vm
.
$el
.
querySelector
(
'
.js-ca-dismiss-button
'
).
click
(
);
await
wrapper
.
find
(
'
.js-ca-dismiss-button
'
).
trigger
(
'
click
'
);
expect
(
vm
.
$emit
).
toHaveBeenCalled
();
expect
(
wrapper
.
vm
.
$emit
).
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