diff options
author | Phil Hughes <me@iamphill.com> | 2016-08-15 11:57:01 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-08-17 19:17:39 +0300 |
commit | aa05b5ed8b69e90d1e9f38c13db3af2af85e8285 (patch) | |
tree | b055085c63e3e180a549cacc7e9010f4dd8ed75b /spec/javascripts | |
parent | abb55af272beafd71fd69400be3dbd1a16d81654 (diff) |
Moved board store to namespaced gl object
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/boards/boards_store_spec.js.es6 | 78 | ||||
-rw-r--r-- | spec/javascripts/boards/issue_spec.js.es6 | 2 | ||||
-rw-r--r-- | spec/javascripts/boards/list_spec.js.es6 | 10 |
3 files changed, 45 insertions, 45 deletions
diff --git a/spec/javascripts/boards/boards_store_spec.js.es6 b/spec/javascripts/boards/boards_store_spec.js.es6 index c185fd71c0d..e1b1abe0110 100644 --- a/spec/javascripts/boards/boards_store_spec.js.es6 +++ b/spec/javascripts/boards/boards_store_spec.js.es6 @@ -15,54 +15,54 @@ (() => { beforeEach(() => { gl.boardService = new BoardService('/test/issue-boards/board'); - BoardsStore.create(); + gl.issueBoards.BoardsStore.create(); $.cookie('issue_board_welcome_hidden', 'false'); }); describe('Store', () => { it('starts with a blank state', () => { - expect(BoardsStore.state.lists.length).toBe(0); + expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(0); }); describe('lists', () => { it('creates new list without persisting to DB', () => { - BoardsStore.addList(listObj); + gl.issueBoards.BoardsStore.addList(listObj); - expect(BoardsStore.state.lists.length).toBe(1); + expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1); }); it('finds list by ID', () => { - BoardsStore.addList(listObj); - const list = BoardsStore.findList('id', 1); + gl.issueBoards.BoardsStore.addList(listObj); + const list = gl.issueBoards.BoardsStore.findList('id', 1); expect(list.id).toBe(1); }); it('finds list by type', () => { - BoardsStore.addList(listObj); - const list = BoardsStore.findList('type', 'label'); + gl.issueBoards.BoardsStore.addList(listObj); + const list = gl.issueBoards.BoardsStore.findList('type', 'label'); expect(list).toBeDefined(); }); it('finds list limited by type', () => { - BoardsStore.addList({ + gl.issueBoards.BoardsStore.addList({ id: 1, position: 0, title: 'Test', list_type: 'backlog' }); - const list = BoardsStore.findList('id', 1, 'backlog'); + const list = gl.issueBoards.BoardsStore.findList('id', 1, 'backlog'); expect(list).toBeDefined(); }); it('gets issue when new list added', (done) => { - BoardsStore.addList(listObj); - const list = BoardsStore.findList('id', 1); + gl.issueBoards.BoardsStore.addList(listObj); + const list = gl.issueBoards.BoardsStore.findList('id', 1); - expect(BoardsStore.state.lists.length).toBe(1); + expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1); setTimeout(() => { expect(list.issues.length).toBe(1); @@ -72,7 +72,7 @@ }); it('persists new list', (done) => { - BoardsStore.new({ + gl.issueBoards.BoardsStore.new({ title: 'Test', type: 'label', label: { @@ -82,10 +82,10 @@ description: 'testing;' } }); - expect(BoardsStore.state.lists.length).toBe(1); + expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1); setTimeout(() => { - const list = BoardsStore.findList('id', 1); + const list = gl.issueBoards.BoardsStore.findList('id', 1); expect(list).toBeDefined(); expect(list.id).toBe(1); expect(list.position).toBe(0); @@ -94,68 +94,68 @@ }); it('check for blank state adding', () => { - expect(BoardsStore.shouldAddBlankState()).toBe(true); + expect(gl.issueBoards.BoardsStore.shouldAddBlankState()).toBe(true); }); it('check for blank state not adding', () => { - BoardsStore.addList(listObj); - expect(BoardsStore.shouldAddBlankState()).toBe(false); + gl.issueBoards.BoardsStore.addList(listObj); + expect(gl.issueBoards.BoardsStore.shouldAddBlankState()).toBe(false); }); it('check for blank state adding when backlog & done list exist', () => { - BoardsStore.addList({ + gl.issueBoards.BoardsStore.addList({ list_type: 'backlog' }); - BoardsStore.addList({ + gl.issueBoards.BoardsStore.addList({ list_type: 'done' }); - expect(BoardsStore.shouldAddBlankState()).toBe(true); + expect(gl.issueBoards.BoardsStore.shouldAddBlankState()).toBe(true); }); it('adds the blank state', () => { - BoardsStore.addBlankState(); + gl.issueBoards.BoardsStore.addBlankState(); - const list = BoardsStore.findList('type', 'blank', 'blank'); + const list = gl.issueBoards.BoardsStore.findList('type', 'blank', 'blank'); expect(list).toBeDefined(); }); it('removes list from state', () => { - BoardsStore.addList(listObj); + gl.issueBoards.BoardsStore.addList(listObj); - expect(BoardsStore.state.lists.length).toBe(1); + expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1); - BoardsStore.removeList(1); + gl.issueBoards.BoardsStore.removeList(1); - expect(BoardsStore.state.lists.length).toBe(0); + expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(0); }); it('moves the position of lists', () => { - BoardsStore.addList(listObj); - BoardsStore.addList(listObjDuplicate); + gl.issueBoards.BoardsStore.addList(listObj); + gl.issueBoards.BoardsStore.addList(listObjDuplicate); - expect(BoardsStore.state.lists.length).toBe(2); + expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(2); - BoardsStore.moveList(0, 1); + gl.issueBoards.BoardsStore.moveList(0, 1); - const list = BoardsStore.findList('id', 1); + const list = gl.issueBoards.BoardsStore.findList('id', 1); expect(list.position).toBe(1); }); it('moves an issue from one list to another', (done) => { - BoardsStore.addList(listObj); - BoardsStore.addList(listObjDuplicate); + gl.issueBoards.BoardsStore.addList(listObj); + gl.issueBoards.BoardsStore.addList(listObjDuplicate); - expect(BoardsStore.state.lists.length).toBe(2); + expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(2); - const list = BoardsStore.findList('id', 1), - listTwo = BoardsStore.findList('id', 2); + const list = gl.issueBoards.BoardsStore.findList('id', 1), + listTwo = gl.issueBoards.BoardsStore.findList('id', 2); setTimeout(() => { expect(list.issues.length).toBe(1); expect(listTwo.issues.length).toBe(1); - BoardsStore.moveCardToList(1, 2, 1); + gl.issueBoards.BoardsStore.moveCardToList(1, 2, 1); expect(list.issues.length).toBe(0); expect(listTwo.issues.length).toBe(1); diff --git a/spec/javascripts/boards/issue_spec.js.es6 b/spec/javascripts/boards/issue_spec.js.es6 index b53be896872..3569d1b98bd 100644 --- a/spec/javascripts/boards/issue_spec.js.es6 +++ b/spec/javascripts/boards/issue_spec.js.es6 @@ -17,7 +17,7 @@ describe('Issue model', () => { beforeEach(() => { gl.boardService = new BoardService('/test/issue-boards/board'); - BoardsStore.create(); + gl.issueBoards.BoardsStore.create(); issue = new ListIssue({ title: 'Testing', diff --git a/spec/javascripts/boards/list_spec.js.es6 b/spec/javascripts/boards/list_spec.js.es6 index 3773fd22c26..c206b794442 100644 --- a/spec/javascripts/boards/list_spec.js.es6 +++ b/spec/javascripts/boards/list_spec.js.es6 @@ -17,7 +17,7 @@ describe('List model', () => { beforeEach(() => { gl.boardService = new BoardService('/test/issue-boards/board'); - BoardsStore.create(); + gl.issueBoards.BoardsStore.create(); list = new List(listObj); }); @@ -49,13 +49,13 @@ describe('List model', () => { }); it('destroys the list', (done) => { - BoardsStore.addList(listObj); - list = BoardsStore.findList('id', 1); - expect(BoardsStore.state.lists.length).toBe(1); + gl.issueBoards.BoardsStore.addList(listObj); + list = gl.issueBoards.BoardsStore.findList('id', 1); + expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1); list.destroy(); setTimeout(() => { - expect(BoardsStore.state.lists.length).toBe(0); + expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(0); done(); }, 0); }); |