Commit 66ed49c5 authored by Brandon Labuschagne's avatar Brandon Labuschagne Committed by Kushal Pandya

Fix analytics dropdown deselect bug

parent 2d58bd00
......@@ -80,10 +80,13 @@ export default {
? this.selectedProjects.concat([selectedProject])
: this.selectedProjects.filter(project => project.id !== selectedProject.id);
},
singleSelectedProject(selectedObj, isMarking) {
return isMarking ? [selectedObj] : [];
},
setSelectedProjects(selectedObj, isMarking) {
this.selectedProjects = this.multiSelect
? this.getSelectedProjects(selectedObj, isMarking)
: [selectedObj];
: this.singleSelectedProject(selectedObj, isMarking);
},
onClick({ selectedObj, e, isMarking }) {
e.preventDefault();
......
......@@ -141,6 +141,23 @@ describe('ProjectsDropdownFilter component', () => {
]);
});
it('selection should be emptied when a project is deselected', () => {
const project = findDropdownItems().at(0);
project.trigger('click');
project.trigger('click');
expect(wrapper.emittedByOrder()).toEqual([
{
name: 'selected',
args: [[projects[0]]],
},
{
name: 'selected',
args: [[]],
},
]);
});
it('renders an avatar in the dropdown button when the project has an avatar_url', done => {
findDropdownItems()
.at(0)
......
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