summaryrefslogtreecommitdiff
path: root/spec/javascripts/pipelines/pipelines_table_row_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/pipelines/pipelines_table_row_spec.js')
-rw-r--r--spec/javascripts/pipelines/pipelines_table_row_spec.js29
1 files changed, 18 insertions, 11 deletions
diff --git a/spec/javascripts/pipelines/pipelines_table_row_spec.js b/spec/javascripts/pipelines/pipelines_table_row_spec.js
index 68043b91bd0..03ffc122795 100644
--- a/spec/javascripts/pipelines/pipelines_table_row_spec.js
+++ b/spec/javascripts/pipelines/pipelines_table_row_spec.js
@@ -4,7 +4,7 @@ import eventHub from '~/pipelines/event_hub';
describe('Pipelines Table Row', () => {
const jsonFixtureName = 'pipelines/pipelines.json';
- const buildComponent = (pipeline) => {
+ const buildComponent = pipeline => {
const PipelinesTableRowComponent = Vue.extend(tableRowComp);
return new PipelinesTableRowComponent({
el: document.querySelector('.test-dom-element'),
@@ -24,7 +24,7 @@ describe('Pipelines Table Row', () => {
preloadFixtures(jsonFixtureName);
beforeEach(() => {
- const pipelines = getJSONFixture(jsonFixtureName).pipelines;
+ const { pipelines } = getJSONFixture(jsonFixtureName);
pipeline = pipelines.find(p => p.user !== null && p.commit !== null);
pipelineWithoutAuthor = pipelines.find(p => p.user === null && p.commit !== null);
@@ -52,9 +52,9 @@ describe('Pipelines Table Row', () => {
});
it('should render status text', () => {
- expect(
- component.$el.querySelector('.table-section.commit-link a').textContent,
- ).toContain(pipeline.details.status.text);
+ expect(component.$el.querySelector('.table-section.commit-link a').textContent).toContain(
+ pipeline.details.status.text,
+ );
});
});
@@ -78,11 +78,15 @@ describe('Pipelines Table Row', () => {
describe('when a user is provided', () => {
it('should render user information', () => {
expect(
- component.$el.querySelector('.table-section:nth-child(2) a:nth-child(3)').getAttribute('href'),
+ component.$el
+ .querySelector('.table-section:nth-child(2) a:nth-child(3)')
+ .getAttribute('href'),
).toEqual(pipeline.user.path);
expect(
- component.$el.querySelector('.table-section:nth-child(2) img').getAttribute('data-original-title'),
+ component.$el
+ .querySelector('.table-section:nth-child(2) img')
+ .getAttribute('data-original-title'),
).toEqual(pipeline.user.name);
});
});
@@ -105,7 +109,9 @@ describe('Pipelines Table Row', () => {
}
const commitAuthorLink = commitAuthorElement.getAttribute('href');
- const commitAuthorName = commitAuthorElement.querySelector('img.avatar').getAttribute('data-original-title');
+ const commitAuthorName = commitAuthorElement
+ .querySelector('img.avatar')
+ .getAttribute('data-original-title');
return { commitAuthorElement, commitAuthorLink, commitAuthorName };
};
@@ -145,7 +151,8 @@ describe('Pipelines Table Row', () => {
it('should render an icon for each stage', () => {
expect(
- component.$el.querySelectorAll('.table-section:nth-child(4) .js-builds-dropdown-button').length,
+ component.$el.querySelectorAll('.table-section:nth-child(4) .js-builds-dropdown-button')
+ .length,
).toEqual(pipeline.details.stages.length);
});
});
@@ -167,7 +174,7 @@ describe('Pipelines Table Row', () => {
});
it('emits `retryPipeline` event when retry button is clicked and toggles loading', () => {
- eventHub.$on('retryPipeline', (endpoint) => {
+ eventHub.$on('retryPipeline', endpoint => {
expect(endpoint).toEqual('/retry');
});
@@ -176,7 +183,7 @@ describe('Pipelines Table Row', () => {
});
it('emits `openConfirmationModal` event when cancel button is clicked and toggles loading', () => {
- eventHub.$on('openConfirmationModal', (data) => {
+ eventHub.$once('openConfirmationModal', data => {
expect(data.endpoint).toEqual('/cancel');
expect(data.pipelineId).toEqual(pipeline.id);
});