From a961d7e3bf2e2fe707445a2b3b610405cd99c4ab Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Thu, 18 Apr 2024 16:38:11 -0700 Subject: [PATCH] Fix nested Flexible Layout direction problem (#7637) * Closes #7635 - More specific approach to CSS class application for column vs. row layouts. - Added layout direction CSS classing to `c-fl-container__frames-holder`. - Switched toolbar icon and titling for better parity with 'toggle' approach used elsewhere. - Cleaned up duped property def in mixin. * Addressing PR change requests - Updated e2e test. - New computed properties for layout direction. - CSS code cleanup. * fix selector in test * fix more bad selectors * fix changed title --------- Co-authored-by: David Tsay --- .../flexibleLayout/flexibleLayout.e2e.spec.js | 20 ++++++++-------- e2e/tests/functional/tooltips.e2e.spec.js | 4 ++-- .../components/ContainerComponent.vue | 5 +++- .../components/FlexibleLayout.vue | 17 ++++--------- .../components/flexible-layout.scss | 24 +++++++++++-------- src/plugins/flexibleLayout/toolbarProvider.js | 8 +++---- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/e2e/tests/functional/plugins/flexibleLayout/flexibleLayout.e2e.spec.js b/e2e/tests/functional/plugins/flexibleLayout/flexibleLayout.e2e.spec.js index 9024199953e..d82e4a87ee0 100644 --- a/e2e/tests/functional/plugins/flexibleLayout/flexibleLayout.e2e.spec.js +++ b/e2e/tests/functional/plugins/flexibleLayout/flexibleLayout.e2e.spec.js @@ -78,8 +78,8 @@ test.describe('Flexible Layout', () => { // Expand the 'My Items' folder in the left tree await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click(); // Add the Sine Wave Generator and Clock to the Flexible Layout - await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first()); - await clockTreeItem.dragTo(page.locator('.c-fl__container.is-empty')); + await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl-container.is-empty').first()); + await clockTreeItem.dragTo(page.locator('.c-fl-container.is-empty')); // Check that panes can be dragged while Flexible Layout is in Edit mode let dragWrapper = page .locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper') @@ -105,8 +105,8 @@ test.describe('Flexible Layout', () => { // Expand the 'My Items' folder in the left tree await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click(); // Add the Sine Wave Generator and Clock to the Flexible Layout - await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first()); - await clockTreeItem.dragTo(page.locator('.c-fl__container.is-empty')); + await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl-container.is-empty').first()); + await clockTreeItem.dragTo(page.locator('.c-fl-container.is-empty')); // Click on the first frame to select it await page.locator('.c-fl-container__frame').first().click(); @@ -122,7 +122,7 @@ test.describe('Flexible Layout', () => { expect(await page.locator('.c-fl--rows').count()).toEqual(0); // Change the layout to rows orientation - await page.getByTitle('Columns layout').click(); + await page.getByTitle('Switch to rows layout').click(); // Assert the layout is in rows orientation expect(await page.locator('.c-fl--rows').count()).toBeGreaterThan(0); @@ -171,7 +171,7 @@ test.describe('Flexible Layout', () => { // Expand the 'My Items' folder in the left tree await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click(); // Add the Sine Wave Generator to the Flexible Layout and save changes - await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first()); + await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl-container.is-empty').first()); await page.locator('button[title="Save"]').click(); await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); @@ -202,7 +202,7 @@ test.describe('Flexible Layout', () => { // Expand the 'My Items' folder in the left tree await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click(); // Add the Sine Wave Generator to the Flexible Layout and save changes - await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first()); + await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl-container.is-empty').first()); await page.locator('button[title="Save"]').click(); await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); @@ -242,7 +242,7 @@ test.describe('Flexible Layout', () => { name: new RegExp(exampleImageryObject.name) }); // Add the Sine Wave Generator to the Flexible Layout and save changes - await exampleImageryTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first()); + await exampleImageryTreeItem.dragTo(page.locator('.c-fl-container.is-empty').first()); await page.locator('button[title="Save"]').click(); await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); @@ -309,9 +309,9 @@ test.describe('Flexible Layout Toolbar Actions @localStorage', () => { await page.getByRole('columnheader', { name: 'Container Handle 1' }).click(); const flexRows = page.getByLabel('Flexible Layout Row'); expect(await flexRows.count()).toEqual(0); - await page.getByTitle('Columns layout').click(); + await page.getByTitle('Switch to rows layout').click(); expect(await flexRows.count()).toEqual(1); - await page.getByTitle('Rows layout').click(); + await page.getByTitle('Switch to columns layout').click(); expect(await flexRows.count()).toEqual(0); }); }); diff --git a/e2e/tests/functional/tooltips.e2e.spec.js b/e2e/tests/functional/tooltips.e2e.spec.js index 711abfd786b..8782871a566 100644 --- a/e2e/tests/functional/tooltips.e2e.spec.js +++ b/e2e/tests/functional/tooltips.e2e.spec.js @@ -265,8 +265,8 @@ test.describe('Verify tooltips', () => { name: 'Test Flexible Layout' }); - await page.dragAndDrop(`text=${sineWaveObject1.name}`, '.c-fl__container >> nth=0'); - await page.dragAndDrop(`text=${sineWaveObject3.name}`, '.c-fl__container >> nth=1'); + await page.dragAndDrop(`text=${sineWaveObject1.name}`, '.c-fl-container >> nth=0'); + await page.dragAndDrop(`text=${sineWaveObject3.name}`, '.c-fl-container >> nth=1'); await page.locator('button[title="Save"]').click(); await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); diff --git a/src/plugins/flexibleLayout/components/ContainerComponent.vue b/src/plugins/flexibleLayout/components/ContainerComponent.vue index a0d03acc466..ea869a524d8 100644 --- a/src/plugins/flexibleLayout/components/ContainerComponent.vue +++ b/src/plugins/flexibleLayout/components/ContainerComponent.vue @@ -45,7 +45,7 @@ @object-drop-to="moveOrCreateNewFrame" /> -
+