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
8c70224d
Commit
8c70224d
authored
Sep 04, 2017
by
kushalpandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for `sizeClass`, defaults to `s40`
parent
c47e1c39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
7 deletions
+29
-7
app/assets/javascripts/vue_shared/components/identicon.vue
app/assets/javascripts/vue_shared/components/identicon.vue
+7
-1
spec/javascripts/vue_shared/components/identicon_spec.js
spec/javascripts/vue_shared/components/identicon_spec.js
+22
-6
No files found.
app/assets/javascripts/vue_shared/components/identicon.vue
View file @
8c70224d
...
...
@@ -9,6 +9,11 @@ export default {
type
:
String
,
required
:
true
,
},
sizeClass
:
{
type
:
String
,
required
:
false
,
default
:
'
s40
'
,
},
},
computed
:
{
/**
...
...
@@ -38,7 +43,8 @@ export default {
<
template
>
<div
class=
"avatar s40 identicon"
class=
"avatar identicon"
:class=
"sizeClass"
:style=
"identiconStyles"
>
{{
identiconTitle
}}
</div>
...
...
spec/javascripts/vue_shared/components/identicon_spec.js
View file @
8c70224d
import
Vue
from
'
vue
'
;
import
identiconComponent
from
'
~/vue_shared/components/identicon.vue
'
;
const
createComponent
=
()
=>
{
const
createComponent
=
(
sizeClass
)
=>
{
const
Component
=
Vue
.
extend
(
identiconComponent
);
return
new
Component
({
propsData
:
{
entityId
:
1
,
entityName
:
'
entity-name
'
,
sizeClass
,
},
}).
$mount
();
};
describe
(
'
IdenticonComponent
'
,
()
=>
{
let
vm
;
describe
(
'
computed
'
,
()
=>
{
let
vm
;
beforeEach
(()
=>
{
vm
=
createComponent
();
});
beforeEach
(()
=>
{
vm
=
createComponent
();
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
computed
'
,
()
=>
{
describe
(
'
identiconStyles
'
,
()
=>
{
it
(
'
should return styles attribute value with `background-color` property
'
,
()
=>
{
vm
.
entityId
=
4
;
...
...
@@ -48,9 +53,20 @@ describe('IdenticonComponent', () => {
describe
(
'
template
'
,
()
=>
{
it
(
'
should render identicon
'
,
()
=>
{
const
vm
=
createComponent
();
expect
(
vm
.
$el
.
nodeName
).
toBe
(
'
DIV
'
);
expect
(
vm
.
$el
.
classList
.
contains
(
'
identicon
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
s40
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
getAttribute
(
'
style
'
).
indexOf
(
'
background-color
'
)
>
-
1
).
toBeTruthy
();
vm
.
$destroy
();
});
it
(
'
should render identicon with provided sizing class
'
,
()
=>
{
const
vm
=
createComponent
(
'
s32
'
);
expect
(
vm
.
$el
.
classList
.
contains
(
'
s32
'
)).
toBeTruthy
();
vm
.
$destroy
();
});
});
});
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