From 706d99aed8985d0a278107295f5f1d26f0b42383 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 14 Jul 2017 15:52:54 +0000 Subject: Update Pipeline's badge count in Merge Request and Commits view to match real-time content --- .../javascripts/commit/pipelines/pipelines_spec.js | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'spec/javascripts') diff --git a/spec/javascripts/commit/pipelines/pipelines_spec.js b/spec/javascripts/commit/pipelines/pipelines_spec.js index 694f94efcff..a34cadec0ab 100644 --- a/spec/javascripts/commit/pipelines/pipelines_spec.js +++ b/spec/javascripts/commit/pipelines/pipelines_spec.js @@ -85,6 +85,41 @@ describe('Pipelines table in Commits and Merge requests', () => { }, 0); }); }); + + describe('pipeline badge counts', () => { + const pipelinesResponse = (request, next) => { + next(request.respondWith(JSON.stringify([pipeline]), { + status: 200, + })); + }; + + beforeEach(() => { + Vue.http.interceptors.push(pipelinesResponse); + }); + + afterEach(() => { + Vue.http.interceptors = _.without(Vue.http.interceptors, pipelinesResponse); + this.component.$destroy(); + }); + + it('should receive update-pipelines-count event', (done) => { + const element = document.createElement('div'); + document.body.appendChild(element); + + element.addEventListener('update-pipelines-count', (event) => { + expect(event.detail.pipelines).toEqual([pipeline]); + done(); + }); + + this.component = new PipelinesTable({ + propsData: { + endpoint: 'endpoint', + helpPagePath: 'foo', + }, + }).$mount(); + element.appendChild(this.component.$el); + }); + }); }); describe('unsuccessfull request', () => { -- cgit v1.2.1