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
84917c8c
Commit
84917c8c
authored
Dec 01, 2021
by
NataliaTepluhina
Committed by
Natalia Tepluhina
Dec 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a spec for focusing input
parent
b2c2a62e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_spec.js
...ts/sidebar/labels_select_widget/dropdown_contents_spec.js
+23
-3
No files found.
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_spec.js
View file @
84917c8c
...
...
@@ -10,6 +10,7 @@ import DropdownFooter from '~/vue_shared/components/sidebar/labels_select_widget
import
{
mockLabels
}
from
'
./mock_data
'
;
const
showDropdown
=
jest
.
fn
();
const
focusInput
=
jest
.
fn
();
const
GlDropdownStub
=
{
template
:
`
...
...
@@ -25,6 +26,15 @@ const GlDropdownStub = {
},
};
const
DropdownHeaderStub
=
{
template
:
`
<div>Hello, I am a header</div>
`
,
methods
:
{
focusInput
,
},
};
describe
(
'
DropdownContent
'
,
()
=>
{
let
wrapper
;
...
...
@@ -52,6 +62,7 @@ describe('DropdownContent', () => {
},
stubs
:
{
GlDropdown
:
GlDropdownStub
,
DropdownHeader
:
DropdownHeaderStub
,
},
});
};
...
...
@@ -62,7 +73,7 @@ describe('DropdownContent', () => {
const
findCreateView
=
()
=>
wrapper
.
findComponent
(
DropdownContentsCreateView
);
const
findLabelsView
=
()
=>
wrapper
.
findComponent
(
DropdownContentsLabelsView
);
const
findDropdownHeader
=
()
=>
wrapper
.
findComponent
(
DropdownHeader
);
const
findDropdownHeader
=
()
=>
wrapper
.
findComponent
(
DropdownHeader
Stub
);
const
findDropdownFooter
=
()
=>
wrapper
.
findComponent
(
DropdownFooter
);
const
findDropdown
=
()
=>
wrapper
.
findComponent
(
GlDropdownStub
);
...
...
@@ -135,11 +146,20 @@ describe('DropdownContent', () => {
it
(
'
sets searchKey for labels view on input event from header
'
,
async
()
=>
{
createComponent
();
expect
(
wrapper
.
vm
.
searchKey
).
toEqual
(
''
);
expect
(
findLabelsView
().
props
(
'
searchKey
'
)).
toBe
(
''
);
findDropdownHeader
().
vm
.
$emit
(
'
input
'
,
'
123
'
);
await
nextTick
();
expect
(
findLabelsView
().
props
(
'
searchKey
'
)).
toEqual
(
'
123
'
);
expect
(
findLabelsView
().
props
(
'
searchKey
'
)).
toBe
(
'
123
'
);
});
it
(
'
clears and focuses search input on selecting a label
'
,
()
=>
{
createComponent
();
findDropdownHeader
().
vm
.
$emit
(
'
input
'
,
'
123
'
);
findLabelsView
().
vm
.
$emit
(
'
selectLabel
'
);
expect
(
findLabelsView
().
props
(
'
searchKey
'
)).
toBe
(
''
);
expect
(
focusInput
).
toHaveBeenCalled
();
});
describe
(
'
Create view
'
,
()
=>
{
...
...
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