diff options
author | bikebilly <fabio@gitlab.com> | 2017-08-03 10:05:56 +0200 |
---|---|---|
committer | bikebilly <fabio@gitlab.com> | 2017-08-03 10:05:56 +0200 |
commit | 40dfddd4077da4d594bd9e8956e1fcb1c99434e6 (patch) | |
tree | d0761ed84471c22b3b0949720e3e0734e8645aac /spec/javascripts/pipelines/pipelines_table_spec.js | |
parent | ed5445388de13f1d126fec14cc0a9ea9ae03b397 (diff) | |
parent | dc412b48693668f7fba3adea57b8be76685afa76 (diff) | |
download | gitlab-ce-40dfddd4077da4d594bd9e8956e1fcb1c99434e6.tar.gz |
Merge branch 'master' into 33329-tech-article-deploying-maven-artifacts
Diffstat (limited to 'spec/javascripts/pipelines/pipelines_table_spec.js')
-rw-r--r-- | spec/javascripts/pipelines/pipelines_table_spec.js | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/spec/javascripts/pipelines/pipelines_table_spec.js b/spec/javascripts/pipelines/pipelines_table_spec.js new file mode 100644 index 00000000000..3afe89c8db4 --- /dev/null +++ b/spec/javascripts/pipelines/pipelines_table_spec.js @@ -0,0 +1,67 @@ +import Vue from 'vue'; +import pipelinesTableComp from '~/pipelines/components/pipelines_table.vue'; +import '~/lib/utils/datetime_utility'; + +describe('Pipelines Table', () => { + const jsonFixtureName = 'pipelines/pipelines.json'; + + let pipeline; + let PipelinesTableComponent; + + preloadFixtures(jsonFixtureName); + + beforeEach(() => { + PipelinesTableComponent = Vue.extend(pipelinesTableComp); + const pipelines = getJSONFixture(jsonFixtureName).pipelines; + pipeline = pipelines.find(p => p.id === 1); + }); + + describe('table', () => { + let component; + beforeEach(() => { + component = new PipelinesTableComponent({ + propsData: { + pipelines: [], + }, + }).$mount(); + }); + + afterEach(() => { + component.$destroy(); + }); + + it('should render a table', () => { + expect(component.$el.getAttribute('class')).toContain('ci-table'); + }); + + it('should render table head with correct columns', () => { + expect(component.$el.querySelector('.table-section.js-pipeline-status').textContent.trim()).toEqual('Status'); + expect(component.$el.querySelector('.table-section.js-pipeline-info').textContent.trim()).toEqual('Pipeline'); + expect(component.$el.querySelector('.table-section.js-pipeline-commit').textContent.trim()).toEqual('Commit'); + expect(component.$el.querySelector('.table-section.js-pipeline-stages').textContent.trim()).toEqual('Stages'); + }); + }); + + describe('without data', () => { + it('should render an empty table', () => { + const component = new PipelinesTableComponent({ + propsData: { + pipelines: [], + }, + }).$mount(); + expect(component.$el.querySelectorAll('.commit.gl-responsive-table-row').length).toEqual(0); + }); + }); + + describe('with data', () => { + it('should render rows', () => { + const component = new PipelinesTableComponent({ + propsData: { + pipelines: [pipeline], + }, + }).$mount(); + + expect(component.$el.querySelectorAll('.commit.gl-responsive-table-row').length).toEqual(1); + }); + }); +}); |