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
0012a6cc
Commit
0012a6cc
authored
Dec 11, 2021
by
Paul Gascou-Vaillancourt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop setProps usage
parent
d703847e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
ee/spec/frontend/on_demand_scans/components/action_button_spec.js
...frontend/on_demand_scans/components/action_button_spec.js
+11
-7
No files found.
ee/spec/frontend/on_demand_scans/components/action_button_spec.js
View file @
0012a6cc
...
...
@@ -13,24 +13,22 @@ describe('ActionButton', () => {
const
findButton
=
()
=>
wrapper
.
findComponent
(
GlButton
);
const
findTooltip
=
()
=>
wrapper
.
findComponent
(
GlTooltip
);
const
createComponent
=
()
=>
{
const
createComponent
=
(
props
=
{}
)
=>
{
wrapper
=
shallowMountExtended
(
ActionButton
,
{
propsData
:
{
actionType
,
label
,
...
props
,
},
});
};
beforeEach
(()
=>
{
createComponent
();
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
renders a button with a tooltip attached
'
,
()
=>
{
createComponent
();
const
button
=
findButton
();
const
tooltip
=
findTooltip
();
...
...
@@ -40,11 +38,13 @@ describe('ActionButton', () => {
});
it
(
'
sets the label on the button and in the tooltip
'
,
()
=>
{
createComponent
();
expect
(
findButton
().
attributes
(
'
aria-label
'
)).
toBe
(
label
);
expect
(
findTooltip
().
text
()).
toBe
(
label
);
});
it
(
'
emits bv::hide::tooltip and click events on click
'
,
()
=>
{
createComponent
();
jest
.
spyOn
(
wrapper
.
vm
.
$root
,
'
$emit
'
);
findButton
().
vm
.
$emit
(
'
click
'
);
...
...
@@ -52,10 +52,14 @@ describe('ActionButton', () => {
expect
(
wrapper
.
emitted
(
'
click
'
)).
toHaveLength
(
1
);
});
it
(
'
passes the loading state down to the button
'
,
async
()
=>
{
it
(
'
does not set the loading state by default
'
,
()
=>
{
createComponent
();
expect
(
findButton
().
props
(
'
loading
'
)).
toBe
(
false
);
});
await
wrapper
.
setProps
({
isLoading
:
true
});
it
(
'
passes the loading state down to the button
'
,
async
()
=>
{
createComponent
({
isLoading
:
true
});
expect
(
findButton
().
props
(
'
loading
'
)).
toBe
(
true
);
});
...
...
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