Resets modal filters when closing
This commit is contained in:
parent
7e25379062
commit
c3339b332b
4 changed files with 42 additions and 6 deletions
|
@ -18,6 +18,9 @@
|
|||
required: true,
|
||||
},
|
||||
},
|
||||
destroyed() {
|
||||
ModalStore.setDefaultFilter();
|
||||
},
|
||||
components: {
|
||||
'user-filter': gl.issueBoards.ModalFilterUser,
|
||||
'milestone-filter': gl.issueBoards.ModalFilterMilestone,
|
||||
|
|
|
@ -74,6 +74,8 @@
|
|||
this.loadIssues(true);
|
||||
}, 500),
|
||||
loadIssues(clearIssues = false) {
|
||||
if (!this.showAddIssuesModal) return;
|
||||
|
||||
const data = Object.assign({}, this.filter, {
|
||||
search: this.searchTerm,
|
||||
page: this.page,
|
||||
|
|
|
@ -17,12 +17,17 @@
|
|||
loadingNewPage: false,
|
||||
page: 1,
|
||||
perPage: 50,
|
||||
filter: {
|
||||
};
|
||||
|
||||
this.setDefaultFilter();
|
||||
}
|
||||
|
||||
setDefaultFilter() {
|
||||
this.store.filter = {
|
||||
author_id: '',
|
||||
assignee_id: '',
|
||||
milestone_title: '',
|
||||
label_name: [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,32 @@ describe 'Issue Boards add issue modal filtering', :feature, :js do
|
|||
login_as(user)
|
||||
end
|
||||
|
||||
it 'restores filters when closing' do
|
||||
visit_board
|
||||
|
||||
page.within('.add-issues-modal') do
|
||||
click_button 'Milestone'
|
||||
|
||||
wait_for_ajax
|
||||
|
||||
click_link 'Upcoming'
|
||||
|
||||
wait_for_vue_resource
|
||||
|
||||
expect(page).to have_selector('.card', count: 0)
|
||||
|
||||
click_button 'Cancel'
|
||||
end
|
||||
|
||||
click_button('Add issues')
|
||||
|
||||
page.within('.add-issues-modal') do
|
||||
wait_for_vue_resource
|
||||
|
||||
expect(page).to have_selector('.card', count: 1)
|
||||
end
|
||||
end
|
||||
|
||||
context 'author' do
|
||||
let!(:issue) { create(:issue, project: project, author: user2) }
|
||||
|
||||
|
|
Loading…
Reference in a new issue