diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-02-09 15:10:16 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-02-12 13:59:27 +0000 |
commit | 595afed2e3de93d1685b2f77dd8e72df2781a57b (patch) | |
tree | a88d7a3f7835c81e5134c577476ba363bf6c7634 /spec/javascripts/environments/environment_spec.js.es6 | |
parent | fb35980893f918f7dbad0f433447c6df13a1c757 (diff) | |
download | gitlab-ce-595afed2e3de93d1685b2f77dd8e72df2781a57b.tar.gz |
Integrates pagination component with API
Adds pagination tests
Remove misplaced comment
Fix broken store test
Diffstat (limited to 'spec/javascripts/environments/environment_spec.js.es6')
-rw-r--r-- | spec/javascripts/environments/environment_spec.js.es6 | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/spec/javascripts/environments/environment_spec.js.es6 b/spec/javascripts/environments/environment_spec.js.es6 index 1d1a688a4a5..f557dcee91f 100644 --- a/spec/javascripts/environments/environment_spec.js.es6 +++ b/spec/javascripts/environments/environment_spec.js.es6 @@ -49,7 +49,7 @@ describe('Environment', () => { }); }); - describe('with environments', () => { + describe('with paginated environments', () => { const environmentsResponseInterceptor = (request, next) => { next(request.respondWith(JSON.stringify({ environments: [environment], @@ -57,11 +57,22 @@ describe('Environment', () => { available_count: 0, }), { status: 200, + headers: { + 'X-Next-Page': '2', + 'X-Page': '1', + 'X-Per-Page': '1', + 'X-Prev-Page': '', + 'X-Total': '37', + 'X-Total-Pages': '2', + }, })); }; beforeEach(() => { Vue.http.interceptors.push(environmentsResponseInterceptor); + component = new EnvironmentsComponent({ + el: document.querySelector('#environments-list-view'), + }); }); afterEach(() => { @@ -71,10 +82,6 @@ describe('Environment', () => { }); it('should render a table with environments', (done) => { - component = new EnvironmentsComponent({ - el: document.querySelector('#environments-list-view'), - }); - setTimeout(() => { expect( component.$el.querySelectorAll('table tbody tr').length, @@ -82,6 +89,17 @@ describe('Environment', () => { done(); }, 0); }); + + describe('pagination', () => { + it('should render pagination', (done) => { + setTimeout(() => { + expect( + component.$el.querySelectorAll('.gl-pagination li').length, + ).toEqual(5); + done(); + }, 0); + }); + }); }); }); |