@multiplatform.one/backoffice 8.3.0 → 8.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/backoffice",
3
- "version": "8.3.0",
3
+ "version": "8.5.0",
4
4
  "description": "Embeddable Frappe desk recreation (backoffice) for the multiplatform.one stack",
5
5
  "keywords": [
6
6
  "backoffice",
@@ -71,20 +71,20 @@
71
71
  "access": "public"
72
72
  },
73
73
  "dependencies": {
74
- "@multiplatform.one/components": "^8.3.0",
75
- "@multiplatform.one/forms": "^8.3.0",
76
- "@multiplatform.one/frappe": "^8.3.0",
77
- "@multiplatform.one/frappe-ui": "^8.3.0",
78
- "@multiplatform.one/platform": "^8.3.0",
79
- "@multiplatform.one/store": "^8.3.0",
80
- "@multiplatform.one/table": "^8.3.0",
81
- "@multiplatform.one/theme": "^8.3.0",
74
+ "@multiplatform.one/components": "^8.5.0",
75
+ "@multiplatform.one/forms": "^8.5.0",
76
+ "@multiplatform.one/frappe": "^8.5.0",
77
+ "@multiplatform.one/frappe-ui": "^8.5.0",
78
+ "@multiplatform.one/platform": "^8.5.0",
79
+ "@multiplatform.one/store": "^8.5.0",
80
+ "@multiplatform.one/table": "^8.5.0",
81
+ "@multiplatform.one/theme": "^8.5.0",
82
82
  "@phosphor-icons/react": "^2.1.10",
83
83
  "tamagui": "2.7.6"
84
84
  },
85
85
  "devDependencies": {
86
- "@multiplatform.one/config": "8.3.0",
87
- "@multiplatform.one/test-utils": "8.3.0",
86
+ "@multiplatform.one/config": "8.5.0",
87
+ "@multiplatform.one/test-utils": "8.5.0",
88
88
  "@tamagui/build": "2.7.6",
89
89
  "@testing-library/react": "^16.3.3",
90
90
  "@types/react-dom": "^19.2.3",
@@ -3,13 +3,17 @@ import { InMemoryFixtureProvider } from "@multiplatform.one/frappe";
3
3
  import { renderWithProviders } from "@multiplatform.one/test-utils";
4
4
  import { fireEvent, screen, waitFor, within } from "@testing-library/react";
5
5
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
6
- import { getSizeRecipeFamily } from "@multiplatform.one/theme";
6
+ import { createDefaultThemeConfig, getSizeRecipeFamily } from "@multiplatform.one/theme";
7
7
  import { createMemoryNavigator } from "../navigation/navigator";
8
8
  import { BackofficeShell } from "../shell/BackofficeShell";
9
9
  import { BackofficeProvider, type BackofficeProviderProps } from "../config/BackofficeProvider";
10
10
  import { CommandPalette } from "./CommandPalette";
11
11
  import type { RecentItem } from "./awesomebar-data";
12
12
 
13
+ // LC-05: the highlight paints `$selectFill` / `$selectPress`, keys only MPO's
14
+ // themes define (FZ-8400), so the palette renders under MPO's own config.
15
+ createDefaultThemeConfig({});
16
+
13
17
  // The shared desk recents store rides @multiplatform.one/store, which the
14
18
  // vitest module graph duplicates (inlined vs externalized resolutions), so a
15
19
  // spec-side storage write never reaches the copy the palette reads. Stub the
@@ -251,9 +255,9 @@ describe("CommandPalette keyboard", () => {
251
255
  await waitFor(() => {
252
256
  const selected = document.querySelector('[role="option"][aria-selected="true"]');
253
257
  expect(selected).toBe(document.querySelectorAll('[role="option"]')[0]);
254
- expect(selected?.className).toContain("_bg-color4");
255
- expect(selected?.className).toContain("_bg-0hover-color5");
256
- expect(selected?.className).toContain("_bg-0active-color5");
258
+ expect(selected?.className).toContain("_bg-selectFill");
259
+ expect(selected?.className).toContain("_bg-0hover-selectPress");
260
+ expect(selected?.className).toContain("_bg-0active-selectPress");
257
261
  expect(selected?.querySelector(".is_Text")?.className).toContain("_col-color12");
258
262
  });
259
263
  });
@@ -4,7 +4,6 @@
4
4
  // nothing.
5
5
  import React from "react";
6
6
  import { InMemoryFixtureProvider, type FrappeDocData } from "@multiplatform.one/frappe";
7
- import { storage } from "@multiplatform.one/store";
8
7
  import { renderWithProviders } from "@multiplatform.one/test-utils";
9
8
  import { cleanup, fireEvent, screen, waitFor, within } from "@testing-library/react";
10
9
  import { afterEach, describe, expect, it, vi } from "vitest";
@@ -14,6 +13,24 @@ import { createMemoryNavigator } from "../navigation/navigator";
14
13
  import { AllDoctypesScreen, groupDoctypesByModule, recentDoctypes } from "./AllDoctypesScreen";
15
14
  import { WorkspaceSidebar } from "./WorkspaceSidebar";
16
15
 
16
+ const stored = new Map<string, string>();
17
+
18
+ vi.mock("@multiplatform.one/store", async (importOriginal) => {
19
+ const actual = await importOriginal<Record<string, unknown>>();
20
+ return {
21
+ ...actual,
22
+ storage: {
23
+ getItem: (key: string) => stored.get(key) ?? null,
24
+ setItem: (key: string, value: string) => {
25
+ stored.set(key, value);
26
+ },
27
+ removeItem: (key: string) => {
28
+ stored.delete(key);
29
+ },
30
+ },
31
+ };
32
+ });
33
+
17
34
  const doctypeRows = [
18
35
  { name: "User", module: "Core", istable: 0, issingle: 0 },
19
36
  { name: "ToDo", module: "Desk", istable: 0, issingle: 0 },
@@ -70,6 +87,7 @@ function json(body: unknown, status = 200) {
70
87
 
71
88
  afterEach(() => {
72
89
  cleanup();
90
+ stored.clear();
73
91
  vi.unstubAllGlobals();
74
92
  });
75
93
 
@@ -140,28 +158,24 @@ describe("All DocTypes page", () => {
140
158
  });
141
159
 
142
160
  it("leads with the DocTypes visited last", async () => {
143
- await storage.setItem(
161
+ stored.set(
144
162
  "frappe-desk-recent",
145
163
  JSON.stringify([
146
164
  { label: "Trainer: Ash", path: "/backoffice/trainer/Ash" },
147
165
  { label: "User", path: "/backoffice/user" },
148
166
  ]),
149
167
  );
150
- try {
151
- renderScreen();
152
- const recent = await screen.findByTestId("all-doctypes-recent");
153
- expect(
154
- within(recent)
155
- .getAllByTestId("all-doctypes-row")
156
- .map((row) => row.textContent),
157
- ).toEqual(["Trainer", "User"]);
158
- const firstModule = screen.getAllByTestId("all-doctypes-module")[0];
159
- expect(
160
- recent.compareDocumentPosition(firstModule) & Node.DOCUMENT_POSITION_FOLLOWING,
161
- ).toBeTruthy();
162
- } finally {
163
- await storage.removeItem("frappe-desk-recent");
164
- }
168
+ renderScreen();
169
+ const recent = await screen.findByTestId("all-doctypes-recent");
170
+ expect(
171
+ within(recent)
172
+ .getAllByTestId("all-doctypes-row")
173
+ .map((row) => row.textContent),
174
+ ).toEqual(["Trainer", "User"]);
175
+ const firstModule = screen.getAllByTestId("all-doctypes-module")[0];
176
+ expect(
177
+ recent.compareDocumentPosition(firstModule) & Node.DOCUMENT_POSITION_FOLLOWING,
178
+ ).toBeTruthy();
165
179
  });
166
180
 
167
181
  it("with a doctypes list lists only those", async () => {
@@ -1,4 +1,5 @@
1
1
  import { InMemoryFixtureProvider } from "@multiplatform.one/frappe";
2
+ import { createDefaultThemeConfig } from "@multiplatform.one/theme";
2
3
  import { renderWithProviders } from "@multiplatform.one/test-utils";
3
4
  import { cleanup, screen, waitFor } from "@testing-library/react";
4
5
  import { afterEach, describe, expect, it } from "vitest";
@@ -6,6 +7,8 @@ import { BackofficeProvider } from "../config/BackofficeProvider";
6
7
  import { createMemoryNavigator } from "../navigation/navigator";
7
8
  import { WorkspaceSidebar } from "./WorkspaceSidebar";
8
9
 
10
+ createDefaultThemeConfig({});
11
+
9
12
  const MOCK_HOST = "https://backoffice-shell-nav.mock.test";
10
13
 
11
14
  const makeFixtures = () =>
@@ -104,7 +107,7 @@ describe("WorkspaceSidebar is MPO's Sidebar (LC-175)", () => {
104
107
  expect(rows[2].querySelectorAll("[data-sidebar-indent]")).toHaveLength(1);
105
108
  expect(rows[1].getAttribute("data-depth")).toBeNull();
106
109
 
107
- expect(rows[1].className).toContain("_bg-color4");
110
+ expect(rows[1].className).toContain("_bg-selectFill");
108
111
  expect(rows[1].getAttribute("data-active")).toBe("true");
109
112
  expect(rows[1].getAttribute("aria-current")).toBe("page");
110
113
  expect(rows[0].getAttribute("data-active")).toBeNull();