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
Léo-Paul Géneau
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
Show 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 {
...
@@ -9,6 +9,11 @@ export default {
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
},
},
sizeClass
:
{
type
:
String
,
required
:
false
,
default
:
'
s40
'
,
},
},
},
computed
:
{
computed
:
{
/**
/**
...
@@ -38,7 +43,8 @@ export default {
...
@@ -38,7 +43,8 @@ export default {
<
template
>
<
template
>
<div
<div
class=
"avatar s40 identicon"
class=
"avatar identicon"
:class=
"sizeClass"
:style=
"identiconStyles"
>
:style=
"identiconStyles"
>
{{
identiconTitle
}}
{{
identiconTitle
}}
</div>
</div>
...
...
spec/javascripts/vue_shared/components/identicon_spec.js
View file @
8c70224d
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
identiconComponent
from
'
~/vue_shared/components/identicon.vue
'
;
import
identiconComponent
from
'
~/vue_shared/components/identicon.vue
'
;
const
createComponent
=
()
=>
{
const
createComponent
=
(
sizeClass
)
=>
{
const
Component
=
Vue
.
extend
(
identiconComponent
);
const
Component
=
Vue
.
extend
(
identiconComponent
);
return
new
Component
({
return
new
Component
({
propsData
:
{
propsData
:
{
entityId
:
1
,
entityId
:
1
,
entityName
:
'
entity-name
'
,
entityName
:
'
entity-name
'
,
sizeClass
,
},
},
}).
$mount
();
}).
$mount
();
};
};
describe
(
'
IdenticonComponent
'
,
()
=>
{
describe
(
'
IdenticonComponent
'
,
()
=>
{
describe
(
'
computed
'
,
()
=>
{
let
vm
;
let
vm
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
vm
=
createComponent
();
vm
=
createComponent
();
});
});
describe
(
'
computed
'
,
()
=>
{
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
identiconStyles
'
,
()
=>
{
describe
(
'
identiconStyles
'
,
()
=>
{
it
(
'
should return styles attribute value with `background-color` property
'
,
()
=>
{
it
(
'
should return styles attribute value with `background-color` property
'
,
()
=>
{
vm
.
entityId
=
4
;
vm
.
entityId
=
4
;
...
@@ -48,9 +53,20 @@ describe('IdenticonComponent', () => {
...
@@ -48,9 +53,20 @@ describe('IdenticonComponent', () => {
describe
(
'
template
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
it
(
'
should render identicon
'
,
()
=>
{
it
(
'
should render identicon
'
,
()
=>
{
const
vm
=
createComponent
();
expect
(
vm
.
$el
.
nodeName
).
toBe
(
'
DIV
'
);
expect
(
vm
.
$el
.
nodeName
).
toBe
(
'
DIV
'
);
expect
(
vm
.
$el
.
classList
.
contains
(
'
identicon
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
identicon
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
s40
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
getAttribute
(
'
style
'
).
indexOf
(
'
background-color
'
)
>
-
1
).
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