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
d98f03d3
Commit
d98f03d3
authored
Dec 08, 2016
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds tests
parent
3768de80
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
25 deletions
+62
-25
app/assets/javascripts/environments/components/environment_actions.js.es6
...cripts/environments/components/environment_actions.js.es6
+5
-3
app/assets/javascripts/vue_common_component/commit.js.es6
app/assets/javascripts/vue_common_component/commit.js.es6
+1
-1
spec/javascripts/environments/environment_actions_spec.js.es6
.../javascripts/environments/environment_actions_spec.js.es6
+31
-1
spec/javascripts/environments/environment_external_url_spec.js.es6
...scripts/environments/environment_external_url_spec.js.es6
+1
-1
spec/javascripts/environments/environment_rollback_spec.js.es6
...javascripts/environments/environment_rollback_spec.js.es6
+3
-3
spec/javascripts/vue_common_components/commit_spec.js.es6
spec/javascripts/vue_common_components/commit_spec.js.es6
+21
-16
No files found.
app/assets/javascripts/environments/components/environment_actions.js.es6
View file @
d98f03d3
...
@@ -23,8 +23,8 @@
...
@@ -23,8 +23,8 @@
<div class="inline">
<div class="inline">
<div class="dropdown">
<div class="dropdown">
<a class="dropdown-new btn btn-default" data-toggle="dropdown">
<a class="dropdown-new btn btn-default" data-toggle="dropdown">
<span v-html='playIconSvg'></span>
<span
class="js-dropdown-play-icon-container"
v-html='playIconSvg'></span>
<i class
="
fa fa-caret-down"></i>
<i class
"=
fa fa-caret-down"></i>
</a>
</a>
<ul class="dropdown-menu dropdown-menu-align-right">
<ul class="dropdown-menu dropdown-menu-align-right">
...
@@ -33,7 +33,9 @@
...
@@ -33,7 +33,9 @@
data-method="post"
data-method="post"
rel="nofollow"
rel="nofollow"
class="js-manual-action-link">
class="js-manual-action-link">
<span v-html='playIconSvg'></span>
<span class="js-action-play-icon-container" v-html='playIconSvg'></span>
<span>
<span>
{{action.name}}
{{action.name}}
</span>
</span>
...
...
app/assets/javascripts/vue_common_component/commit.js.es6
View file @
d98f03d3
...
@@ -129,7 +129,7 @@
...
@@ -129,7 +129,7 @@
{{commitRef.name}}
{{commitRef.name}}
</a>
</a>
<div v-html="commitIconSvg" class="commit-icon"></div>
<div v-html="commitIconSvg" class="commit-icon
js-commit-icon
"></div>
<a class="commit-id monospace"
<a class="commit-id monospace"
:href="commitUrl">
:href="commitUrl">
...
...
spec/javascripts/environments/environment_actions_spec.js.es6
View file @
d98f03d3
...
@@ -8,7 +8,7 @@ describe('Actions Component', () => {
...
@@ -8,7 +8,7 @@ describe('Actions Component', () => {
fixture.load('environments/element.html');
fixture.load('environments/element.html');
});
});
it('
S
hould render a dropdown with the provided actions', () => {
it('
s
hould render a dropdown with the provided actions', () => {
const actionsMock = [
const actionsMock = [
{
{
name: 'bar',
name: 'bar',
...
@@ -24,6 +24,7 @@ describe('Actions Component', () => {
...
@@ -24,6 +24,7 @@ describe('Actions Component', () => {
el: document.querySelector('.test-dom-element'),
el: document.querySelector('.test-dom-element'),
propsData: {
propsData: {
actions: actionsMock,
actions: actionsMock,
playIconSvg: '<svg></svg>',
},
},
});
});
...
@@ -34,4 +35,33 @@ describe('Actions Component', () => {
...
@@ -34,4 +35,33 @@ describe('Actions Component', () => {
component.$el.querySelector('.dropdown-menu li a').getAttribute('href'),
component.$el.querySelector('.dropdown-menu li a').getAttribute('href'),
).toEqual(actionsMock[0].play_path);
).toEqual(actionsMock[0].play_path);
});
});
it('should render a dropdown with the provided svg', () => {
const actionsMock = [
{
name: 'bar',
play_path: 'https://gitlab.com/play',
},
{
name: 'foo',
play_path: '#',
},
];
const component = new window.gl.environmentsList.ActionsComponent({
el: document.querySelector('.test-dom-element'),
propsData: {
actions: actionsMock,
playIconSvg: '<svg></svg>',
},
});
expect(
component.$el.querySelector('.js-dropdown-play-icon-container').children,
).toContain('svg');
expect(
component.$el.querySelector('.js-action-play-icon-container').children,
).toContain('svg');
});
});
});
spec/javascripts/environments/environment_external_url_spec.js.es6
View file @
d98f03d3
...
@@ -7,7 +7,7 @@ describe('External URL Component', () => {
...
@@ -7,7 +7,7 @@ describe('External URL Component', () => {
fixture.load('environments/element.html');
fixture.load('environments/element.html');
});
});
it('should link to the provided external
_url
', () => {
it('should link to the provided external
Url prop
', () => {
const externalURL = 'https://gitlab.com';
const externalURL = 'https://gitlab.com';
const component = new window.gl.environmentsList.ExternalUrlComponent({
const component = new window.gl.environmentsList.ExternalUrlComponent({
el: document.querySelector('.test-dom-element'),
el: document.querySelector('.test-dom-element'),
...
...
spec/javascripts/environments/environment_rollback_spec.js.es6
View file @
d98f03d3
...
@@ -9,7 +9,7 @@ describe('Rollback Component', () => {
...
@@ -9,7 +9,7 @@ describe('Rollback Component', () => {
fixture.load('environments/element.html');
fixture.load('environments/element.html');
});
});
it('Should link to the provided retry
_u
rl', () => {
it('Should link to the provided retry
U
rl', () => {
const component = new window.gl.environmentsList.RollbackComponent({
const component = new window.gl.environmentsList.RollbackComponent({
el: document.querySelector('.test-dom-element'),
el: document.querySelector('.test-dom-element'),
propsData: {
propsData: {
...
@@ -21,7 +21,7 @@ describe('Rollback Component', () => {
...
@@ -21,7 +21,7 @@ describe('Rollback Component', () => {
expect(component.$el.getAttribute('href')).toEqual(retryURL);
expect(component.$el.getAttribute('href')).toEqual(retryURL);
});
});
it('Should render Re-deploy label when is
_last_d
eployment is true', () => {
it('Should render Re-deploy label when is
LastD
eployment is true', () => {
const component = new window.gl.environmentsList.RollbackComponent({
const component = new window.gl.environmentsList.RollbackComponent({
el: document.querySelector('.test-dom-element'),
el: document.querySelector('.test-dom-element'),
propsData: {
propsData: {
...
@@ -34,7 +34,7 @@ describe('Rollback Component', () => {
...
@@ -34,7 +34,7 @@ describe('Rollback Component', () => {
});
});
it('Should render Rollback label when is
_last_d
eployment is false', () => {
it('Should render Rollback label when is
LastD
eployment is false', () => {
const component = new window.gl.environmentsList.RollbackComponent({
const component = new window.gl.environmentsList.RollbackComponent({
el: document.querySelector('.test-dom-element'),
el: document.querySelector('.test-dom-element'),
propsData: {
propsData: {
...
...
spec/javascripts/vue_common_components/commit_spec.js.es6
View file @
d98f03d3
...
@@ -10,12 +10,12 @@ describe('Commit component', () => {
...
@@ -10,12 +10,12 @@ describe('Commit component', () => {
el: document.querySelector('.test-commit-container'),
el: document.querySelector('.test-commit-container'),
propsData: {
propsData: {
tag: false,
tag: false,
commit
_r
ef: {
commit
R
ef: {
name: 'master',
name: 'master',
ref_url: 'http://localhost/namespace2/gitlabhq/tree/master',
ref_url: 'http://localhost/namespace2/gitlabhq/tree/master',
},
},
commit
_u
rl: 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067',
commit
U
rl: 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067',
short
_s
ha: 'b7836edd',
short
S
ha: 'b7836edd',
title: 'Commit message',
title: 'Commit message',
author: {
author: {
avatar_url: 'https://gitlab.com/uploads/user/avatar/300478/avatar.png',
avatar_url: 'https://gitlab.com/uploads/user/avatar/300478/avatar.png',
...
@@ -34,18 +34,19 @@ describe('Commit component', () => {
...
@@ -34,18 +34,19 @@ describe('Commit component', () => {
props = {
props = {
tag: true,
tag: true,
commit
_r
ef: {
commit
R
ef: {
name: 'master',
name: 'master',
ref_url: 'http://localhost/namespace2/gitlabhq/tree/master',
ref_url: 'http://localhost/namespace2/gitlabhq/tree/master',
},
},
commit
_u
rl: 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067',
commit
U
rl: 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067',
short
_s
ha: 'b7836edd',
short
S
ha: 'b7836edd',
title: 'Commit message',
title: 'Commit message',
author: {
author: {
avatar_url: 'https://gitlab.com/uploads/user/avatar/300478/avatar.png',
avatar_url: 'https://gitlab.com/uploads/user/avatar/300478/avatar.png',
web_url: 'https://gitlab.com/jschatz1',
web_url: 'https://gitlab.com/jschatz1',
username: 'jschatz1',
username: 'jschatz1',
},
},
commitIconSvg: '<svg></svg>',
};
};
component = new window.gl.CommitComponent({
component = new window.gl.CommitComponent({
...
@@ -59,20 +60,24 @@ describe('Commit component', () => {
...
@@ -59,20 +60,24 @@ 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('.branch-name').getAttribute('href')).toEqual(props.commit
_r
ef.ref_url);
expect(component.$el.querySelector('.branch-name').getAttribute('href')).toEqual(props.commit
R
ef.ref_url);
});
});
it('should render the ref name', () => {
it('should render the ref name', () => {
expect(component.$el.querySelector('.branch-name').textContent).toContain(props.commit
_r
ef.name);
expect(component.$el.querySelector('.branch-name').textContent).toContain(props.commit
R
ef.name);
});
});
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-id').getAttribute('href')).toEqual(props.commit_url);
expect(component.$el.querySelector('.commit-id').getAttribute('href')).toEqual(props.commitUrl);
expect(component.$el.querySelector('.commit-id').textContent).toContain(props.short_sha);
expect(component.$el.querySelector('.commit-id').textContent).toContain(props.shortSha);
});
it('should render the given commitIconSvg', () => {
expect(component.$el.querySelector('.js-commit-icon').children).toContain('svg');
});
});
describe('Given commit title and author props', () => {
describe('Given commit title and author props', () => {
it('
S
hould render a link to the author profile', () => {
it('
s
hould render a link to the author profile', () => {
expect(
expect(
component.$el.querySelector('.commit-title .avatar-image-container').getAttribute('href'),
component.$el.querySelector('.commit-title .avatar-image-container').getAttribute('href'),
).toEqual(props.author.web_url);
).toEqual(props.author.web_url);
...
@@ -91,7 +96,7 @@ describe('Commit component', () => {
...
@@ -91,7 +96,7 @@ describe('Commit component', () => {
it('should render the commit title', () => {
it('should render the commit title', () => {
expect(
expect(
component.$el.querySelector('a.commit-row-message').getAttribute('href'),
component.$el.querySelector('a.commit-row-message').getAttribute('href'),
).toEqual(props.commit
_u
rl);
).toEqual(props.commit
U
rl);
expect(
expect(
component.$el.querySelector('a.commit-row-message').textContent,
component.$el.querySelector('a.commit-row-message').textContent,
).toContain(props.title);
).toContain(props.title);
...
@@ -99,16 +104,16 @@ describe('Commit component', () => {
...
@@ -99,16 +104,16 @@ describe('Commit component', () => {
});
});
describe('When commit title is not provided', () => {
describe('When commit title is not provided', () => {
it('
S
hould render default message', () => {
it('
s
hould render default message', () => {
fixture.set('<div class="test-commit-container"></div>');
fixture.set('<div class="test-commit-container"></div>');
props = {
props = {
tag: false,
tag: false,
commit
_r
ef: {
commit
R
ef: {
name: 'master',
name: 'master',
ref_url: 'http://localhost/namespace2/gitlabhq/tree/master',
ref_url: 'http://localhost/namespace2/gitlabhq/tree/master',
},
},
commit
_u
rl: 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067',
commit
U
rl: 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067',
short
_s
ha: 'b7836edd',
short
S
ha: 'b7836edd',
title: null,
title: null,
author: {},
author: {},
};
};
...
...
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