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
Boxiang Sun
gitlab-ce
Commits
b1645ab9
Commit
b1645ab9
authored
May 04, 2017
by
winh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add failing test for #29368
parent
a7a53cd0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
11 deletions
+79
-11
spec/javascripts/vue_shared/components/pipelines_table_row_spec.js
...scripts/vue_shared/components/pipelines_table_row_spec.js
+79
-11
No files found.
spec/javascripts/vue_shared/components/pipelines_table_row_spec.js
View file @
b1645ab9
...
@@ -3,31 +3,45 @@ import tableRowComp from '~/vue_shared/components/pipelines_table_row';
...
@@ -3,31 +3,45 @@ import tableRowComp from '~/vue_shared/components/pipelines_table_row';
describe
(
'
Pipelines Table Row
'
,
()
=>
{
describe
(
'
Pipelines Table Row
'
,
()
=>
{
const
jsonFixtureName
=
'
pipelines/pipelines.json
'
;
const
jsonFixtureName
=
'
pipelines/pipelines.json
'
;
const
buildComponent
=
(
pipeline
)
=>
{
const
PipelinesTableRowComponent
=
Vue
.
extend
(
tableRowComp
);
return
new
PipelinesTableRowComponent
({
el
:
document
.
querySelector
(
'
.test-dom-element
'
),
propsData
:
{
pipeline
,
service
:
{},
},
}).
$mount
();
};
let
component
;
let
component
;
let
pipeline
;
let
pipeline
;
let
pipelineWithoutAuthor
;
let
pipelineWithoutCommit
;
preloadFixtures
(
jsonFixtureName
);
preloadFixtures
(
jsonFixtureName
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
pipelines
=
getJSONFixture
(
jsonFixtureName
).
pipelines
;
const
pipelines
=
getJSONFixture
(
jsonFixtureName
).
pipelines
;
pipeline
=
pipelines
.
find
(
p
=>
p
.
id
===
1
);
pipeline
=
pipelines
.
find
(
p
=>
p
.
id
===
1
);
const
PipelinesTableRowComponent
=
Vue
.
extend
(
tableRowComp
);
pipelineWithoutAuthor
=
pipelines
.
find
(
p
=>
p
.
id
===
2
);
pipelineWithoutCommit
=
pipelines
.
find
(
p
=>
p
.
id
===
3
);
});
component
=
new
PipelinesTableRowComponent
({
afterEach
(()
=>
{
el
:
document
.
querySelector
(
'
.test-dom-element
'
),
component
.
$destroy
();
propsData
:
{
pipeline
,
service
:
{},
},
}).
$mount
();
});
});
it
(
'
should render a table row
'
,
()
=>
{
it
(
'
should render a table row
'
,
()
=>
{
component
=
buildComponent
(
pipeline
);
expect
(
component
.
$el
).
toEqual
(
'
TR
'
);
expect
(
component
.
$el
).
toEqual
(
'
TR
'
);
});
});
describe
(
'
status column
'
,
()
=>
{
describe
(
'
status column
'
,
()
=>
{
beforeEach
(()
=>
{
component
=
buildComponent
(
pipeline
);
});
it
(
'
should render a pipeline link
'
,
()
=>
{
it
(
'
should render a pipeline link
'
,
()
=>
{
expect
(
expect
(
component
.
$el
.
querySelector
(
'
td.commit-link a
'
).
getAttribute
(
'
href
'
),
component
.
$el
.
querySelector
(
'
td.commit-link a
'
).
getAttribute
(
'
href
'
),
...
@@ -42,6 +56,10 @@ describe('Pipelines Table Row', () => {
...
@@ -42,6 +56,10 @@ describe('Pipelines Table Row', () => {
});
});
describe
(
'
information column
'
,
()
=>
{
describe
(
'
information column
'
,
()
=>
{
beforeEach
(()
=>
{
component
=
buildComponent
(
pipeline
);
});
it
(
'
should render a pipeline link
'
,
()
=>
{
it
(
'
should render a pipeline link
'
,
()
=>
{
expect
(
expect
(
component
.
$el
.
querySelector
(
'
td:nth-child(2) a
'
).
getAttribute
(
'
href
'
),
component
.
$el
.
querySelector
(
'
td:nth-child(2) a
'
).
getAttribute
(
'
href
'
),
...
@@ -69,13 +87,59 @@ describe('Pipelines Table Row', () => {
...
@@ -69,13 +87,59 @@ describe('Pipelines Table Row', () => {
describe
(
'
commit column
'
,
()
=>
{
describe
(
'
commit column
'
,
()
=>
{
it
(
'
should render link to commit
'
,
()
=>
{
it
(
'
should render link to commit
'
,
()
=>
{
expect
(
component
=
buildComponent
(
pipeline
);
component
.
$el
.
querySelector
(
'
td:nth-child(3) .commit-id
'
).
getAttribute
(
'
href
'
),
).
toEqual
(
pipeline
.
commit
.
commit_path
);
const
commitLink
=
component
.
$el
.
querySelector
(
'
.branch-commit .commit-id
'
);
expect
(
commitLink
.
getAttribute
(
'
href
'
)).
toEqual
(
pipeline
.
commit
.
commit_path
);
});
const
findElements
=
()
=>
{
const
commitTitleElement
=
component
.
$el
.
querySelector
(
'
.branch-commit .commit-title
'
);
const
commitAuthorElement
=
commitTitleElement
.
querySelector
(
'
a.avatar-image-container
'
);
if
(
!
commitAuthorElement
)
{
return
{
commitAuthorElement
};
}
const
commitAuthorLink
=
commitAuthorElement
.
getAttribute
(
'
href
'
);
const
commitAuthorName
=
commitAuthorElement
.
querySelector
(
'
img.avatar
'
).
getAttribute
(
'
title
'
);
return
{
commitAuthorElement
,
commitAuthorLink
,
commitAuthorName
};
};
it
(
'
renders nothing without commit
'
,
()
=>
{
expect
(
pipelineWithoutCommit
.
commit
).
toBe
(
null
);
component
=
buildComponent
(
pipelineWithoutCommit
);
const
{
commitAuthorElement
}
=
findElements
();
expect
(
commitAuthorElement
).
toBe
(
null
);
});
it
(
'
renders commit author
'
,
()
=>
{
component
=
buildComponent
(
pipeline
);
const
{
commitAuthorLink
,
commitAuthorName
}
=
findElements
();
expect
(
commitAuthorLink
).
toEqual
(
pipeline
.
commit
.
author
.
web_url
);
expect
(
commitAuthorName
).
toEqual
(
pipeline
.
commit
.
author
.
username
);
});
it
(
'
renders commit with unregistered author
'
,
()
=>
{
expect
(
pipelineWithoutAuthor
.
commit
.
author
).
toBe
(
null
);
component
=
buildComponent
(
pipelineWithoutAuthor
);
const
{
commitAuthorLink
,
commitAuthorName
}
=
findElements
();
expect
(
commitAuthorLink
).
toEqual
(
`mailto:
${
pipelineWithoutAuthor
.
commit
.
author_email
}
`
);
expect
(
commitAuthorName
).
toEqual
(
pipelineWithoutAuthor
.
commit
.
author_name
);
});
});
});
});
describe
(
'
stages column
'
,
()
=>
{
describe
(
'
stages column
'
,
()
=>
{
beforeEach
(()
=>
{
component
=
buildComponent
(
pipeline
);
});
it
(
'
should render an icon for each stage
'
,
()
=>
{
it
(
'
should render an icon for each stage
'
,
()
=>
{
expect
(
expect
(
component
.
$el
.
querySelectorAll
(
'
td:nth-child(4) .js-builds-dropdown-button
'
).
length
,
component
.
$el
.
querySelectorAll
(
'
td:nth-child(4) .js-builds-dropdown-button
'
).
length
,
...
@@ -84,6 +148,10 @@ describe('Pipelines Table Row', () => {
...
@@ -84,6 +148,10 @@ describe('Pipelines Table Row', () => {
});
});
describe
(
'
actions column
'
,
()
=>
{
describe
(
'
actions column
'
,
()
=>
{
beforeEach
(()
=>
{
component
=
buildComponent
(
pipeline
);
});
it
(
'
should render the provided actions
'
,
()
=>
{
it
(
'
should render the provided actions
'
,
()
=>
{
expect
(
expect
(
component
.
$el
.
querySelectorAll
(
'
td:nth-child(6) ul li
'
).
length
,
component
.
$el
.
querySelectorAll
(
'
td:nth-child(6) ul li
'
).
length
,
...
...
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