mirror of
https://github.com/nasa/openmct.git
synced 2025-05-22 18:23:59 +00:00
* fix: use the correct event name for frame deletion * test: add test for frame removal * refactor: update test locators, add a11y * test: upgrade locator * test: assert dialog text
This commit is contained in:
parent
15ee8303e4
commit
b9ae461b7d
@ -284,16 +284,29 @@ test.describe('Flexible Layout Toolbar Actions @localStorage', () => {
|
|||||||
type: 'issue',
|
type: 'issue',
|
||||||
description: 'https://github.com/nasa/openmct/issues/7234'
|
description: 'https://github.com/nasa/openmct/issues/7234'
|
||||||
});
|
});
|
||||||
await page.locator('div:nth-child(5) > .c-fl-container__frames-holder').click();
|
expect(await page.getByRole('group', { name: 'Container' }).count()).toEqual(2);
|
||||||
expect(await page.locator('.c-fl-container').count()).toEqual(2);
|
await page.getByRole('group', { name: 'Container' }).nth(1).click();
|
||||||
await page.getByTitle('Add Container').click();
|
await page.getByTitle('Add Container').click();
|
||||||
expect(await page.locator('.c-fl-container').count()).toEqual(3);
|
expect(await page.getByRole('group', { name: 'Container' }).count()).toEqual(3);
|
||||||
await page.getByTitle('Remove Container').click();
|
await page.getByTitle('Remove Container').click();
|
||||||
|
await expect(page.getByRole('dialog')).toHaveText(
|
||||||
|
'This action will permanently delete this container from this Flexible Layout. Do you want to continue?'
|
||||||
|
);
|
||||||
await page.getByRole('button', { name: 'OK' }).click();
|
await page.getByRole('button', { name: 'OK' }).click();
|
||||||
expect(await page.locator('.c-fl-container').count()).toEqual(2);
|
expect(await page.getByRole('group', { name: 'Container' }).count()).toEqual(2);
|
||||||
|
});
|
||||||
|
test('Remove Frame', async ({ page }) => {
|
||||||
|
expect(await page.getByRole('group', { name: 'Frame' }).count()).toEqual(2);
|
||||||
|
await page.getByRole('group', { name: 'Child Layout 1' }).click();
|
||||||
|
await page.getByTitle('Remove Frame').click();
|
||||||
|
await expect(page.getByRole('dialog')).toHaveText(
|
||||||
|
'This action will remove this frame from this Flexible Layout. Do you want to continue?'
|
||||||
|
);
|
||||||
|
await page.getByRole('button', { name: 'OK' }).click();
|
||||||
|
expect(await page.getByRole('group', { name: 'Frame' }).count()).toEqual(1);
|
||||||
});
|
});
|
||||||
test('Columns/Rows Layout Toggle', async ({ page }) => {
|
test('Columns/Rows Layout Toggle', async ({ page }) => {
|
||||||
await page.locator('div:nth-child(5) > .c-fl-container__frames-holder').click();
|
await page.getByRole('group', { name: 'Container' }).nth(1).click();
|
||||||
expect(await page.locator('.c-fl--rows').count()).toEqual(0);
|
expect(await page.locator('.c-fl--rows').count()).toEqual(0);
|
||||||
await page.getByTitle('Columns layout').click();
|
await page.getByTitle('Columns layout').click();
|
||||||
expect(await page.locator('.c-fl--rows').count()).toEqual(1);
|
expect(await page.locator('.c-fl--rows').count()).toEqual(1);
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
class="c-fl-container"
|
class="c-fl-container"
|
||||||
:style="[{ 'flex-basis': sizeString }]"
|
:style="[{ 'flex-basis': sizeString }]"
|
||||||
:class="{ 'is-empty': !frames.length }"
|
:class="{ 'is-empty': !frames.length }"
|
||||||
|
role="group"
|
||||||
|
:aria-label="`Container ${container.id}`"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-show="isEditing"
|
v-show="isEditing"
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
ref="frame"
|
ref="frame"
|
||||||
class="c-frame c-fl-frame__drag-wrapper is-selectable u-inspectable is-moveable"
|
class="c-frame c-fl-frame__drag-wrapper is-selectable u-inspectable is-moveable"
|
||||||
:draggable="draggable"
|
:draggable="draggable"
|
||||||
|
:aria-label="frameLabel"
|
||||||
|
role="group"
|
||||||
@dragstart="initDrag"
|
@dragstart="initDrag"
|
||||||
>
|
>
|
||||||
<object-frame
|
<object-frame
|
||||||
@ -95,6 +97,9 @@ export default {
|
|||||||
},
|
},
|
||||||
draggable() {
|
draggable() {
|
||||||
return this.isEditing;
|
return this.isEditing;
|
||||||
|
},
|
||||||
|
frameLabel() {
|
||||||
|
return `${this.domainObject?.name} Frame` || 'Frame';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
v-show="isEditing && !isDragging"
|
v-show="isEditing && !isDragging"
|
||||||
class="c-fl-frame__resize-handle"
|
class="c-fl-frame__resize-handle"
|
||||||
:class="[dragOrientation]"
|
:class="[dragOrientation]"
|
||||||
|
:aria-grabbed="isGrabbed"
|
||||||
@mousedown="mousedown"
|
@mousedown="mousedown"
|
||||||
></div>
|
></div>
|
||||||
</template>
|
</template>
|
||||||
@ -49,7 +50,8 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
initialPos: 0,
|
initialPos: 0,
|
||||||
isDragging: false
|
isDragging: false,
|
||||||
|
isGrabbed: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -66,6 +68,7 @@ export default {
|
|||||||
mousedown(event) {
|
mousedown(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
this.isGrabbed = true;
|
||||||
this.$emit('init-move', this.index);
|
this.$emit('init-move', this.index);
|
||||||
|
|
||||||
document.body.addEventListener('mousemove', this.mousemove);
|
document.body.addEventListener('mousemove', this.mousemove);
|
||||||
@ -91,6 +94,7 @@ export default {
|
|||||||
this.$emit('move', this.index, delta, event);
|
this.$emit('move', this.index, delta, event);
|
||||||
},
|
},
|
||||||
mouseup(event) {
|
mouseup(event) {
|
||||||
|
this.isGrabbed = false;
|
||||||
this.$emit('end-move', event);
|
this.$emit('end-move', event);
|
||||||
|
|
||||||
document.body.removeEventListener('mousemove', this.mousemove);
|
document.body.removeEventListener('mousemove', this.mousemove);
|
||||||
|
@ -103,7 +103,7 @@ function ToolbarProvider(openmct) {
|
|||||||
emphasis: 'true',
|
emphasis: 'true',
|
||||||
callback: function () {
|
callback: function () {
|
||||||
openmct.objectViews.emit(
|
openmct.objectViews.emit(
|
||||||
`contextAction:${primaryKeyString}`,
|
`contextAction:${tertiaryKeyString}`,
|
||||||
'deleteFrame',
|
'deleteFrame',
|
||||||
primary.context.frameId
|
primary.context.frameId
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user