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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
34d53d2b
Commit
34d53d2b
authored
Oct 26, 2017
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add failing test for
https://gitlab.com/gitlab-org/gitlab-ce/issues/37277
parent
46259f74
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
spec/javascripts/namespace_select_spec.js
spec/javascripts/namespace_select_spec.js
+65
-0
No files found.
spec/javascripts/namespace_select_spec.js
0 → 100644
View file @
34d53d2b
import
NamespaceSelect
from
'
~/namespace_select
'
;
describe
(
'
NamespaceSelect
'
,
()
=>
{
beforeEach
(()
=>
{
spyOn
(
$
.
fn
,
'
glDropdown
'
);
});
it
(
'
initializes glDropdown
'
,
()
=>
{
const
dropdown
=
document
.
createElement
(
'
div
'
);
// eslint-disable-next-line no-new
new
NamespaceSelect
({
dropdown
});
expect
(
$
.
fn
.
glDropdown
).
toHaveBeenCalled
();
});
describe
(
'
as input
'
,
()
=>
{
let
glDropdownOptions
;
beforeEach
(()
=>
{
const
dropdown
=
document
.
createElement
(
'
div
'
);
// eslint-disable-next-line no-new
new
NamespaceSelect
({
dropdown
});
glDropdownOptions
=
$
.
fn
.
glDropdown
.
calls
.
argsFor
(
0
)[
0
];
});
it
(
'
prevents click events
'
,
()
=>
{
const
dummyEvent
=
new
Event
(
'
dummy
'
);
spyOn
(
dummyEvent
,
'
preventDefault
'
);
glDropdownOptions
.
clicked
({
e
:
dummyEvent
});
expect
(
dummyEvent
.
preventDefault
).
toHaveBeenCalled
();
});
});
describe
(
'
as filter
'
,
()
=>
{
let
glDropdownOptions
;
beforeEach
(()
=>
{
const
dropdown
=
document
.
createElement
(
'
div
'
);
dropdown
.
dataset
.
isFilter
=
'
true
'
;
// eslint-disable-next-line no-new
new
NamespaceSelect
({
dropdown
});
glDropdownOptions
=
$
.
fn
.
glDropdown
.
calls
.
argsFor
(
0
)[
0
];
});
it
(
'
does not prevent click events
'
,
()
=>
{
const
dummyEvent
=
new
Event
(
'
dummy
'
);
spyOn
(
dummyEvent
,
'
preventDefault
'
);
glDropdownOptions
.
clicked
({
e
:
dummyEvent
});
expect
(
dummyEvent
.
preventDefault
).
not
.
toHaveBeenCalled
();
});
it
(
'
sets URL of dropdown items
'
,
()
=>
{
const
dummyNamespace
=
{
id
:
'
eal
'
};
const
itemUrl
=
glDropdownOptions
.
url
(
dummyNamespace
);
expect
(
itemUrl
).
toContain
(
`namespace_id=
${
dummyNamespace
.
id
}
`
);
});
});
});
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