mirror of
https://github.com/penpot/penpot.git
synced 2025-04-16 17:01:33 -05:00
🐛 Fix "Publish empty library" modal appearing for non-empty libraries (#5838)
* 🐛 Fix 'Publish empty library' modal appearing for non-empty libraries * ✨ Add integration test for bug 10113
This commit is contained in:
parent
fb0e22c16b
commit
fb6cd3d9d4
6 changed files with 261 additions and 9 deletions
115
frontend/playwright/data/workspace/get-file-10113.json
Normal file
115
frontend/playwright/data/workspace/get-file-10113.json
Normal file
|
@ -0,0 +1,115 @@
|
|||
{
|
||||
"~:features": {
|
||||
"~#set": [
|
||||
"layout/grid",
|
||||
"fdata/pointer-map",
|
||||
"fdata/objects-map",
|
||||
"components/v2",
|
||||
"fdata/shape-data-type"
|
||||
]
|
||||
},
|
||||
"~:permissions": {
|
||||
"~:type": "~:membership",
|
||||
"~:is-owner": true,
|
||||
"~:is-admin": true,
|
||||
"~:can-edit": true,
|
||||
"~:can-read": true,
|
||||
"~:is-logged": true
|
||||
},
|
||||
"~:has-media-trimmed": false,
|
||||
"~:comment-thread-seqn": 0,
|
||||
"~:name": "10113 - Emtpy lib",
|
||||
"~:revn": 1,
|
||||
"~:modified-at": "~m1739365936352",
|
||||
"~:vern": 0,
|
||||
"~:id": "~u5b7ebd2b-2907-80db-8005-b9d67c20cf2e",
|
||||
"~:is-shared": false,
|
||||
"~:migrations": {
|
||||
"~#ordered-set": [
|
||||
"legacy-2",
|
||||
"legacy-3",
|
||||
"legacy-5",
|
||||
"legacy-6",
|
||||
"legacy-7",
|
||||
"legacy-8",
|
||||
"legacy-9",
|
||||
"legacy-10",
|
||||
"legacy-11",
|
||||
"legacy-12",
|
||||
"legacy-13",
|
||||
"legacy-14",
|
||||
"legacy-16",
|
||||
"legacy-17",
|
||||
"legacy-18",
|
||||
"legacy-19",
|
||||
"legacy-25",
|
||||
"legacy-26",
|
||||
"legacy-27",
|
||||
"legacy-28",
|
||||
"legacy-29",
|
||||
"legacy-31",
|
||||
"legacy-32",
|
||||
"legacy-33",
|
||||
"legacy-34",
|
||||
"legacy-36",
|
||||
"legacy-37",
|
||||
"legacy-38",
|
||||
"legacy-39",
|
||||
"legacy-40",
|
||||
"legacy-41",
|
||||
"legacy-42",
|
||||
"legacy-43",
|
||||
"legacy-44",
|
||||
"legacy-45",
|
||||
"legacy-46",
|
||||
"legacy-47",
|
||||
"legacy-48",
|
||||
"legacy-49",
|
||||
"legacy-50",
|
||||
"legacy-51",
|
||||
"legacy-52",
|
||||
"legacy-53",
|
||||
"legacy-54",
|
||||
"legacy-55",
|
||||
"legacy-56",
|
||||
"legacy-57",
|
||||
"legacy-59",
|
||||
"legacy-62",
|
||||
"legacy-65",
|
||||
"legacy-66",
|
||||
"legacy-67"
|
||||
]
|
||||
},
|
||||
"~:version": 67,
|
||||
"~:project-id": "~u1ad2931c-eb80-8098-8005-b86c1d9d26c2",
|
||||
"~:created-at": "~m1739365911709",
|
||||
"~:data": {
|
||||
"~:pages": [
|
||||
"~u5b7ebd2b-2907-80db-8005-b9d67c20cf2f"
|
||||
],
|
||||
"~:pages-index": {
|
||||
"~u5b7ebd2b-2907-80db-8005-b9d67c20cf2f": {
|
||||
"~#penpot/pointer": [
|
||||
"~u5b7ebd2b-2907-80db-8005-b9d67c21cbd3",
|
||||
{
|
||||
"~:created-at": "~m1739365911687"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"~:id": "~u5b7ebd2b-2907-80db-8005-b9d67c20cf2e",
|
||||
"~:options": {
|
||||
"~:components-v2": true
|
||||
},
|
||||
"~:colors": {
|
||||
"~u84a1567d-3f0f-804e-8005-b9d6907e3c8a": {
|
||||
"~:path": "",
|
||||
"~:color": "#0087ff",
|
||||
"~:name": "#0087ff",
|
||||
"~:modified-at": "~m1739365936355",
|
||||
"~:opacity": 1,
|
||||
"~:id": "~u84a1567d-3f0f-804e-8005-b9d6907e3c8a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
101
frontend/playwright/data/workspace/get-file-fragment-10113.json
Normal file
101
frontend/playwright/data/workspace/get-file-fragment-10113.json
Normal file
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
"~:id": "~u5b7ebd2b-2907-80db-8005-b9d67c21cbd3",
|
||||
"~:file-id": "~u5b7ebd2b-2907-80db-8005-b9d67c20cf2e",
|
||||
"~:created-at": "~m1739365911680",
|
||||
"~:data": {
|
||||
"~:options": {},
|
||||
"~:objects": {
|
||||
"~u00000000-0000-0000-0000-000000000000": {
|
||||
"~#shape": {
|
||||
"~:y": 0,
|
||||
"~:hide-fill-on-export": false,
|
||||
"~:transform": {
|
||||
"~#matrix": {
|
||||
"~:a": 1.0,
|
||||
"~:b": 0.0,
|
||||
"~:c": 0.0,
|
||||
"~:d": 1.0,
|
||||
"~:e": 0.0,
|
||||
"~:f": 0.0
|
||||
}
|
||||
},
|
||||
"~:rotation": 0,
|
||||
"~:name": "Root Frame",
|
||||
"~:width": 0.01,
|
||||
"~:type": "~:frame",
|
||||
"~:points": [
|
||||
{
|
||||
"~#point": {
|
||||
"~:x": 0.0,
|
||||
"~:y": 0.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"~#point": {
|
||||
"~:x": 0.01,
|
||||
"~:y": 0.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"~#point": {
|
||||
"~:x": 0.01,
|
||||
"~:y": 0.01
|
||||
}
|
||||
},
|
||||
{
|
||||
"~#point": {
|
||||
"~:x": 0.0,
|
||||
"~:y": 0.01
|
||||
}
|
||||
}
|
||||
],
|
||||
"~:r2": 0,
|
||||
"~:proportion-lock": false,
|
||||
"~:transform-inverse": {
|
||||
"~#matrix": {
|
||||
"~:a": 1.0,
|
||||
"~:b": 0.0,
|
||||
"~:c": 0.0,
|
||||
"~:d": 1.0,
|
||||
"~:e": 0.0,
|
||||
"~:f": 0.0
|
||||
}
|
||||
},
|
||||
"~:r3": 0,
|
||||
"~:r1": 0,
|
||||
"~:id": "~u00000000-0000-0000-0000-000000000000",
|
||||
"~:parent-id": "~u00000000-0000-0000-0000-000000000000",
|
||||
"~:frame-id": "~u00000000-0000-0000-0000-000000000000",
|
||||
"~:strokes": [],
|
||||
"~:x": 0,
|
||||
"~:proportion": 1.0,
|
||||
"~:r4": 0,
|
||||
"~:selrect": {
|
||||
"~#rect": {
|
||||
"~:x": 0,
|
||||
"~:y": 0,
|
||||
"~:width": 0.01,
|
||||
"~:height": 0.01,
|
||||
"~:x1": 0,
|
||||
"~:y1": 0,
|
||||
"~:x2": 0.01,
|
||||
"~:y2": 0.01
|
||||
}
|
||||
},
|
||||
"~:fills": [
|
||||
{
|
||||
"~:fill-color": "#FFFFFF",
|
||||
"~:fill-opacity": 1
|
||||
}
|
||||
],
|
||||
"~:flip-x": null,
|
||||
"~:height": 0.01,
|
||||
"~:flip-y": null,
|
||||
"~:shapes": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"~:id": "~u5b7ebd2b-2907-80db-8005-b9d67c20cf2f",
|
||||
"~:name": "Page 1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
[]
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"~:id": "~u5b7ebd2b-2907-80db-8005-b9d67c20cf2e",
|
||||
"~:name": "10113 - Emtpy lib",
|
||||
"~:is-shared": true
|
||||
}
|
|
@ -72,3 +72,41 @@ test("Bug 9056 - 'More info' doesn't open the update tab", async ({ page }) => {
|
|||
/library updates/i,
|
||||
);
|
||||
});
|
||||
|
||||
test("Bug 10113 - Empty library modal for non-empty library", async ({
|
||||
page,
|
||||
}) => {
|
||||
const workspace = new WorkspacePage(page);
|
||||
|
||||
await workspace.setupEmptyFile(page);
|
||||
await workspace.mockRPC(/get\-file\?/, "workspace/get-file-10113.json");
|
||||
await workspace.mockRPC(
|
||||
"get-file-fragment?file-id=*&fragment-id=*",
|
||||
"workspace/get-file-fragment-10113.json",
|
||||
);
|
||||
await workspace.mockRPC(/get\-file\?/, "workspace/get-file-10113.json");
|
||||
await workspace.mockRPC(
|
||||
"get-team-shared-files?team-id=*",
|
||||
"workspace/get-team-shared-files-empty.json",
|
||||
);
|
||||
await workspace.mockRPC(
|
||||
"set-file-shared",
|
||||
"workspace/set-file-shared-10113.json",
|
||||
);
|
||||
|
||||
await workspace.goToWorkspace({
|
||||
fileId: "5b7ebd2b-2907-80db-8005-b9d67c20cf2e",
|
||||
pageId: "5b7ebd2b-2907-80db-8005-b9d67c20cf2f",
|
||||
});
|
||||
|
||||
await workspace.clickAssets();
|
||||
await workspace.openLibrariesModal();
|
||||
|
||||
await workspace.librariesModal
|
||||
.getByRole("button", { name: "Publish" })
|
||||
.click();
|
||||
|
||||
await expect(
|
||||
workspace.page.getByText("Publish empty library"),
|
||||
).not.toBeVisible();
|
||||
});
|
||||
|
|
|
@ -176,15 +176,7 @@
|
|||
(defn- empty-library?
|
||||
"Check if currentt library summary has elements or not"
|
||||
[summary]
|
||||
(let [colors (or (-> summary :colors :count) 0)
|
||||
components (or (-> summary :components :count) 0)
|
||||
media (or (-> summary :media :count) 0)
|
||||
typographies (or (-> summary :typographies :count) 0)]
|
||||
|
||||
(and (zero? colors)
|
||||
(zero? components)
|
||||
(zero? media)
|
||||
(zero? typographies))))
|
||||
(boolean (:is-empty summary)))
|
||||
|
||||
(mf/defc libraries-tab*
|
||||
{::mf/props :obj
|
||||
|
|
Loading…
Add table
Reference in a new issue