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
cb8fa2a0
Commit
cb8fa2a0
authored
Apr 14, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improves specs
parent
a848274c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
38 deletions
+48
-38
spec/javascripts/vue_shared/components/commit_spec.js
spec/javascripts/vue_shared/components/commit_spec.js
+48
-38
No files found.
spec/javascripts/vue_shared/components/commit_spec.js
View file @
cb8fa2a0
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
commitComp
from
'
~/vue_shared/components/commit.vue
'
;
import
commitComp
from
'
~/vue_shared/components/commit.vue
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
describe
(
'
Commit component
'
,
()
=>
{
describe
(
'
Commit component
'
,
()
=>
{
let
props
;
let
props
;
...
@@ -10,25 +11,28 @@ describe('Commit component', () => {
...
@@ -10,25 +11,28 @@ describe('Commit component', () => {
CommitComponent
=
Vue
.
extend
(
commitComp
);
CommitComponent
=
Vue
.
extend
(
commitComp
);
});
});
afterEach
(()
=>
{
component
.
$destroy
();
});
it
(
'
should render a fork icon if it does not represent a tag
'
,
()
=>
{
it
(
'
should render a fork icon if it does not represent a tag
'
,
()
=>
{
component
=
new
CommitComponent
({
component
=
mountComponent
(
CommitComponent
,
{
propsData
:
{
tag
:
false
,
tag
:
false
,
commitRef
:
{
commitRef
:
{
name
:
'
master
'
,
name
:
'
master
'
,
ref_url
:
'
http://localhost/namespace2/gitlabhq/tree/master
'
,
ref_url
:
'
http://localhost/namespace2/gitlabhq/tree/master
'
,
},
commitUrl
:
'
https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067
'
,
shortSha
:
'
b7836edd
'
,
title
:
'
Commit message
'
,
author
:
{
avatar_url
:
'
https://gitlab.com/uploads/-/system/user/avatar/300478/avatar.png
'
,
web_url
:
'
https://gitlab.com/jschatz1
'
,
path
:
'
/jschatz1
'
,
username
:
'
jschatz1
'
,
},
},
},
}).
$mount
();
commitUrl
:
'
https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067
'
,
shortSha
:
'
b7836edd
'
,
title
:
'
Commit message
'
,
author
:
{
avatar_url
:
'
https://gitlab.com/uploads/-/system/user/avatar/300478/avatar.png
'
,
web_url
:
'
https://gitlab.com/jschatz1
'
,
path
:
'
/jschatz1
'
,
username
:
'
jschatz1
'
,
},
});
expect
(
component
.
$el
.
querySelector
(
'
.icon-container
'
).
children
).
toContain
(
'
svg
'
);
expect
(
component
.
$el
.
querySelector
(
'
.icon-container
'
).
children
).
toContain
(
'
svg
'
);
});
});
...
@@ -41,7 +45,8 @@ describe('Commit component', () => {
...
@@ -41,7 +45,8 @@ describe('Commit component', () => {
name
:
'
master
'
,
name
:
'
master
'
,
ref_url
:
'
http://localhost/namespace2/gitlabhq/tree/master
'
,
ref_url
:
'
http://localhost/namespace2/gitlabhq/tree/master
'
,
},
},
commitUrl
:
'
https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067
'
,
commitUrl
:
'
https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067
'
,
shortSha
:
'
b7836edd
'
,
shortSha
:
'
b7836edd
'
,
title
:
'
Commit message
'
,
title
:
'
Commit message
'
,
author
:
{
author
:
{
...
@@ -53,9 +58,7 @@ describe('Commit component', () => {
...
@@ -53,9 +58,7 @@ describe('Commit component', () => {
commitIconSvg
:
'
<svg></svg>
'
,
commitIconSvg
:
'
<svg></svg>
'
,
};
};
component
=
new
CommitComponent
({
component
=
mountComponent
(
CommitComponent
,
props
);
propsData
:
props
,
}).
$mount
();
});
});
it
(
'
should render a tag icon if it represents a tag
'
,
()
=>
{
it
(
'
should render a tag icon if it represents a tag
'
,
()
=>
{
...
@@ -63,7 +66,9 @@ describe('Commit component', () => {
...
@@ -63,7 +66,9 @@ describe('Commit component', () => {
});
});
it
(
'
should render a link to the ref url
'
,
()
=>
{
it
(
'
should render a link to the ref url
'
,
()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.ref-name
'
).
getAttribute
(
'
href
'
)).
toEqual
(
props
.
commitRef
.
ref_url
);
expect
(
component
.
$el
.
querySelector
(
'
.ref-name
'
).
getAttribute
(
'
href
'
)).
toEqual
(
props
.
commitRef
.
ref_url
,
);
});
});
it
(
'
should render the ref name
'
,
()
=>
{
it
(
'
should render the ref name
'
,
()
=>
{
...
@@ -71,7 +76,9 @@ describe('Commit component', () => {
...
@@ -71,7 +76,9 @@ describe('Commit component', () => {
});
});
it
(
'
should render the commit short sha with a link to the commit url
'
,
()
=>
{
it
(
'
should render the commit short sha with a link to the commit url
'
,
()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.commit-sha
'
).
getAttribute
(
'
href
'
)).
toEqual
(
props
.
commitUrl
);
expect
(
component
.
$el
.
querySelector
(
'
.commit-sha
'
).
getAttribute
(
'
href
'
)).
toEqual
(
props
.
commitUrl
,
);
expect
(
component
.
$el
.
querySelector
(
'
.commit-sha
'
).
textContent
).
toContain
(
props
.
shortSha
);
expect
(
component
.
$el
.
querySelector
(
'
.commit-sha
'
).
textContent
).
toContain
(
props
.
shortSha
);
});
});
...
@@ -88,21 +95,25 @@ describe('Commit component', () => {
...
@@ -88,21 +95,25 @@ describe('Commit component', () => {
it
(
'
Should render the author avatar with title and alt attributes
'
,
()
=>
{
it
(
'
Should render the author avatar with title and alt attributes
'
,
()
=>
{
expect
(
expect
(
component
.
$el
.
querySelector
(
'
.commit-title .avatar-image-container img
'
).
getAttribute
(
'
data-original-title
'
),
component
.
$el
.
querySelector
(
'
.commit-title .avatar-image-container img
'
)
.
getAttribute
(
'
data-original-title
'
),
).
toContain
(
props
.
author
.
username
);
).
toContain
(
props
.
author
.
username
);
expect
(
expect
(
component
.
$el
.
querySelector
(
'
.commit-title .avatar-image-container img
'
).
getAttribute
(
'
alt
'
),
component
.
$el
.
querySelector
(
'
.commit-title .avatar-image-container img
'
)
.
getAttribute
(
'
alt
'
),
).
toContain
(
`
${
props
.
author
.
username
}
's avatar`
);
).
toContain
(
`
${
props
.
author
.
username
}
's avatar`
);
});
});
});
});
it
(
'
should render the commit title
'
,
()
=>
{
it
(
'
should render the commit title
'
,
()
=>
{
expect
(
expect
(
component
.
$el
.
querySelector
(
'
a.commit-row-message
'
).
getAttribute
(
'
href
'
)).
toEqual
(
component
.
$el
.
querySelector
(
'
a.commit-row-message
'
).
getAttribute
(
'
href
'
)
,
props
.
commitUrl
,
)
.
toEqual
(
props
.
commitUrl
)
;
);
expect
(
expect
(
component
.
$el
.
querySelector
(
'
a.commit-row-message
'
).
textContent
).
toContain
(
component
.
$el
.
querySelector
(
'
a.commit-row-message
'
).
textContent
,
props
.
title
,
)
.
toContain
(
props
.
title
)
;
);
});
});
});
});
...
@@ -114,19 +125,18 @@ describe('Commit component', () => {
...
@@ -114,19 +125,18 @@ describe('Commit component', () => {
name
:
'
master
'
,
name
:
'
master
'
,
ref_url
:
'
http://localhost/namespace2/gitlabhq/tree/master
'
,
ref_url
:
'
http://localhost/namespace2/gitlabhq/tree/master
'
,
},
},
commitUrl
:
'
https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067
'
,
commitUrl
:
'
https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067
'
,
shortSha
:
'
b7836edd
'
,
shortSha
:
'
b7836edd
'
,
title
:
null
,
title
:
null
,
author
:
{},
author
:
{},
};
};
component
=
new
CommitComponent
({
component
=
mountComponent
(
CommitComponent
,
props
);
propsData
:
props
,
}).
$mount
();
expect
(
expect
(
component
.
$el
.
querySelector
(
'
.commit-title span
'
).
textContent
).
toContain
(
component
.
$el
.
querySelector
(
'
.commit-title span
'
).
textContent
,
"
Can't find HEAD commit for this branch
"
,
)
.
toContain
(
'
Cant find HEAD commit for this branch
'
)
;
);
});
});
});
});
});
});
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