Commit cd6285d2 authored by Phil Hughes's avatar Phil Hughes

Removes checkmarks from new list dropdown when deleting list

parent 86a6d4d8
...@@ -16,7 +16,7 @@ $(() => { ...@@ -16,7 +16,7 @@ $(() => {
const active = BoardsStore.findList('title', label.title), const active = BoardsStore.findList('title', label.title),
$li = $('<li />',), $li = $('<li />',),
$a = $('<a />', { $a = $('<a />', {
class: (active ? 'is-active' : ''), class: (active ? `is-active js-board-list-${active.id}` : ''),
text: label.title, text: label.title,
href: '#' href: '#'
}), }),
...@@ -39,6 +39,7 @@ $(() => { ...@@ -39,6 +39,7 @@ $(() => {
BoardsStore.new({ BoardsStore.new({
title: label.title, title: label.title,
position: BoardsStore.state.lists.length - 1, position: BoardsStore.state.lists.length - 1,
list_type: 'label',
label: { label: {
id: label.id, id: label.id,
title: label.title, title: label.title,
......
...@@ -36,7 +36,7 @@ class List { ...@@ -36,7 +36,7 @@ class List {
BoardsStore.state.lists = BoardsStore.state.lists.filter((list) => { BoardsStore.state.lists = BoardsStore.state.lists.filter((list) => {
return list.id !== this.id; return list.id !== this.id;
}); });
BoardsStore.updateNewListDropdown(); BoardsStore.updateNewListDropdown(this.id);
gl.boardService.destroyList(this.id); gl.boardService.destroyList(this.id);
} }
......
...@@ -33,16 +33,8 @@ ...@@ -33,16 +33,8 @@
}); });
this.removeBlankState(); this.removeBlankState();
}, },
updateNewListDropdown () { updateNewListDropdown (listId) {
const glDropdown = $('.js-new-board-list').data('glDropdown'); $(`.js-board-list-${listId}`).removeClass('is-active');
if (glDropdown) {
const renderedData = glDropdown.renderedData;
if (renderedData) {
glDropdown.renderData(renderedData);
}
}
}, },
shouldAddBlankState () { shouldAddBlankState () {
// Decide whether to add the blank state // Decide whether to add the blank state
...@@ -126,7 +118,7 @@ ...@@ -126,7 +118,7 @@
findList (key, val, type = 'label') { findList (key, val, type = 'label') {
return this.state.lists.filter((list) => { return this.state.lists.filter((list) => {
const byType = type ? list['type'] === type : true; const byType = type ? list['type'] === type : true;
return list[key] === val && byType; return list[key] === val && byType;
})[0]; })[0];
}, },
......
require 'rails_helper' require 'rails_helper'
describe 'Issue Boards', feature: true, js: true do describe 'Issue Boards', feature: true, js: true do
include WaitForAjax
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:user2) { create(:user) } let!(:user2) { create(:user) }
...@@ -102,6 +104,18 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -102,6 +104,18 @@ describe 'Issue Boards', feature: true, js: true do
expect(page).to have_selector('.board', count: 3) expect(page).to have_selector('.board', count: 3)
end 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 it 'infinite scrolls list' do
50.times do 50.times do
create(:issue, project: project) create(:issue, project: project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment