diff options
author | Martin Hanzel <mhanzel@gitlab.com> | 2019-06-29 00:20:05 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-06-29 00:20:05 +0300 |
commit | 5c078128351f4100b916eb8b70a6954afc6d926b (patch) | |
tree | 8627d217c8caa9e01dbb8bb76836d93f8d5b1b4e /spec | |
parent | 388a496443cf8b86e72c275ca63b14e8f059c8f6 (diff) |
Allow collapsing all issue boards
All issue boards can now be collapsed via a button, re-ordered by
dragging the header, and the vertical collapsed header style was
reworked.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/boards/components/board_spec.js | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/spec/javascripts/boards/components/board_spec.js b/spec/javascripts/boards/components/board_spec.js index d08ee41802b..683783334c6 100644 --- a/spec/javascripts/boards/components/board_spec.js +++ b/spec/javascripts/boards/components/board_spec.js @@ -1,7 +1,6 @@ import Vue from 'vue'; -import '~/boards/services/board_service'; import Board from '~/boards/components/board'; -import '~/boards/models/list'; +import List from '~/boards/models/list'; import { mockBoardService } from '../mock_data'; describe('Board component', () => { @@ -27,7 +26,6 @@ describe('Board component', () => { disabled: false, issueLinkBase: '/', rootPath: '/', - // eslint-disable-next-line no-undef list: new List({ id: 1, position: 0, @@ -53,57 +51,62 @@ describe('Board component', () => { expect(vm.$el.classList.contains('is-expandable')).toBe(true); }); - it('board is expandable when list type is closed', done => { - vm.list.type = 'closed'; - - Vue.nextTick(() => { - expect(vm.$el.classList.contains('is-expandable')).toBe(true); - - done(); - }); + it('board is expandable when list type is closed', () => { + expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true); }); - it('board is not expandable when list type is label', done => { - vm.list.type = 'label'; - vm.list.isExpandable = false; - - Vue.nextTick(() => { - expect(vm.$el.classList.contains('is-expandable')).toBe(false); + it('board is expandable when list type is label', () => { + expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true); + }); - done(); - }); + it('board is not expandable when list type is blank', () => { + expect(new List({ id: 1, list_type: 'blank' }).isExpandable).toBe(false); }); - it('collapses when clicking header', done => { + it('does not collapse when clicking header', done => { + vm.list.isExpanded = true; vm.$el.querySelector('.board-header').click(); Vue.nextTick(() => { - expect(vm.$el.classList.contains('is-collapsed')).toBe(true); + expect(vm.$el.classList.contains('is-collapsed')).toBe(false); done(); }); }); - it('created sets isExpanded to true from localStorage', done => { - vm.$el.querySelector('.board-header').click(); + it('collapses when clicking the collapse icon', done => { + vm.list.isExpanded = true; - return Vue.nextTick() + Vue.nextTick() + .then(() => { + vm.$el.querySelector('.board-title-caret').click(); + }) .then(() => { expect(vm.$el.classList.contains('is-collapsed')).toBe(true); + done(); + }) + .catch(done.fail); + }); - // call created manually - vm.$options.created[0].call(vm); + it('expands when clicking the expand icon', done => { + vm.list.isExpanded = false; - return Vue.nextTick(); + Vue.nextTick() + .then(() => { + vm.$el.querySelector('.board-title-caret').click(); }) .then(() => { - expect(vm.$el.classList.contains('is-collapsed')).toBe(true); - + expect(vm.$el.classList.contains('is-collapsed')).toBe(false); done(); }) .catch(done.fail); }); + it('is expanded when created', () => { + expect(vm.list.isExpanded).toBe(true); + expect(vm.$el.classList.contains('is-collapsed')).toBe(false); + }); + it('does render add issue button', () => { expect(vm.$el.querySelector('.issue-count-badge-add-button')).not.toBeNull(); }); |