diff --git a/app/assets/javascripts/boards/components/new_list_dropdown.js.es6 b/app/assets/javascripts/boards/components/new_list_dropdown.js.es6 index c2273d8f7d9fecc9fa16d70087e7901da4f62876..e02591e4bf6cfb32283c069c700a12f344bdaf9b 100644 --- a/app/assets/javascripts/boards/components/new_list_dropdown.js.es6 +++ b/app/assets/javascripts/boards/components/new_list_dropdown.js.es6 @@ -16,7 +16,7 @@ $(() => { const active = BoardsStore.findList('title', label.title), $li = $('<li />',), $a = $('<a />', { - class: (active ? 'is-active' : ''), + class: (active ? `is-active js-board-list-${active.id}` : ''), text: label.title, href: '#' }), @@ -39,6 +39,7 @@ $(() => { BoardsStore.new({ title: label.title, position: BoardsStore.state.lists.length - 1, + list_type: 'label', label: { id: label.id, title: label.title, diff --git a/app/assets/javascripts/boards/models/list.js.es6 b/app/assets/javascripts/boards/models/list.js.es6 index 0c4e289a8ad315bcdb8f04caaacb683e68d2ce9a..e5b8f9cd227b60fd676a0ca9f2048bceb378b2fa 100644 --- a/app/assets/javascripts/boards/models/list.js.es6 +++ b/app/assets/javascripts/boards/models/list.js.es6 @@ -36,7 +36,7 @@ class List { BoardsStore.state.lists = BoardsStore.state.lists.filter((list) => { return list.id !== this.id; }); - BoardsStore.updateNewListDropdown(); + BoardsStore.updateNewListDropdown(this.id); gl.boardService.destroyList(this.id); } diff --git a/app/assets/javascripts/boards/stores/boards_store.js.es6 b/app/assets/javascripts/boards/stores/boards_store.js.es6 index c32c870fa3f293b61e0967368405345a0b13a102..bc330ba95078f19815dafba99b7b68815f51704e 100644 --- a/app/assets/javascripts/boards/stores/boards_store.js.es6 +++ b/app/assets/javascripts/boards/stores/boards_store.js.es6 @@ -33,16 +33,8 @@ }); this.removeBlankState(); }, - updateNewListDropdown () { - const glDropdown = $('.js-new-board-list').data('glDropdown'); - - if (glDropdown) { - const renderedData = glDropdown.renderedData; - - if (renderedData) { - glDropdown.renderData(renderedData); - } - } + updateNewListDropdown (listId) { + $(`.js-board-list-${listId}`).removeClass('is-active'); }, shouldAddBlankState () { // Decide whether to add the blank state @@ -126,7 +118,7 @@ findList (key, val, type = 'label') { return this.state.lists.filter((list) => { const byType = type ? list['type'] === type : true; - + return list[key] === val && byType; })[0]; }, diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 572e50db15b97848c098e4c19dec321065ee6119..0d023021b72362639217e9fc365c0cc4d501008a 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -1,6 +1,8 @@ require 'rails_helper' describe 'Issue Boards', feature: true, js: true do + include WaitForAjax + let(:project) { create(:project) } let(:user) { create(:user) } let!(:user2) { create(:user) } @@ -102,6 +104,18 @@ describe 'Issue Boards', feature: true, js: true do expect(page).to have_selector('.board', count: 3) end + it 'removes checkmark in new list dropdown after deleting' do + click_button 'Create new list' + wait_for_ajax + + page.within(all('.board')[1]) do + find('.board-delete').click + end + expect(page).to have_selector('.board', count: 3) + + expect(find(".js-board-list-#{planning.id}", visible: false)).not_to have_css('.is-active') + end + it 'infinite scrolls list' do 50.times do create(:issue, project: project)