summaryrefslogtreecommitdiff
path: root/spec/javascripts/commit/pipelines/pipelines_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/commit/pipelines/pipelines_spec.js')
-rw-r--r--spec/javascripts/commit/pipelines/pipelines_spec.js50
1 files changed, 28 insertions, 22 deletions
diff --git a/spec/javascripts/commit/pipelines/pipelines_spec.js b/spec/javascripts/commit/pipelines/pipelines_spec.js
index 75efcc06585..8cac3cad232 100644
--- a/spec/javascripts/commit/pipelines/pipelines_spec.js
+++ b/spec/javascripts/commit/pipelines/pipelines_spec.js
@@ -9,7 +9,7 @@ describe('Pipelines table in Commits and Merge requests', () => {
loadFixtures('static/pipelines_table.html.raw');
});
- describe('successfull request', () => {
+ describe('successful request', () => {
describe('without pipelines', () => {
const pipelinesEmptyResponse = (request, next) => {
next(request.respondWith(JSON.stringify([]), {
@@ -17,23 +17,25 @@ describe('Pipelines table in Commits and Merge requests', () => {
}));
};
- beforeEach(() => {
+ beforeEach(function () {
Vue.http.interceptors.push(pipelinesEmptyResponse);
+
+ this.component = new PipelinesTable({
+ el: document.querySelector('#commit-pipeline-table-view'),
+ });
});
- afterEach(() => {
+ afterEach(function () {
Vue.http.interceptors = _.without(
Vue.http.interceptors, pipelinesEmptyResponse,
);
+ this.component.$destroy();
});
- it('should render the empty state', (done) => {
- const component = new PipelinesTable({
- el: document.querySelector('#commit-pipeline-table-view'),
- });
-
+ it('should render the empty state', function (done) {
setTimeout(() => {
- expect(component.$el.querySelector('.js-blank-state-title').textContent).toContain('No pipelines to show');
+ expect(this.component.$el.querySelector('.empty-state')).toBeDefined();
+ expect(this.component.$el.querySelector('.realtime-loading')).toBe(null);
done();
}, 1);
});
@@ -48,21 +50,23 @@ describe('Pipelines table in Commits and Merge requests', () => {
beforeEach(() => {
Vue.http.interceptors.push(pipelinesResponse);
+
+ this.component = new PipelinesTable({
+ el: document.querySelector('#commit-pipeline-table-view'),
+ });
});
afterEach(() => {
Vue.http.interceptors = _.without(
Vue.http.interceptors, pipelinesResponse,
);
+ this.component.$destroy();
});
it('should render a table with the received pipelines', (done) => {
- const component = new PipelinesTable({
- el: document.querySelector('#commit-pipeline-table-view'),
- });
-
setTimeout(() => {
- expect(component.$el.querySelectorAll('table > tbody > tr').length).toEqual(1);
+ expect(this.component.$el.querySelectorAll('table > tbody > tr').length).toEqual(1);
+ expect(this.component.$el.querySelector('.realtime-loading')).toBe(null);
done();
}, 0);
});
@@ -76,23 +80,25 @@ describe('Pipelines table in Commits and Merge requests', () => {
}));
};
- beforeEach(() => {
+ beforeEach(function () {
Vue.http.interceptors.push(pipelinesErrorResponse);
+
+ this.component = new PipelinesTable({
+ el: document.querySelector('#commit-pipeline-table-view'),
+ });
});
- afterEach(() => {
+ afterEach(function () {
Vue.http.interceptors = _.without(
Vue.http.interceptors, pipelinesErrorResponse,
);
+ this.component.$destroy();
});
- it('should render empty state', (done) => {
- const component = new PipelinesTable({
- el: document.querySelector('#commit-pipeline-table-view'),
- });
-
+ it('should render empty state', function (done) {
setTimeout(() => {
- expect(component.$el.querySelector('.js-blank-state-title').textContent).toContain('No pipelines to show');
+ expect(this.component.$el.querySelector('.js-pipelines-error-state')).toBeDefined();
+ expect(this.component.$el.querySelector('.realtime-loading')).toBe(null);
done();
}, 0);
});