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
6ff5e0c3
Commit
6ff5e0c3
authored
Oct 17, 2017
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated icon.vue to be more inline with other components + added spec for it
parent
3f315370
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
8 deletions
+49
-8
app/assets/javascripts/vue_shared/components/ci_badge_link.vue
...ssets/javascripts/vue_shared/components/ci_badge_link.vue
+0
-1
app/assets/javascripts/vue_shared/components/icon.vue
app/assets/javascripts/vue_shared/components/icon.vue
+4
-7
spec/javascripts/vue_shared/components/icon_spec.js
spec/javascripts/vue_shared/components/icon_spec.js
+45
-0
No files found.
app/assets/javascripts/vue_shared/components/ci_badge_link.vue
View file @
6ff5e0c3
...
...
@@ -43,7 +43,6 @@
computed
:
{
cssClass
()
{
const
className
=
this
.
status
.
group
;
return
className
?
`ci-status ci-
${
className
}
`
:
'
ci-status
'
;
},
},
...
...
app/assets/javascripts/vue_shared/components/icon.vue
View file @
6ff5e0c3
...
...
@@ -13,7 +13,6 @@
/>
*/
export
default
{
props
:
{
name
:
{
...
...
@@ -27,7 +26,7 @@
default
:
0
,
},
cssClass
:
{
cssClass
es
:
{
type
:
String
,
required
:
false
,
default
:
''
,
...
...
@@ -38,17 +37,15 @@
spriteHref
()
{
return
`
${
gon
.
sprite_icons
}
#
${
this
.
name
}
`
;
},
fullCssClass
()
{
let
classString
=
''
||
this
.
cssClass
;
if
(
this
.
size
)
classString
+=
`s
${
this
.
size
}
`
;
return
classString
;
iconSizeClass
()
{
return
this
.
size
?
`s
${
this
.
size
}
`
:
''
;
},
},
};
</
script
>
<
template
>
<svg
:class=
"
fullCssClass
"
>
:class=
"
[iconSizeClass, cssClasses]
"
>
<use
v-bind=
"
{'xlink:href':spriteHref}"/>
</svg>
...
...
spec/javascripts/vue_shared/components/icon_spec.js
0 → 100644
View file @
6ff5e0c3
import
Vue
from
'
vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
const
IconComponent
=
Vue
.
extend
(
Icon
);
fdescribe
(
'
Sprite Icon Component
'
,
function
()
{
describe
(
'
Initialization
'
,
function
()
{
beforeEach
(
function
()
{
this
.
propsData
=
{
name
:
'
test
'
,
size
:
99
,
cssClasses
:
'
extraclasses
'
,
};
this
.
icon
=
new
IconComponent
({
propsData
:
this
.
propsData
,
}).
$mount
();
});
it
(
'
should return a defined Vue component
'
,
function
()
{
expect
(
this
.
icon
).
toBeDefined
();
});
it
(
'
should have <svg> as a child element
'
,
function
()
{
expect
(
this
.
icon
.
$el
.
tagName
).
toBe
(
'
svg
'
);
});
it
(
'
should have <use> as a child element with the correct href
'
,
function
()
{
expect
(
this
.
icon
.
$el
.
firstChild
.
tagName
).
toBe
(
'
use
'
);
expect
(
this
.
icon
.
$el
.
firstChild
.
getAttribute
(
'
xlink:href
'
)).
toBe
(
`
${
gon
.
sprite_icons
}
#test`
);
});
it
(
'
should properly compute iconSizeClass
'
,
function
()
{
expect
(
this
.
icon
.
iconSizeClass
).
toBe
(
'
s99
'
);
});
it
(
'
should properly render img css
'
,
function
()
{
const
classList
=
this
.
icon
.
$el
.
classList
;
const
containsSizeClass
=
classList
.
contains
(
'
s99
'
);
const
containsCustomClass
=
classList
.
contains
(
'
extraclasses
'
);
expect
(
containsSizeClass
).
toBe
(
true
);
expect
(
containsCustomClass
).
toBe
(
true
);
});
});
});
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