summaryrefslogtreecommitdiff
path: root/spec/javascripts/environments/environment_spec.js.es6
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/environments/environment_spec.js.es6')
-rw-r--r--spec/javascripts/environments/environment_spec.js.es628
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);
+ });
+ });
});
});