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
4b01f494
Commit
4b01f494
authored
Sep 05, 2019
by
Thomas Randolph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update tests for uncovered cases
Cases tested: - Separator - Divider - Header
parent
23993e8c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
5 deletions
+43
-5
ee/spec/frontend/pages/admin/application_settings/ci_cd/ci_template_spec.js
...ages/admin/application_settings/ci_cd/ci_template_spec.js
+1
-1
spec/javascripts/gl_dropdown_spec.js
spec/javascripts/gl_dropdown_spec.js
+42
-4
No files found.
ee/spec/frontend/pages/admin/application_settings/ci_cd/ci_template_spec.js
View file @
4b01f494
...
...
@@ -38,7 +38,7 @@ describe('CI Template Dropdown (ee/pages/admin/application_settings/ci_cd/ci_tem
describe
(
'
Format dropdown list
'
,
()
=>
{
it
(
'
Adds a reset option and divider
'
,
()
=>
{
const
expected
=
{
Reset
:
[{
name
:
'
No required pipeline
'
,
id
:
null
},
'
divider
'
],
Reset
:
[{
name
:
'
No required pipeline
'
,
id
:
null
},
{
type
:
'
divider
'
}
],
...
DROPDOWN_DATA
,
};
const
actual
=
CiTemplateInstance
.
formatDropdownList
();
...
...
spec/javascripts/gl_dropdown_spec.js
View file @
4b01f494
...
...
@@ -243,14 +243,23 @@ describe('glDropdown', function describeDropdown() {
});
describe
(
'
renderItem
'
,
()
=>
{
function
dropdownWithOptions
(
options
)
{
const
$dropdownDiv
=
$
(
'
<div />
'
);
$dropdownDiv
.
glDropdown
(
options
);
return
$dropdownDiv
.
data
(
'
glDropdown
'
);
}
function
basicDropdown
()
{
return
dropdownWithOptions
({});
}
describe
(
'
without selected value
'
,
()
=>
{
let
dropdown
;
beforeEach
(()
=>
{
const
dropdownOptions
=
{};
const
$dropdownDiv
=
$
(
'
<div />
'
);
$dropdownDiv
.
glDropdown
(
dropdownOptions
);
dropdown
=
$dropdownDiv
.
data
(
'
glDropdown
'
);
dropdown
=
basicDropdown
();
});
it
(
'
marks items without ID as active
'
,
()
=>
{
...
...
@@ -275,6 +284,35 @@ describe('glDropdown', function describeDropdown() {
expect
(
link
).
not
.
toHaveClass
(
'
is-active
'
);
});
});
it
(
'
should return an empty .separator li when when appropriate
'
,
()
=>
{
const
dropdown
=
basicDropdown
();
const
sep
=
{
type
:
'
separator
'
};
const
li
=
dropdown
.
renderItem
(
sep
);
expect
(
li
).
toHaveClass
(
'
separator
'
);
expect
(
li
.
childNodes
.
length
).
toEqual
(
0
);
});
it
(
'
should return an empty .divider li when when appropriate
'
,
()
=>
{
const
dropdown
=
basicDropdown
();
const
div
=
{
type
:
'
divider
'
};
const
li
=
dropdown
.
renderItem
(
div
);
expect
(
li
).
toHaveClass
(
'
divider
'
);
expect
(
li
.
childNodes
.
length
).
toEqual
(
0
);
});
it
(
'
should return a .dropdown-header li with the correct content when when appropriate
'
,
()
=>
{
const
dropdown
=
basicDropdown
();
const
text
=
'
My Header
'
;
const
header
=
{
type
:
'
header
'
,
content
:
text
};
const
li
=
dropdown
.
renderItem
(
header
);
expect
(
li
).
toHaveClass
(
'
dropdown-header
'
);
expect
(
li
.
childNodes
.
length
).
toEqual
(
1
);
expect
(
li
.
textContent
).
toEqual
(
text
);
});
});
it
(
'
should keep selected item after selecting a second time
'
,
()
=>
{
...
...
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