@jskit-ai/workspaces-web 0.1.31 → 0.1.32

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.
@@ -206,3 +206,37 @@ test("resolveProfileSurfaceMenuLinks includes gated non-workspace switches only
206
206
  assert.equal(nonOwnerLinks.some((entry) => entry.id === "surface-switch.ops"), false);
207
207
  assert.equal(ownerLinks.some((entry) => entry.id === "surface-switch.ops"), true);
208
208
  });
209
+
210
+ test("resolveProfileSurfaceMenuLinks excludes surfaces hidden from the generic switch menu", () => {
211
+ const context = createPlacementContext({
212
+ workspace: {
213
+ id: 1,
214
+ slug: "acme"
215
+ },
216
+ workspaces: [
217
+ {
218
+ id: 1,
219
+ slug: "acme"
220
+ }
221
+ ]
222
+ });
223
+
224
+ context.surfaceConfig.enabledSurfaceIds = ["home", "app", "admin", "console"];
225
+ context.surfaceConfig.surfacesById.console = {
226
+ id: "console",
227
+ enabled: true,
228
+ pagesRoot: "console",
229
+ routeBase: "/console",
230
+ requiresAuth: true,
231
+ requiresWorkspace: false,
232
+ accessPolicyId: "public",
233
+ showInSurfaceSwitchMenu: false
234
+ };
235
+
236
+ const links = resolveProfileSurfaceMenuLinks({
237
+ context,
238
+ surface: "app"
239
+ });
240
+
241
+ assert.equal(links.some((entry) => entry.id === "surface-switch.console"), false);
242
+ });
@@ -1,5 +1,6 @@
1
1
  import assert from "node:assert/strict";
2
2
  import test from "node:test";
3
+ import { computed, ref } from "vue";
3
4
  import {
4
5
  createWorkspaceScopeSupport,
5
6
  readWorkspaceRouteScope
@@ -7,31 +8,25 @@ import {
7
8
 
8
9
  test("readWorkspaceRouteScope extracts workspace slug from the current dynamic surface path", () => {
9
10
  const scope = readWorkspaceRouteScope({
10
- placementContext: {
11
- value: {
12
- surfaceConfig: {
13
- defaultSurfaceId: "app",
14
- surfacesById: {
15
- app: {
16
- id: "app",
17
- routeBase: "w/[workspaceSlug]",
18
- requiresWorkspace: true
19
- },
20
- admin: {
21
- id: "admin",
22
- routeBase: "w/[workspaceSlug]/admin",
23
- requiresWorkspace: true
24
- }
11
+ placementContext: ref({
12
+ surfaceConfig: {
13
+ defaultSurfaceId: "app",
14
+ surfacesById: {
15
+ app: {
16
+ id: "app",
17
+ routeBase: "w/[workspaceSlug]",
18
+ requiresWorkspace: true
19
+ },
20
+ admin: {
21
+ id: "admin",
22
+ routeBase: "w/[workspaceSlug]/admin",
23
+ requiresWorkspace: true
25
24
  }
26
25
  }
27
26
  }
28
- },
29
- currentSurfaceId: {
30
- value: "admin"
31
- },
32
- routePath: {
33
- value: "/w/acme/admin/settings"
34
- }
27
+ }),
28
+ currentSurfaceId: computed(() => "admin"),
29
+ routePath: computed(() => "/w/acme/admin/settings")
35
30
  });
36
31
 
37
32
  assert.deepEqual(scope, {
@@ -46,26 +41,20 @@ test("workspace scope support exposes the shared route-scope reader", () => {
46
41
  assert.equal(typeof support.readRouteScope, "function");
47
42
  assert.deepEqual(
48
43
  support.readRouteScope({
49
- placementContext: {
50
- value: {
51
- surfaceConfig: {
52
- defaultSurfaceId: "app",
53
- surfacesById: {
54
- app: {
55
- id: "app",
56
- routeBase: "w/[workspaceSlug]",
57
- requiresWorkspace: true
58
- }
44
+ placementContext: ref({
45
+ surfaceConfig: {
46
+ defaultSurfaceId: "app",
47
+ surfacesById: {
48
+ app: {
49
+ id: "app",
50
+ routeBase: "w/[workspaceSlug]",
51
+ requiresWorkspace: true
59
52
  }
60
53
  }
61
54
  }
62
- },
63
- currentSurfaceId: {
64
- value: "app"
65
- },
66
- routePath: {
67
- value: "/w/dogandgroom"
68
- }
55
+ }),
56
+ currentSurfaceId: computed(() => "app"),
57
+ routePath: computed(() => "/w/dogandgroom")
69
58
  }),
70
59
  {
71
60
  workspaceSlug: "dogandgroom"