@jskit-ai/shell-web 0.1.148 → 0.1.150
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/CHANGELOG.md +9 -0
- package/fixtures/adaptive-shell/index.html +12 -0
- package/fixtures/adaptive-shell/src/App.vue +27 -0
- package/fixtures/adaptive-shell/src/ScreenPage.vue +14 -0
- package/fixtures/adaptive-shell/src/main.js +197 -0
- package/fixtures/adaptive-shell/vite.config.mjs +17 -0
- package/package.descriptor.mjs +2 -2
- package/package.json +2 -2
- package/src/client/components/ShellLayout.vue +283 -13
- package/src/client/components/ShellMenuLinkItem.vue +18 -10
- package/src/client/components/ShellNavigationTooltip.vue +37 -0
- package/src/client/components/ShellSurfaceAwareMenuLinkItem.vue +18 -10
- package/src/client/support/drawerPresentation.js +58 -0
- package/src/client/support/drawerWidth.js +74 -0
- package/src/client/support/navigationLinkKeyboard.js +10 -0
- package/src/test/adaptiveShellSmoke.js +180 -4
- package/templates/src/components/ShellLayout.vue +1 -0
- package/templates/src/pages/home/settings/general/index.vue +2 -2
- package/test/adaptiveShell.browser.test.js +290 -0
- package/test/drawerPresentation.test.js +68 -0
- package/test/drawerWidth.test.js +48 -0
- package/test/linkItemScaffoldContract.test.js +20 -0
- package/test/navigationLinkKeyboard.test.js +36 -0
- package/test/playwrightContract.test.js +15 -0
- package/test/settingsPlacementContract.test.js +21 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { activateShellNavigationLinkOnSpace } from "../src/client/support/navigationLinkKeyboard.js";
|
|
4
|
+
|
|
5
|
+
test("Space activates a shell navigation link once and suppresses page scrolling", () => {
|
|
6
|
+
const calls = [];
|
|
7
|
+
activateShellNavigationLinkOnSpace({
|
|
8
|
+
key: " ",
|
|
9
|
+
currentTarget: {
|
|
10
|
+
click() {
|
|
11
|
+
calls.push("click");
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
preventDefault() {
|
|
15
|
+
calls.push("preventDefault");
|
|
16
|
+
},
|
|
17
|
+
stopPropagation() {
|
|
18
|
+
calls.push("stopPropagation");
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
assert.deepEqual(calls, ["preventDefault", "stopPropagation", "click"]);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("other keys retain native link behavior", () => {
|
|
26
|
+
let clicked = false;
|
|
27
|
+
activateShellNavigationLinkOnSpace({
|
|
28
|
+
key: "Enter",
|
|
29
|
+
currentTarget: {
|
|
30
|
+
click() {
|
|
31
|
+
clicked = true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
assert.equal(clicked, false);
|
|
36
|
+
});
|
|
@@ -24,3 +24,18 @@ test("adaptive shell smoke navigates through Playwright baseURL", async () => {
|
|
|
24
24
|
assert.doesNotMatch(source, /PLAYWRIGHT_BASE_URL/u);
|
|
25
25
|
assert.doesNotMatch(source, /http:\/\/127\.0\.0\.1/u);
|
|
26
26
|
});
|
|
27
|
+
|
|
28
|
+
test("adaptive shell smoke follows rendered layout state and waits for drawer transitions", async () => {
|
|
29
|
+
const source = await readFile(path.join(PACKAGE_ROOT, "src/test/adaptiveShellSmoke.js"), "utf8");
|
|
30
|
+
|
|
31
|
+
assert.match(source, /data-layout/u);
|
|
32
|
+
assert.match(source, /data-rail-width/u);
|
|
33
|
+
assert.match(source, /expect\.poll/u);
|
|
34
|
+
assert.match(source, /toBeFocused/u);
|
|
35
|
+
assert.match(source, /v-navigation-drawer__scrim/u);
|
|
36
|
+
assert.match(source, /page\.keyboard\.press\("Escape"\)[\s\S]*data-presentation", "drawer"/u);
|
|
37
|
+
assert.match(source, /iconBox\.x \+ iconBox\.width \/ 2/u);
|
|
38
|
+
assert.match(source, /endGap\)\.toBeGreaterThanOrEqual\(9\)/u);
|
|
39
|
+
assert.doesNotMatch(source, /viewport\.name === "compact"/u);
|
|
40
|
+
assert.doesNotMatch(source, /await new Promise.*setTimeout|waitForTimeout/u);
|
|
41
|
+
});
|
|
@@ -95,12 +95,29 @@ test("shell-web shell layout registers navigation at the app layout level", asyn
|
|
|
95
95
|
assert.match(source, /target="shell-layout:primary-menu"[\s\S]*default/);
|
|
96
96
|
assert.doesNotMatch(source, /target="shell-layout:primary-bottom-nav"[\s\S]*default/);
|
|
97
97
|
assert.match(source, /data-testid="jskit-shell-drawer"/);
|
|
98
|
+
assert.match(source, /desktopDrawerClosedMode/);
|
|
99
|
+
assert.match(source, /default: "rail"/);
|
|
100
|
+
assert.match(source, /:rail="drawerPresentation\.rail"/);
|
|
101
|
+
assert.match(source, /drawerWidth/);
|
|
102
|
+
assert.match(source, /railWidth/);
|
|
103
|
+
assert.match(source, /:width="resolvedDrawerWidth"/);
|
|
104
|
+
assert.match(source, /:rail-width="resolvedRailWidth"/);
|
|
105
|
+
assert.match(source, /data-drawer-width="resolvedDrawerWidth"/);
|
|
106
|
+
assert.match(source, /data-rail-width="resolvedRailWidth"/);
|
|
107
|
+
assert.match(source, /data-layout="layoutClass"/);
|
|
108
|
+
assert.match(source, /measureDrawerContentWidth/);
|
|
109
|
+
assert.match(source, /SHELL_DRAWER_LABEL_END_GAP/);
|
|
110
|
+
assert.doesNotMatch(source, /:width="248"/);
|
|
111
|
+
assert.doesNotMatch(source, /:rail-width="80"/);
|
|
112
|
+
assert.match(source, /:model-value="drawerPresentation\.visible"/);
|
|
113
|
+
assert.match(source, /data-testid="jskit-shell-nav-toggle"/);
|
|
98
114
|
assert.match(source, /data-testid="jskit-shell-bottom-nav"/);
|
|
99
115
|
assert.match(source, /padding:\s*0\.75rem 1rem calc\(1rem \+ env\(safe-area-inset-bottom, 0px\)\)/);
|
|
100
116
|
|
|
101
117
|
const template = await readFile(path.join(PACKAGE_DIR, "templates", "src", "components", "ShellLayout.vue"), "utf8");
|
|
102
118
|
|
|
103
119
|
assert.match(template, /PackageShellLayout from "@jskit-ai\/shell-web\/client\/components\/ShellLayout"/);
|
|
120
|
+
assert.match(template, /drawerWidth, railWidth, and future shell props package-owned/);
|
|
104
121
|
assert.match(template, /h\(PackageShellLayout, attrs, slots\)/);
|
|
105
122
|
assert.doesNotMatch(template, /ShellOutlet|ShellRouteTransition|useShellLayoutState|pointerdown|v-navigation-drawer|v-bottom-navigation/);
|
|
106
123
|
});
|
|
@@ -148,7 +165,7 @@ test("shell-web installs generated adaptive shell Playwright smoke coverage", as
|
|
|
148
165
|
assert.match(source, /@jskit-ai\/shell-web\/test\/adaptiveShellSmoke/);
|
|
149
166
|
assert.match(helperSource, /generated adaptive shell smoke/);
|
|
150
167
|
assert.match(helperSource, /390/);
|
|
151
|
-
assert.match(helperSource, /
|
|
168
|
+
assert.match(helperSource, /1024/);
|
|
152
169
|
assert.match(helperSource, /1280/);
|
|
153
170
|
assert.match(helperSource, /jskit-shell-bottom-nav/);
|
|
154
171
|
assert.match(helperSource, /jskit-shell-drawer/);
|
|
@@ -288,8 +305,9 @@ test("shell-web settings general child page exposes an adaptive drawer preferenc
|
|
|
288
305
|
assert.match(source, /generated-ui-screen generated-ui-screen--settings settings-general-screen/);
|
|
289
306
|
assert.match(source, /drawerDefaultOpen/);
|
|
290
307
|
assert.match(source, /setDrawerDefaultOpen/);
|
|
291
|
-
assert.match(source, /
|
|
292
|
-
assert.match(source, /
|
|
308
|
+
assert.match(source, /collapsed navigation remains available as a rail/);
|
|
309
|
+
assert.match(source, /Phone layouts close the drawer/);
|
|
310
|
+
assert.match(source, /Start with expanded navigation on wider screens/);
|
|
293
311
|
assert.match(source, /min-height:\s*48px/);
|
|
294
312
|
assert.doesNotMatch(source, /live in this browser only|tiny example|starter settings/);
|
|
295
313
|
});
|