@jskit-ai/shell-web 0.1.149 → 0.1.151
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 +14 -0
- package/fixtures/adaptive-shell/index.html +12 -0
- package/fixtures/adaptive-shell/src/App.vue +34 -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 +258 -16
- package/src/client/components/ShellMenuLinkItem.vue +18 -12
- package/src/client/components/ShellNavigationTooltip.vue +37 -0
- package/src/client/components/ShellSurfaceAwareMenuLinkItem.vue +18 -12
- package/src/client/support/drawerWidth.js +91 -0
- package/src/client/support/navigationLinkKeyboard.js +10 -0
- package/src/test/adaptiveShellSmoke.js +192 -16
- package/templates/src/components/ShellLayout.vue +1 -0
- package/test/adaptiveShell.browser.test.js +324 -0
- package/test/drawerWidth.test.js +59 -0
- package/test/linkItemScaffoldContract.test.js +18 -2
- package/test/navigationLinkKeyboard.test.js +36 -0
- package/test/playwrightContract.test.js +17 -0
- package/test/settingsPlacementContract.test.js +16 -2
|
@@ -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,20 @@ 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-navigation-item-spacing/u);
|
|
33
|
+
assert.match(source, /data-rail-width/u);
|
|
34
|
+
assert.match(source, /expect\.poll/u);
|
|
35
|
+
assert.match(source, /toBeFocused/u);
|
|
36
|
+
assert.match(source, /v-navigation-drawer__scrim/u);
|
|
37
|
+
assert.match(source, /page\.keyboard\.press\("Escape"\)[\s\S]*data-presentation", "drawer"/u);
|
|
38
|
+
assert.match(source, /iconBox\.x \+ iconBox\.width \/ 2/u);
|
|
39
|
+
assert.match(source, /fit\.endGap - configuredSpacing/u);
|
|
40
|
+
assert.match(source, /fit\.iconLabelGaps/u);
|
|
41
|
+
assert.doesNotMatch(source, /viewport\.name === "compact"/u);
|
|
42
|
+
assert.doesNotMatch(source, /await new Promise.*setTimeout|waitForTimeout/u);
|
|
43
|
+
});
|
|
@@ -98,7 +98,20 @@ test("shell-web shell layout registers navigation at the app layout level", asyn
|
|
|
98
98
|
assert.match(source, /desktopDrawerClosedMode/);
|
|
99
99
|
assert.match(source, /default: "rail"/);
|
|
100
100
|
assert.match(source, /:rail="drawerPresentation\.rail"/);
|
|
101
|
-
assert.match(source,
|
|
101
|
+
assert.match(source, /drawerWidth/);
|
|
102
|
+
assert.match(source, /railWidth/);
|
|
103
|
+
assert.match(source, /navigationItemSpacing/);
|
|
104
|
+
assert.match(source, /:width="resolvedDrawerWidth"/);
|
|
105
|
+
assert.match(source, /:rail-width="resolvedRailWidth"/);
|
|
106
|
+
assert.match(source, /data-drawer-width="resolvedDrawerWidth"/);
|
|
107
|
+
assert.match(source, /data-navigation-item-spacing="resolvedNavigationItemSpacing"/);
|
|
108
|
+
assert.match(source, /data-rail-width="resolvedRailWidth"/);
|
|
109
|
+
assert.match(source, /data-layout="layoutClass"/);
|
|
110
|
+
assert.match(source, /measureDrawerContentWidth/);
|
|
111
|
+
assert.match(source, /DEFAULT_SHELL_NAVIGATION_ITEM_SPACING/);
|
|
112
|
+
assert.match(source, /:prepend-gap="resolvedNavigationItemSpacing"/);
|
|
113
|
+
assert.doesNotMatch(source, /:width="248"/);
|
|
114
|
+
assert.doesNotMatch(source, /:rail-width="80"/);
|
|
102
115
|
assert.match(source, /:model-value="drawerPresentation\.visible"/);
|
|
103
116
|
assert.match(source, /data-testid="jskit-shell-nav-toggle"/);
|
|
104
117
|
assert.match(source, /data-testid="jskit-shell-bottom-nav"/);
|
|
@@ -107,6 +120,7 @@ test("shell-web shell layout registers navigation at the app layout level", asyn
|
|
|
107
120
|
const template = await readFile(path.join(PACKAGE_DIR, "templates", "src", "components", "ShellLayout.vue"), "utf8");
|
|
108
121
|
|
|
109
122
|
assert.match(template, /PackageShellLayout from "@jskit-ai\/shell-web\/client\/components\/ShellLayout"/);
|
|
123
|
+
assert.match(template, /drawerWidth, railWidth, navigationItemSpacing, and future shell props package-owned/);
|
|
110
124
|
assert.match(template, /h\(PackageShellLayout, attrs, slots\)/);
|
|
111
125
|
assert.doesNotMatch(template, /ShellOutlet|ShellRouteTransition|useShellLayoutState|pointerdown|v-navigation-drawer|v-bottom-navigation/);
|
|
112
126
|
});
|
|
@@ -154,7 +168,7 @@ test("shell-web installs generated adaptive shell Playwright smoke coverage", as
|
|
|
154
168
|
assert.match(source, /@jskit-ai\/shell-web\/test\/adaptiveShellSmoke/);
|
|
155
169
|
assert.match(helperSource, /generated adaptive shell smoke/);
|
|
156
170
|
assert.match(helperSource, /390/);
|
|
157
|
-
assert.match(helperSource, /
|
|
171
|
+
assert.match(helperSource, /1024/);
|
|
158
172
|
assert.match(helperSource, /1280/);
|
|
159
173
|
assert.match(helperSource, /jskit-shell-bottom-nav/);
|
|
160
174
|
assert.match(helperSource, /jskit-shell-drawer/);
|