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
bf3eff86
Commit
bf3eff86
authored
Oct 21, 2021
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Labels widget - Fix search input
Review feedback
parent
fa7d3e3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
23 deletions
+29
-23
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_spec.js
...ts/sidebar/labels_select_widget/dropdown_contents_spec.js
+2
-2
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_header_spec.js
...ents/sidebar/labels_select_widget/dropdown_header_spec.js
+27
-21
No files found.
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_spec.js
View file @
bf3eff86
...
...
@@ -130,14 +130,14 @@ describe('DropdownContent', () => {
expect
(
findDropdownHeader
().
exists
()).
toBe
(
true
);
});
it
(
'
sets searchKey on input event from header
'
,
async
()
=>
{
it
(
'
sets searchKey
for labels view
on input event from header
'
,
async
()
=>
{
createComponent
();
expect
(
wrapper
.
vm
.
searchKey
).
toEqual
(
''
);
findDropdownHeader
().
vm
.
$emit
(
'
input
'
,
'
123
'
);
await
nextTick
();
expect
(
wrapper
.
vm
.
searchKey
).
toEqual
(
'
123
'
);
expect
(
findLabelsView
().
props
(
'
searchKey
'
)
).
toEqual
(
'
123
'
);
});
describe
(
'
Create view
'
,
()
=>
{
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_header_spec.js
View file @
bf3eff86
import
{
GlSearchBoxByType
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
DropdownHeader
from
'
~/vue_shared/components/sidebar/labels_select_widget/dropdown_header.vue
'
;
describe
(
'
DropdownHeader
'
,
()
=>
{
...
...
@@ -9,18 +10,20 @@ describe('DropdownHeader', () => {
showDropdownContentsCreateView
=
false
,
labelsFetchInProgress
=
false
,
}
=
{})
=>
{
wrapper
=
shallowMount
(
DropdownHeader
,
{
propsData
:
{
showDropdownContentsCreateView
,
labelsFetchInProgress
,
labelsCreateTitle
:
'
Create label
'
,
labelsListTitle
:
'
Select label
'
,
searchKey
:
''
,
},
stubs
:
{
GlSearchBoxByType
,
},
});
wrapper
=
extendedWrapper
(
shallowMount
(
DropdownHeader
,
{
propsData
:
{
showDropdownContentsCreateView
,
labelsFetchInProgress
,
labelsCreateTitle
:
'
Create label
'
,
labelsListTitle
:
'
Select label
'
,
searchKey
:
''
,
},
stubs
:
{
GlSearchBoxByType
,
},
}),
);
};
afterEach
(()
=>
{
...
...
@@ -28,7 +31,7 @@ describe('DropdownHeader', () => {
});
const
findSearchInput
=
()
=>
wrapper
.
findComponent
(
GlSearchBoxByType
);
const
findGoBackButton
=
()
=>
wrapper
.
find
(
'
[data-testid="go-back-button"]
'
);
const
findGoBackButton
=
()
=>
wrapper
.
find
ByTestId
(
'
go-back-button
'
);
beforeEach
(()
=>
{
createComponent
();
...
...
@@ -57,13 +60,16 @@ describe('DropdownHeader', () => {
expect
(
findGoBackButton
().
exists
()).
toBe
(
false
);
});
it
(
'
when loading labels - renders disabled search input field
'
,
async
()
=>
{
createComponent
({
labelsFetchInProgress
:
true
});
expect
(
findSearchInput
().
props
(
'
disabled
'
)).
toBe
(
true
);
});
it
(
'
when labels are loaded - renders enabled search input field
'
,
async
()
=>
{
expect
(
findSearchInput
().
props
(
'
disabled
'
)).
toBe
(
false
);
});
it
.
each
`
labelsFetchInProgress | disabled
${
true
}
|
${
true
}
${
false
}
|
${
false
}
`
(
'
when labelsFetchInProgress is $labelsFetchInProgress, renders search input with disabled prop to $disabled
'
,
({
labelsFetchInProgress
,
disabled
})
=>
{
createComponent
({
labelsFetchInProgress
});
expect
(
findSearchInput
().
props
(
'
disabled
'
)).
toBe
(
disabled
);
},
);
});
});
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