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
8da4fff9
Commit
8da4fff9
authored
Aug 30, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update some tests
parent
1ae579f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
48 deletions
+113
-48
spec/javascripts/api_spec.js
spec/javascripts/api_spec.js
+21
-0
spec/javascripts/boards/issue_card_spec.js
spec/javascripts/boards/issue_card_spec.js
+92
-48
No files found.
spec/javascripts/api_spec.js
View file @
8da4fff9
...
...
@@ -143,6 +143,27 @@ describe('Api', () => {
done
();
});
});
it
(
'
creates a new group label
'
,
(
done
)
=>
{
const
namespace
=
'
some namespace
'
;
const
labelData
=
{
some
:
'
data
'
};
const
expectedUrl
=
`
${
dummyUrlRoot
}
/groups/
${
namespace
}
/labels`
;
const
expectedData
=
{
label
:
labelData
,
};
spyOn
(
jQuery
,
'
ajax
'
).
and
.
callFake
((
request
)
=>
{
expect
(
request
.
url
).
toEqual
(
expectedUrl
);
expect
(
request
.
dataType
).
toEqual
(
'
json
'
);
expect
(
request
.
type
).
toEqual
(
'
POST
'
);
expect
(
request
.
data
).
toEqual
(
expectedData
);
return
sendDummyResponse
();
});
Api
.
newLabel
(
namespace
,
null
,
labelData
,
(
response
)
=>
{
expect
(
response
).
toBe
(
dummyResponse
);
done
();
});
});
});
describe
(
'
groupProjects
'
,
()
=>
{
...
...
spec/javascripts/boards/issue_card_spec.js
View file @
8da4fff9
...
...
@@ -52,6 +52,7 @@ describe('Issue card component', () => {
issue
,
issueLinkBase
:
'
/test
'
,
rootPath
:
'
/
'
,
groupId
:
null
,
};
},
components
:
{
...
...
@@ -61,6 +62,7 @@ describe('Issue card component', () => {
<issue-card
:issue="issue"
:list="list"
:group-id="groupId"
:issue-link-base="issueLinkBase"
:root-path="rootPath"></issue-card>
`
,
...
...
@@ -239,65 +241,107 @@ describe('Issue card component', () => {
});
describe
(
'
labels
'
,
()
=>
{
describe
(
'
exists
'
,
()
=>
{
beforeEach
((
done
)
=>
{
component
.
issue
.
addLabel
(
label1
);
beforeEach
((
done
)
=>
{
component
.
issue
.
addLabel
(
label1
);
Vue
.
nextTick
(()
=>
done
());
});
Vue
.
nextTick
(()
=>
done
());
});
it
(
'
renders list label
'
,
()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
.label
'
).
length
,
).
toBe
(
2
);
it
(
'
renders list label
'
,
()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
.label
'
).
length
,
).
toBe
(
2
);
});
it
(
'
renders label
'
,
()
=>
{
const
nodes
=
[];
component
.
$el
.
querySelectorAll
(
'
.label
'
).
forEach
((
label
)
=>
{
nodes
.
push
(
label
.
title
);
});
it
(
'
renders label
'
,
()
=>
{
const
nodes
=
[];
component
.
$el
.
querySelectorAll
(
'
.label
'
).
forEach
((
label
)
=>
{
nodes
.
push
(
label
.
title
);
});
expect
(
nodes
.
includes
(
label1
.
description
),
).
toBe
(
true
);
});
expect
(
nodes
.
includes
(
label1
.
description
),
).
toBe
(
true
);
});
it
(
'
sets label description as title
'
,
()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.label
'
).
getAttribute
(
'
title
'
),
).
toContain
(
label1
.
description
);
});
it
(
'
sets label description as title
'
,
()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.label
'
).
getAttribute
(
'
title
'
),
).
toContain
(
label1
.
description
);
it
(
'
sets background color of button
'
,
()
=>
{
const
nodes
=
[];
component
.
$el
.
querySelectorAll
(
'
.label
'
).
forEach
((
label
)
=>
{
nodes
.
push
(
label
.
style
.
backgroundColor
);
});
it
(
'
sets background color of button
'
,
()
=>
{
const
nodes
=
[];
component
.
$el
.
querySelectorAll
(
'
.label
'
).
forEach
((
label
)
=>
{
nodes
.
push
(
label
.
style
.
backgroundColor
);
});
expect
(
nodes
.
includes
(
label1
.
color
),
).
toBe
(
true
);
});
expect
(
nodes
.
includes
(
label1
.
color
),
).
toBe
(
true
);
});
it
(
'
does not render label if label does not have an ID
'
,
(
done
)
=>
{
component
.
issue
.
addLabel
(
new
ListLabel
({
title
:
'
closed
'
,
})
)
;
it
(
'
does not render label if label does not have an ID
'
,
(
done
)
=>
{
component
.
issue
.
addLabel
(
new
ListLabel
({
title
:
'
closed
'
,
}));
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
.label
'
).
length
,
).
toBe
(
2
);
expect
(
component
.
$el
.
textContent
,
).
not
.
toContain
(
'
Closed
'
);
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
.label
'
).
length
,
).
toBe
(
2
);
expect
(
component
.
$el
.
textContent
,
).
not
.
toContain
(
'
closed
'
);
done
();
})
.
catch
(
done
.
fail
);
});
done
();
})
.
catch
(
done
.
fail
);
});
it
(
'
shows group labels on group boards
'
,
(
done
)
=>
{
component
.
issue
.
addLabel
(
new
ListLabel
({
id
:
_
.
random
(
10000
),
title
:
'
Group label
'
,
type
:
'
GroupLabel
'
,
}));
component
.
groupId
=
1
;
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
.label
'
).
length
,
).
toBe
(
3
);
expect
(
component
.
$el
.
textContent
,
).
toContain
(
'
Group label
'
);
done
();
})
.
catch
(
done
.
fail
);
});
it
(
'
does not show project labels on group boards
'
,
(
done
)
=>
{
component
.
issue
.
addLabel
(
new
ListLabel
({
id
:
123
,
title
:
'
Project label
'
,
type
:
'
ProjectLabel
'
,
}));
component
.
groupId
=
1
;
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
component
.
$el
.
querySelectorAll
(
'
.label
'
).
length
,
).
toBe
(
2
);
expect
(
component
.
$el
.
textContent
,
).
not
.
toContain
(
'
Project label
'
);
done
();
})
.
catch
(
done
.
fail
);
});
});
});
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