Context click should add a class to tree item (#3619)

* add ability to pass onDestroy callback to menu api show

* fix lint issues

* remove fdescribe

* rename event and variables to contextClickActive

* rename variable to active

* Sanding and polishing CSS related to context-click visual feedback

- Changed CSS `border` approach to `box-shadow` to avoid jumping;
- Removed unwired code and CSS styles for Folder grid and list views;

Co-authored-by: Jamie V <jamie.j.vigliotta@nasa.gov>
Co-authored-by: charlesh88 <charlesh88@gmail.com>
This commit is contained in:
Deep Tailor
2021-01-04 12:57:18 -08:00
committed by GitHub
parent 26b81345f2
commit 98207a3e0d
6 changed files with 40 additions and 7 deletions

View File

@ -38,7 +38,7 @@ class MenuAPI {
this._showObjectMenu = this._showObjectMenu.bind(this);
}
showMenu(x, y, actions) {
showMenu(x, y, actions, onDestroy) {
if (this.menuComponent) {
this.menuComponent.dismiss();
}
@ -46,7 +46,8 @@ class MenuAPI {
let options = {
x,
y,
actions
actions,
onDestroy
};
this.menuComponent = new Menu(options);

View File

@ -31,6 +31,7 @@ describe ('The Menu API', () => {
let x;
let y;
let result;
let onDestroy;
beforeEach(() => {
openmct = createOpenMct();
@ -73,7 +74,9 @@ describe ('The Menu API', () => {
let vueComponent;
beforeEach(() => {
menuAPI.showMenu(x, y, actionsArray);
onDestroy = jasmine.createSpy('onDestroy');
menuAPI.showMenu(x, y, actionsArray, onDestroy);
vueComponent = menuAPI.menuComponent.component;
menuComponent = document.querySelector(".c-menu");
@ -120,6 +123,12 @@ describe ('The Menu API', () => {
expect(vueComponent.$destroy).toHaveBeenCalled();
});
it("invokes the onDestroy callback if passed in", () => {
document.body.click();
expect(onDestroy).toHaveBeenCalled();
});
});
});
});