mirror of
https://github.com/nasa/openmct.git
synced 2025-06-22 17:08:57 +00:00
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:
@ -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);
|
||||
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user