mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 07:16:43 +02:00
🐛 Fix local library being collapsed by default (#5775)
* 🐛 Fix local library being collapsed by default * ♻️ Move layers tab spec code to its own file
This commit is contained in:
parent
c774592b9e
commit
2cbc09a0e2
4 changed files with 90 additions and 75 deletions
67
frontend/playwright/ui/specs/assets-tab.spec.js
Normal file
67
frontend/playwright/ui/specs/assets-tab.spec.js
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
import { test, expect } from "@playwright/test";
|
||||||
|
import { WorkspacePage } from "../pages/WorkspacePage";
|
||||||
|
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await WorkspacePage.init(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("User adds a library and its automatically selected in the color palette", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
const workspacePage = new WorkspacePage(page);
|
||||||
|
await workspacePage.setupEmptyFile();
|
||||||
|
await workspacePage.mockRPC(
|
||||||
|
"link-file-to-library",
|
||||||
|
"workspace/link-file-to-library.json",
|
||||||
|
);
|
||||||
|
await workspacePage.mockRPC(
|
||||||
|
"unlink-file-from-library",
|
||||||
|
"workspace/unlink-file-from-library.json",
|
||||||
|
);
|
||||||
|
await workspacePage.mockRPC(
|
||||||
|
"get-team-shared-files?team-id=*",
|
||||||
|
"workspace/get-team-shared-libraries-non-empty.json",
|
||||||
|
);
|
||||||
|
|
||||||
|
await workspacePage.goToWorkspace();
|
||||||
|
|
||||||
|
// Add Testing library 1
|
||||||
|
await workspacePage.clickColorPalette();
|
||||||
|
await workspacePage.clickAssets();
|
||||||
|
// Now the get-file call should return a library
|
||||||
|
await workspacePage.mockRPC(/get\-file\?/, "workspace/get-file-library.json");
|
||||||
|
await workspacePage.openLibrariesModal();
|
||||||
|
await workspacePage.clickLibrary("Testing library 1");
|
||||||
|
await workspacePage.closeLibrariesModal();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
workspacePage.palette.getByRole("button", { name: "test-color-187cd5" }),
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
// Remove Testing library 1
|
||||||
|
await workspacePage.openLibrariesModal();
|
||||||
|
await workspacePage.clickLibrary("Testing library 1");
|
||||||
|
await workspacePage.closeLibrariesModal();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
workspacePage.palette.getByText(
|
||||||
|
"There are no color styles in your library yet",
|
||||||
|
),
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("BUG 10090 - Local library should be expanded by default", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
const workspacePage = new WorkspacePage(page);
|
||||||
|
await workspacePage.setupEmptyFile(page);
|
||||||
|
|
||||||
|
await workspacePage.goToWorkspace();
|
||||||
|
|
||||||
|
await workspacePage.clickAssets();
|
||||||
|
|
||||||
|
expect(workspacePage.sidebar.getByText("Local library")).toBeVisible();
|
||||||
|
expect(workspacePage.sidebar.getByText("Components")).toBeVisible();
|
||||||
|
expect(workspacePage.sidebar.getByText("Colors")).toBeVisible();
|
||||||
|
expect(workspacePage.sidebar.getByText("Typographies")).toBeVisible();
|
||||||
|
});
|
21
frontend/playwright/ui/specs/layers-tab.spec.js
Normal file
21
frontend/playwright/ui/specs/layers-tab.spec.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import { test, expect } from "@playwright/test";
|
||||||
|
import { WorkspacePage } from "../pages/WorkspacePage";
|
||||||
|
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await WorkspacePage.init(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("BUG 7466 - Layers tab height extends to the bottom when 'Pages' is collapsed", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
const workspace = new WorkspacePage(page);
|
||||||
|
await workspace.setupEmptyFile();
|
||||||
|
|
||||||
|
await workspace.goToWorkspace();
|
||||||
|
|
||||||
|
const { height: heightExpanded } = await workspace.layers.boundingBox();
|
||||||
|
await workspace.togglePages();
|
||||||
|
const { height: heightCollapsed } = await workspace.layers.boundingBox();
|
||||||
|
|
||||||
|
expect(heightExpanded > heightCollapsed);
|
||||||
|
});
|
|
@ -1,73 +0,0 @@
|
||||||
import { test, expect } from "@playwright/test";
|
|
||||||
import { WorkspacePage } from "../pages/WorkspacePage";
|
|
||||||
|
|
||||||
test.beforeEach(async ({ page }) => {
|
|
||||||
await WorkspacePage.init(page);
|
|
||||||
});
|
|
||||||
|
|
||||||
test.describe("Layers tab", () => {
|
|
||||||
test("BUG 7466 - Layers tab height extends to the bottom when 'Pages' is collapsed", async ({
|
|
||||||
page,
|
|
||||||
}) => {
|
|
||||||
const workspace = new WorkspacePage(page);
|
|
||||||
await workspace.setupEmptyFile();
|
|
||||||
|
|
||||||
await workspace.goToWorkspace();
|
|
||||||
|
|
||||||
const { height: heightExpanded } = await workspace.layers.boundingBox();
|
|
||||||
await workspace.togglePages();
|
|
||||||
const { height: heightCollapsed } = await workspace.layers.boundingBox();
|
|
||||||
|
|
||||||
expect(heightExpanded > heightCollapsed);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test.describe("Assets tab", () => {
|
|
||||||
test("User adds a library and its automatically selected in the color palette", async ({
|
|
||||||
page,
|
|
||||||
}) => {
|
|
||||||
const workspacePage = new WorkspacePage(page);
|
|
||||||
await workspacePage.setupEmptyFile();
|
|
||||||
await workspacePage.mockRPC(
|
|
||||||
"link-file-to-library",
|
|
||||||
"workspace/link-file-to-library.json",
|
|
||||||
);
|
|
||||||
await workspacePage.mockRPC(
|
|
||||||
"unlink-file-from-library",
|
|
||||||
"workspace/unlink-file-from-library.json",
|
|
||||||
);
|
|
||||||
await workspacePage.mockRPC(
|
|
||||||
"get-team-shared-files?team-id=*",
|
|
||||||
"workspace/get-team-shared-libraries-non-empty.json",
|
|
||||||
);
|
|
||||||
|
|
||||||
await workspacePage.goToWorkspace();
|
|
||||||
|
|
||||||
// Add Testing library 1
|
|
||||||
await workspacePage.clickColorPalette();
|
|
||||||
await workspacePage.clickAssets();
|
|
||||||
// Now the get-file call should return a library
|
|
||||||
await workspacePage.mockRPC(
|
|
||||||
/get\-file\?/,
|
|
||||||
"workspace/get-file-library.json",
|
|
||||||
);
|
|
||||||
await workspacePage.openLibrariesModal();
|
|
||||||
await workspacePage.clickLibrary("Testing library 1");
|
|
||||||
await workspacePage.closeLibrariesModal();
|
|
||||||
|
|
||||||
await expect(
|
|
||||||
workspacePage.palette.getByRole("button", { name: "test-color-187cd5" }),
|
|
||||||
).toBeVisible();
|
|
||||||
|
|
||||||
// Remove Testing library 1
|
|
||||||
await workspacePage.openLibrariesModal();
|
|
||||||
await workspacePage.clickLibrary("Testing library 1");
|
|
||||||
await workspacePage.closeLibrariesModal();
|
|
||||||
|
|
||||||
await expect(
|
|
||||||
workspacePage.palette.getByText(
|
|
||||||
"There are no color styles in your library yet",
|
|
||||||
),
|
|
||||||
).toBeVisible();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -320,7 +320,7 @@
|
||||||
(tr "workspace.assets.not-found")]])]))
|
(tr "workspace.assets.not-found")]])]))
|
||||||
|
|
||||||
(mf/defc file-library*
|
(mf/defc file-library*
|
||||||
[{:keys [file is-local is-default-open? filters]}]
|
[{:keys [file is-local is-default-open filters]}]
|
||||||
(let [file-id (:id file)
|
(let [file-id (:id file)
|
||||||
file-name (:name file)
|
file-name (:name file)
|
||||||
page-id (dm/get-in file [:data :pages 0])
|
page-id (dm/get-in file [:data :pages 0])
|
||||||
|
@ -376,7 +376,7 @@
|
||||||
;; if the user has closed it specifically, respect that
|
;; if the user has closed it specifically, respect that
|
||||||
false
|
false
|
||||||
(or force-lib-open?
|
(or force-lib-open?
|
||||||
(d/nilv (:library open-status) is-default-open?)))
|
(d/nilv (:library open-status) is-default-open)))
|
||||||
|
|
||||||
unselect-all
|
unselect-all
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue