From 4b08aa93e610c31f05dff9811640277a75828c6d Mon Sep 17 00:00:00 2001 From: Jamie V Date: Thu, 5 Jan 2023 12:39:49 -0800 Subject: [PATCH] fixing tests --- .../plugins/notebook/restrictedNotebook.e2e.spec.js | 4 ++-- src/plugins/notebook/components/NotebookEmbed.vue | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/tests/functional/plugins/notebook/restrictedNotebook.e2e.spec.js b/e2e/tests/functional/plugins/notebook/restrictedNotebook.e2e.spec.js index 6a51238fd2..08ab8ef92e 100644 --- a/e2e/tests/functional/plugins/notebook/restrictedNotebook.e2e.spec.js +++ b/e2e/tests/functional/plugins/notebook/restrictedNotebook.e2e.spec.js @@ -152,7 +152,7 @@ test.describe('Restricted Notebook with a page locked and with an embed @addInit test('Allows embeds to be deleted if page unlocked @addInit', async ({ page }) => { // Click .c-ne__embed__name .c-popup-menu-button - await page.locator('.c-ne__embed__name .c-popup-menu-button').click(); // embed popup menu + await page.locator('.c-ne__embed__name .c-icon-button').click(); // embed popup menu const embedMenu = page.locator('body >> .c-menu'); await expect(embedMenu).toContainText('Remove This Embed'); @@ -161,7 +161,7 @@ test.describe('Restricted Notebook with a page locked and with an embed @addInit test('Disallows embeds to be deleted if page locked @addInit', async ({ page }) => { await lockPage(page); // Click .c-ne__embed__name .c-popup-menu-button - await page.locator('.c-ne__embed__name .c-popup-menu-button').click(); // embed popup menu + await page.locator('.c-ne__embed__name .c-icon-button').click(); // embed popup menu const embedMenu = page.locator('body >> .c-menu'); await expect(embedMenu).not.toContainText('Remove This Embed'); diff --git a/src/plugins/notebook/components/NotebookEmbed.vue b/src/plugins/notebook/components/NotebookEmbed.vue index 12c17b4ab5..9ad420fc3c 100644 --- a/src/plugins/notebook/components/NotebookEmbed.vue +++ b/src/plugins/notebook/components/NotebookEmbed.vue @@ -70,8 +70,7 @@ export default { }, data() { return { - menuActions: [], - objectPath: [] + menuActions: [] }; }, computed: { @@ -94,6 +93,7 @@ export default { } }, async mounted() { + this.objectPath = []; await this.setEmbedObjectPath(); this.addMenuActions(); this.imageExporter = new ImageExporter(this.openmct); @@ -165,7 +165,7 @@ export default { async setEmbedObjectPath() { this.objectPath = await this.openmct.objects.getOriginalPath(this.embed.domainObject.identifier); - if (this.objectPath[this.objectPath.length - 1].type === 'root') { + if (this.objectPath.length > 0 && this.objectPath[this.objectPath.length - 1].type === 'root') { this.objectPath.pop(); } },