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
Jérome Perrin
gitlab-ce
Commits
0232cabc
Commit
0232cabc
authored
Aug 30, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
puts back `function` statements
parent
4342f81a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
spec/javascripts/project_select_combo_button_spec.js
spec/javascripts/project_select_combo_button_spec.js
+20
-20
No files found.
spec/javascripts/project_select_combo_button_spec.js
View file @
0232cabc
...
...
@@ -2,10 +2,10 @@ import ProjectSelectComboButton from '~/project_select_combo_button';
const
fixturePath
=
'
static/project_select_combo_button.html.raw
'
;
describe
(
'
Project Select Combo Button
'
,
()
=>
{
describe
(
'
Project Select Combo Button
'
,
function
()
{
preloadFixtures
(
fixturePath
);
beforeEach
(
()
=>
{
beforeEach
(
function
()
{
this
.
defaults
=
{
label
:
'
Select project to create issue
'
,
groupId
:
12345
,
...
...
@@ -27,43 +27,43 @@ describe('Project Select Combo Button', () => {
this
.
projectSelectInput
=
document
.
querySelector
(
'
.project-item-select
'
);
});
describe
(
'
on page load when localStorage is empty
'
,
()
=>
{
beforeEach
(
()
=>
{
describe
(
'
on page load when localStorage is empty
'
,
function
()
{
beforeEach
(
function
()
{
this
.
comboButton
=
new
ProjectSelectComboButton
(
this
.
projectSelectInput
);
});
it
(
'
newItemBtn href is null
'
,
()
=>
{
it
(
'
newItemBtn href is null
'
,
function
()
{
expect
(
this
.
newItemBtn
.
getAttribute
(
'
href
'
)).
toBe
(
''
);
});
it
(
'
newItemBtn text is the plain default label
'
,
()
=>
{
it
(
'
newItemBtn text is the plain default label
'
,
function
()
{
expect
(
this
.
newItemBtn
.
textContent
).
toBe
(
this
.
defaults
.
label
);
});
});
describe
(
'
on page load when localStorage is filled
'
,
()
=>
{
beforeEach
(
()
=>
{
describe
(
'
on page load when localStorage is filled
'
,
function
()
{
beforeEach
(
function
()
{
window
.
localStorage
.
setItem
(
this
.
defaults
.
localStorageKey
,
JSON
.
stringify
(
this
.
defaults
.
projectMeta
));
this
.
comboButton
=
new
ProjectSelectComboButton
(
this
.
projectSelectInput
);
});
it
(
'
newItemBtn href is correctly set
'
,
()
=>
{
it
(
'
newItemBtn href is correctly set
'
,
function
()
{
expect
(
this
.
newItemBtn
.
getAttribute
(
'
href
'
)).
toBe
(
this
.
defaults
.
projectMeta
.
url
);
});
it
(
'
newItemBtn text is the cached label
'
,
()
=>
{
it
(
'
newItemBtn text is the cached label
'
,
function
()
{
expect
(
this
.
newItemBtn
.
textContent
)
.
toBe
(
`New issue in
${
this
.
defaults
.
projectMeta
.
name
}
`
);
});
afterEach
(
()
=>
{
afterEach
(
function
()
{
window
.
localStorage
.
clear
();
});
});
describe
(
'
after selecting a new project
'
,
()
=>
{
beforeEach
(
()
=>
{
describe
(
'
after selecting a new project
'
,
function
()
{
beforeEach
(
function
()
{
this
.
comboButton
=
new
ProjectSelectComboButton
(
this
.
projectSelectInput
);
// mock the effect of selecting an item from the projects dropdown (select2)
...
...
@@ -72,23 +72,23 @@ describe('Project Select Combo Button', () => {
.
trigger
(
'
change
'
);
});
it
(
'
newItemBtn href is correctly set
'
,
()
=>
{
it
(
'
newItemBtn href is correctly set
'
,
function
()
{
expect
(
this
.
newItemBtn
.
getAttribute
(
'
href
'
))
.
toBe
(
'
http://myothercoolproject.com/issues/new
'
);
});
it
(
'
newItemBtn text is the selected project label
'
,
()
=>
{
it
(
'
newItemBtn text is the selected project label
'
,
function
()
{
expect
(
this
.
newItemBtn
.
textContent
)
.
toBe
(
`New issue in
${
this
.
defaults
.
newProjectMeta
.
name
}
`
);
});
afterEach
(
()
=>
{
afterEach
(
function
()
{
window
.
localStorage
.
clear
();
});
});
describe
(
'
deriveTextVariants
'
,
()
=>
{
beforeEach
(
()
=>
{
describe
(
'
deriveTextVariants
'
,
function
()
{
beforeEach
(
function
()
{
this
.
mockExecutionContext
=
{
resourceType
:
''
,
resourceLabel
:
''
,
...
...
@@ -99,7 +99,7 @@ describe('Project Select Combo Button', () => {
this
.
method
=
this
.
comboButton
.
deriveTextVariants
.
bind
(
this
.
mockExecutionContext
);
});
it
(
'
correctly derives test variants for merge requests
'
,
()
=>
{
it
(
'
correctly derives test variants for merge requests
'
,
function
()
{
this
.
mockExecutionContext
.
resourceType
=
'
merge_requests
'
;
this
.
mockExecutionContext
.
resourceLabel
=
'
New merge request
'
;
...
...
@@ -110,7 +110,7 @@ describe('Project Select Combo Button', () => {
expect
(
returnedVariants
.
presetTextSuffix
).
toBe
(
'
merge request
'
);
});
it
(
'
correctly derives text variants for issues
'
,
()
=>
{
it
(
'
correctly derives text variants for issues
'
,
function
()
{
this
.
mockExecutionContext
.
resourceType
=
'
issues
'
;
this
.
mockExecutionContext
.
resourceLabel
=
'
New issue
'
;
...
...
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