Commit a71467b5 authored by Andrew Fontaine's avatar Andrew Fontaine

Add Action to Remove Project from Env Dashboard

The action `removeProject` was not mapped to the project button. It must
be mapped to the button to remove projects.
parent f735e7b2
...@@ -94,6 +94,7 @@ export default { ...@@ -94,6 +94,7 @@ export default {
'clearSearchResults', 'clearSearchResults',
'toggleSelectedProject', 'toggleSelectedProject',
'setSearchQuery', 'setSearchQuery',
'removeProject',
]), ]),
addProjects() { addProjects() {
this.addProjectsToDashboard(); this.addProjectsToDashboard();
...@@ -153,7 +154,7 @@ export default { ...@@ -153,7 +154,7 @@ export default {
<div class="prepend-top-default"> <div class="prepend-top-default">
<div v-if="projects.length" class="dashboard-cards"> <div v-if="projects.length" class="dashboard-cards">
<div v-for="project in projects" :key="project.id" class="column prepend-top-default"> <div v-for="project in projects" :key="project.id" class="column prepend-top-default">
<project-header :project="project" /> <project-header :project="project" @remove="removeProject" />
<div class="row"> <div class="row">
<environment <environment
v-for="environment in project.environments" v-for="environment in project.environments"
......
---
title: Add Ability to Remove Projects From the Envivonment Dashboard
merge_request: 14563
author:
type: feature
...@@ -26,6 +26,7 @@ describe('dashboard', () => { ...@@ -26,6 +26,7 @@ describe('dashboard', () => {
clearSearchResults: jest.fn(), clearSearchResults: jest.fn(),
setSearchQuery: jest.fn(), setSearchQuery: jest.fn(),
fetchSearchResults: jest.fn(), fetchSearchResults: jest.fn(),
removeProject: jest.fn(),
toggleSelectedProject: jest.fn(), toggleSelectedProject: jest.fn(),
}; };
propsData = { propsData = {
...@@ -89,6 +90,12 @@ describe('dashboard', () => { ...@@ -89,6 +90,12 @@ describe('dashboard', () => {
const headers = wrapper.findAll(ProjectHeader); const headers = wrapper.findAll(ProjectHeader);
expect(headers.length).toBe(2); expect(headers.length).toBe(2);
}); });
it('should remove a project if it emits `remove`', () => {
const header = wrapper.find(ProjectHeader);
header.vm.$emit('remove');
expect(actionSpies.removeProject).toHaveBeenCalled();
});
}); });
describe('environment component', () => { describe('environment component', () => {
......
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