summaryrefslogtreecommitdiff
path: root/spec/javascripts/vue_pagination/pagination_spec.js.es6
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-01-29 15:30:04 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-02-03 09:43:54 +0000
commit184f60a06f828ccbc9264d40e6daa48d60dca629 (patch)
tree28219b71e56eb01a7e153e5789f229d58ae4cf8a /spec/javascripts/vue_pagination/pagination_spec.js.es6
parent2c2da2c07b775f1677456376d311560f1e43226f (diff)
downloadgitlab-ce-184f60a06f828ccbc9264d40e6daa48d60dca629.tar.gz
Moves pagination to shared folder
Document and remove unused code Declare components in a consistent way; Use " instead of ' to improve consistency; Update documentation; Fix commit author verification to match the use cases; Adds tests for the added components Fix paths in pagination spec Adds tests to pipelines table used in merge requests and commits Use same resource interceptor Fix eslint error
Diffstat (limited to 'spec/javascripts/vue_pagination/pagination_spec.js.es6')
-rw-r--r--spec/javascripts/vue_pagination/pagination_spec.js.es6167
1 files changed, 0 insertions, 167 deletions
diff --git a/spec/javascripts/vue_pagination/pagination_spec.js.es6 b/spec/javascripts/vue_pagination/pagination_spec.js.es6
deleted file mode 100644
index efb11211ce2..00000000000
--- a/spec/javascripts/vue_pagination/pagination_spec.js.es6
+++ /dev/null
@@ -1,167 +0,0 @@
-//= require vue
-//= require lib/utils/common_utils
-//= require vue_pagination/index
-
-describe('Pagination component', () => {
- let component;
-
- const changeChanges = {
- one: '',
- two: '',
- };
-
- const change = (one, two) => {
- changeChanges.one = one;
- changeChanges.two = two;
- };
-
- it('should render and start at page 1', () => {
- setFixtures('<div class="test-pagination-container"></div>');
-
- component = new window.gl.VueGlPagination({
- el: document.querySelector('.test-pagination-container'),
- propsData: {
- pageInfo: {
- totalPages: 10,
- nextPage: 2,
- previousPage: '',
- },
- change,
- },
- });
-
- expect(component.$el.classList).toContain('gl-pagination');
-
- component.changePage({ target: { innerText: '1' } });
-
- expect(changeChanges.one).toEqual(1);
- expect(changeChanges.two).toEqual('all');
- });
-
- it('should go to the previous page', () => {
- setFixtures('<div class="test-pagination-container"></div>');
-
- component = new window.gl.VueGlPagination({
- el: document.querySelector('.test-pagination-container'),
- propsData: {
- pageInfo: {
- totalPages: 10,
- nextPage: 3,
- previousPage: 1,
- },
- change,
- },
- });
-
- component.changePage({ target: { innerText: 'Prev' } });
-
- expect(changeChanges.one).toEqual(1);
- expect(changeChanges.two).toEqual('all');
- });
-
- it('should go to the next page', () => {
- setFixtures('<div class="test-pagination-container"></div>');
-
- component = new window.gl.VueGlPagination({
- el: document.querySelector('.test-pagination-container'),
- propsData: {
- pageInfo: {
- totalPages: 10,
- nextPage: 5,
- previousPage: 3,
- },
- change,
- },
- });
-
- component.changePage({ target: { innerText: 'Next' } });
-
- expect(changeChanges.one).toEqual(5);
- expect(changeChanges.two).toEqual('all');
- });
-
- it('should go to the last page', () => {
- setFixtures('<div class="test-pagination-container"></div>');
-
- component = new window.gl.VueGlPagination({
- el: document.querySelector('.test-pagination-container'),
- propsData: {
- pageInfo: {
- totalPages: 10,
- nextPage: 5,
- previousPage: 3,
- },
- change,
- },
- });
-
- component.changePage({ target: { innerText: 'Last >>' } });
-
- expect(changeChanges.one).toEqual(10);
- expect(changeChanges.two).toEqual('all');
- });
-
- it('should go to the first page', () => {
- setFixtures('<div class="test-pagination-container"></div>');
-
- component = new window.gl.VueGlPagination({
- el: document.querySelector('.test-pagination-container'),
- propsData: {
- pageInfo: {
- totalPages: 10,
- nextPage: 5,
- previousPage: 3,
- },
- change,
- },
- });
-
- component.changePage({ target: { innerText: '<< First' } });
-
- expect(changeChanges.one).toEqual(1);
- expect(changeChanges.two).toEqual('all');
- });
-
- it('should do nothing', () => {
- setFixtures('<div class="test-pagination-container"></div>');
-
- component = new window.gl.VueGlPagination({
- el: document.querySelector('.test-pagination-container'),
- propsData: {
- pageInfo: {
- totalPages: 10,
- nextPage: 2,
- previousPage: '',
- },
- change,
- },
- });
-
- component.changePage({ target: { innerText: '...' } });
-
- expect(changeChanges.one).toEqual(1);
- expect(changeChanges.two).toEqual('all');
- });
-});
-
-describe('paramHelper', () => {
- it('can parse url parameters correctly', () => {
- window.history.pushState({}, null, '?scope=all&p=2');
-
- const scope = gl.utils.getParameterByName('scope');
- const p = gl.utils.getParameterByName('p');
-
- expect(scope).toEqual('all');
- expect(p).toEqual('2');
- });
-
- it('returns null if param not in url', () => {
- window.history.pushState({}, null, '?p=2');
-
- const scope = gl.utils.getParameterByName('scope');
- const p = gl.utils.getParameterByName('p');
-
- expect(scope).toEqual(null);
- expect(p).toEqual('2');
- });
-});