Skip to content

Commit

Permalink
Merge branch 'master' into 7235-provide-visibility-based-rendering-as…
Browse files Browse the repository at this point in the history
…-part-of-the-view-api
  • Loading branch information
unlikelyzero committed Nov 20, 2023
2 parents ab17603 + b9ae461 commit ecd6bb9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,29 @@ test.describe('Flexible Layout Toolbar Actions @localStorage', () => {
type: 'issue',
description: 'https://github.com/nasa/openmct/issues/7234'
});
await page.locator('div:nth-child(5) > .c-fl-container__frames-holder').click();
expect(await page.locator('.c-fl-container').count()).toEqual(2);
expect(await page.getByRole('group', { name: 'Container' }).count()).toEqual(2);
await page.getByRole('group', { name: 'Container' }).nth(1).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 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();
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 }) => {
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);
await page.getByTitle('Columns layout').click();
expect(await page.locator('.c-fl--rows').count()).toEqual(1);
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/flexibleLayout/components/ContainerComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
class="c-fl-container"
:style="[{ 'flex-basis': sizeString }]"
:class="{ 'is-empty': !frames.length }"
role="group"
:aria-label="`Container ${container.id}`"
>
<div
v-show="isEditing"
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/flexibleLayout/components/FrameComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
ref="frame"
class="c-frame c-fl-frame__drag-wrapper is-selectable u-inspectable is-moveable"
:draggable="draggable"
:aria-label="frameLabel"
role="group"
@dragstart="initDrag"
>
<object-frame
Expand Down Expand Up @@ -95,6 +97,9 @@ export default {
},
draggable() {
return this.isEditing;
},
frameLabel() {
return `${this.domainObject?.name} Frame` || 'Frame';
}
},
mounted() {
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/flexibleLayout/components/ResizeHandle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
v-show="isEditing && !isDragging"
class="c-fl-frame__resize-handle"
:class="[dragOrientation]"
:aria-grabbed="isGrabbed"
@mousedown="mousedown"
></div>
</template>
Expand All @@ -49,7 +50,8 @@ export default {
data() {
return {
initialPos: 0,
isDragging: false
isDragging: false,
isGrabbed: false
};
},
mounted() {
Expand All @@ -66,6 +68,7 @@ export default {
mousedown(event) {
event.preventDefault();
this.isGrabbed = true;
this.$emit('init-move', this.index);
document.body.addEventListener('mousemove', this.mousemove);
Expand All @@ -91,6 +94,7 @@ export default {
this.$emit('move', this.index, delta, event);
},
mouseup(event) {
this.isGrabbed = false;
this.$emit('end-move', event);
document.body.removeEventListener('mousemove', this.mousemove);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/flexibleLayout/toolbarProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function ToolbarProvider(openmct) {
emphasis: 'true',
callback: function () {
openmct.objectViews.emit(
`contextAction:${primaryKeyString}`,
`contextAction:${tertiaryKeyString}`,
'deleteFrame',
primary.context.frameId
);
Expand Down

0 comments on commit ecd6bb9

Please sign in to comment.