@jskit-ai/http-web 0.2.17 → 0.2.19
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 +3 -0
- package/fixtures/crud-screens/main.js +24 -14
- package/package.json +8 -8
- package/src/client/components/CrudAddEditScreen.vue +8 -3
- package/src/client/components/CrudListFilterSurface.vue +2 -5
- package/src/client/components/CrudListScreen.vue +2 -2
- package/test/crudAddEditActions.test.js +43 -2
- package/test/crudListDateFilterSurface.browser.test.js +6 -14
- package/test/crudListFilterSurface.test.js +3 -0
- package/test/crudScreenComponents.test.js +4 -8
- package/test/crudScreensMaterialBaselines.browser.test.js +39 -36
- package/test/selectField.browser.test.js +7 -8
- package/src/client/components/CrudListCreateAction.vue +0 -38
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- The list's create FAB takes layout room (`<v-fab app layout>`), so shell-web's snackbar shows above it instead of over it, and the list's last card scrolls clear of it.
|
|
5
6
|
- The CRUD screens are exact Material 3. The list is a search bar and one row of filter chips (the Filters chip opens every control in a bottom sheet on compact windows and a dialog on wider ones), then cards or, when the list is at least 720px wide, a table; cards and rows open their record when tapped and keep their other actions in a trailing overflow menu (a table row's Open is a trailing chevron, its Edit a pencil); cards no longer show the record's id; the create action is an extended FAB on compact and medium windows and the app bar's primary action on wider ones; empty and error states have an icon. The view is a header and value-first details, its Edit and Delete in the app bar; new and edit pages have Cancel and Save in the app bar.
|
|
6
7
|
- Save, Cancel and delete replace the form's history entry through shell-web's `useShellNavigation().finish()`, so Back no longer reopens a finished form; `useCrudDeleteAction()` no longer takes `router`. A view whose record is not found, or whose load is refused with 403, tells the shell (`pageUnavailable()`), so Up returning to it goes on to its parent. `useView()` (and `useViewCore()`) expose the failed load's HTTP status as `errorStatus`.
|
|
7
8
|
- `CrudViewScreen` no longer takes `resourcePluralTitle` and its "Back to" button is gone; `CrudListRecordActionMenu` takes the record's `title` instead of `buttonLabel`, `buttonVariant` and `buttonSize`. Message keys: `jskit.http.actions.actions` and `jskit.http.crud.view.backTo` are removed, `jskit.http.crud.list.recordActions` ("Actions for {title}") is new. `@mdi/js` is gone; icons are `$aliases`.
|
|
8
9
|
- The crud-screen-set pattern's pages declare their titles and parents in `definePage()`.
|
|
9
10
|
- Upgrading: see the guide's [Move an app to the Material 3 defaults](https://mobily-enterprises.github.io/jskit-ai/guide/app-setup/material-3-migration).
|
|
10
11
|
- CRUD list filters show the presence choices and the default filter chips through the app's translator, from resource-crud-core's new catalog (registered with http-web's own). The English is unchanged.
|
|
12
|
+
- The CRUD list's create action is shell-web's `ShellPrimaryAction`, which looks and behaves as before; the list's on/off filter chips are plain `aria-pressed` chips that material-web draws as Material 3 filter chips, with no variant, colour or check icon of their own.
|
|
13
|
+
- New and edit pages lay out as Material 3's full-screen forms: the top app bar's Up arrow is the form's close (X), which cancels, so Cancel no longer sits beside it; where the bar has no Up arrow (a form opened directly, or beside its list) Cancel stays a bar action before Save.
|
|
11
14
|
|
|
12
15
|
## 0.2.0 - 2026-10-29
|
|
13
16
|
|
|
@@ -33,17 +33,6 @@ import BookViewPage from "../../patterns/crud-screen-set/example/books/BookViewP
|
|
|
33
33
|
// file-based router's definePage() macro is a no-op here; each route carries the meta the page declares.
|
|
34
34
|
globalThis.definePage = () => {};
|
|
35
35
|
|
|
36
|
-
function destination(order, label, suffix, icon) {
|
|
37
|
-
return {
|
|
38
|
-
id: `fixture.${label.toLowerCase()}`,
|
|
39
|
-
target: "shell.primary-nav",
|
|
40
|
-
kind: "link",
|
|
41
|
-
surfaces: ["app"],
|
|
42
|
-
order,
|
|
43
|
-
props: { label, icon, surface: "app", scopedSuffix: suffix, unscopedSuffix: suffix, exact: suffix === "/" }
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
36
|
const menuRenderers = Object.freeze({ link: "fixture.surface-menu-link" });
|
|
48
37
|
const placementRuntime = createWebPlacementRuntime({
|
|
49
38
|
components: new Map([
|
|
@@ -53,9 +42,30 @@ const placementRuntime = createWebPlacementRuntime({
|
|
|
53
42
|
logger: silentLogger
|
|
54
43
|
});
|
|
55
44
|
placementRuntime.replacePlacements([
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
{
|
|
46
|
+
id: "fixture.home",
|
|
47
|
+
target: "shell.primary-nav",
|
|
48
|
+
kind: "link",
|
|
49
|
+
surfaces: ["app"],
|
|
50
|
+
order: 10,
|
|
51
|
+
props: { label: "Home", icon: "$home", surface: "app", scopedSuffix: "/", unscopedSuffix: "/", exact: true }
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "fixture.books",
|
|
55
|
+
target: "shell.primary-nav",
|
|
56
|
+
kind: "link",
|
|
57
|
+
surfaces: ["app"],
|
|
58
|
+
order: 20,
|
|
59
|
+
props: { label: "Books", icon: "$description", surface: "app", scopedSuffix: "/books", unscopedSuffix: "/books" }
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "fixture.settings",
|
|
63
|
+
target: "shell.primary-nav",
|
|
64
|
+
kind: "link",
|
|
65
|
+
surfaces: ["app"],
|
|
66
|
+
order: 30,
|
|
67
|
+
props: { label: "Settings", icon: "$settings", surface: "app", scopedSuffix: "/settings", unscopedSuffix: "/settings" }
|
|
68
|
+
}
|
|
59
69
|
]);
|
|
60
70
|
placementRuntime.replacePlacementTopology([
|
|
61
71
|
{
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/http-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"test": "
|
|
6
|
+
"test": "jskit test"
|
|
7
7
|
},
|
|
8
8
|
"exports": {
|
|
9
9
|
"./client": "./src/client/index.js",
|
|
@@ -47,20 +47,20 @@
|
|
|
47
47
|
"./locales/en.json": "./locales/en.json"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
50
|
+
"@jskit-ai/resource-crud-core": "0.1.202"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@jskit-ai/http-runtime": "0.2.
|
|
54
|
-
"@jskit-ai/kernel": "0.2.
|
|
55
|
-
"@jskit-ai/realtime": "0.2.
|
|
56
|
-
"@jskit-ai/shell-web": "0.2.
|
|
53
|
+
"@jskit-ai/http-runtime": "0.2.11",
|
|
54
|
+
"@jskit-ai/kernel": "0.2.11",
|
|
55
|
+
"@jskit-ai/realtime": "0.2.17",
|
|
56
|
+
"@jskit-ai/shell-web": "0.2.14",
|
|
57
57
|
"@tanstack/vue-query": "^5.90.5",
|
|
58
58
|
"vue": "^3.5.13",
|
|
59
59
|
"vue-router": "^5.0.4",
|
|
60
60
|
"vuetify": "^4.3.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@jskit-ai/material-web": "0.1.
|
|
63
|
+
"@jskit-ai/material-web": "0.1.3"
|
|
64
64
|
},
|
|
65
65
|
"description": "Neutral Vue request, command, resource, and CRUD UI runtime for JSKIT web applications.",
|
|
66
66
|
"jskit": {
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
import { computed, unref } from "vue";
|
|
3
3
|
import ShellPageAction from "@jskit-ai/shell-web/client/components/ShellPageAction";
|
|
4
4
|
import ShellPageActions from "@jskit-ai/shell-web/client/components/ShellPageActions";
|
|
5
|
+
import { useShellPageClose } from "@jskit-ai/shell-web/client/composables/useShellPageClose";
|
|
5
6
|
import { useShellNavigation } from "@jskit-ai/shell-web/client/navigation/useShellNavigation";
|
|
6
7
|
import { useJskitText } from "../i18n.js";
|
|
7
8
|
|
|
8
|
-
// A new or edit page as Material 3 lays
|
|
9
|
-
// the form's fields below on the page.
|
|
9
|
+
// A new or edit page as Material 3 lays out a full-screen form: the top app bar's leading close (X) cancels, Save is
|
|
10
|
+
// its one primary action, and the form's fields are below on the page. Where the bar has no Up arrow to turn into the
|
|
11
|
+
// close (a form opened directly, or beside its list), Cancel is a bar action before Save.
|
|
10
12
|
|
|
11
13
|
const props = defineProps({
|
|
12
14
|
screen: {
|
|
@@ -57,10 +59,13 @@ function resolveCancelTo(target = cancelTo.value) {
|
|
|
57
59
|
// history entry so neither Up nor Back reopens it.
|
|
58
60
|
const navigation = useShellNavigation();
|
|
59
61
|
const canCancel = computed(() => Boolean(cancelTo.value || navigation.upTarget.value));
|
|
62
|
+
const cancelInBar = computed(() => canCancel.value && !navigation.canGoUp.value);
|
|
60
63
|
|
|
61
64
|
function cancel() {
|
|
62
65
|
return navigation.upTarget.value ? navigation.finish() : navigation.finish(resolveCancelTo(cancelTo.value));
|
|
63
66
|
}
|
|
67
|
+
|
|
68
|
+
useShellPageClose({ label: () => t("jskit.http.actions.cancel"), close: cancel });
|
|
64
69
|
</script>
|
|
65
70
|
|
|
66
71
|
<template>
|
|
@@ -78,7 +83,7 @@ function cancel() {
|
|
|
78
83
|
:submit="addEdit.submit"
|
|
79
84
|
>
|
|
80
85
|
<ShellPageAction
|
|
81
|
-
v-if="
|
|
86
|
+
v-if="cancelInBar"
|
|
82
87
|
icon="$close"
|
|
83
88
|
:label="t('jskit.http.actions.cancel')"
|
|
84
89
|
@click="cancel"
|
|
@@ -25,8 +25,8 @@ const resolvedTitle = computed(() =>
|
|
|
25
25
|
);
|
|
26
26
|
|
|
27
27
|
// Material 3 filters: one row of chips. The Filters chip opens every control, in a bottom sheet on compact windows and a
|
|
28
|
-
// dialog on wider ones; on/off filters are
|
|
29
|
-
// that clears it.
|
|
28
|
+
// dialog on wider ones; on/off filters are filter chips in the row itself (aria-pressed, which material-web draws as
|
|
29
|
+
// Material 3's filter chip, selected with its check), and each other active filter is a chip that clears it.
|
|
30
30
|
const { isCompact } = useShellWindowSizeClass();
|
|
31
31
|
|
|
32
32
|
const sheetOpen = ref(false);
|
|
@@ -76,9 +76,6 @@ function clearChip(chip) {
|
|
|
76
76
|
:key="filter.key"
|
|
77
77
|
tag="button"
|
|
78
78
|
type="button"
|
|
79
|
-
:variant="runtimeValues[filter.key] ? 'flat' : 'outlined'"
|
|
80
|
-
:color="runtimeValues[filter.key] ? 'secondary-container' : undefined"
|
|
81
|
-
:prepend-icon="runtimeValues[filter.key] ? '$check' : undefined"
|
|
82
79
|
:aria-pressed="runtimeValues[filter.key] ? 'true' : 'false'"
|
|
83
80
|
@click="toggleFlag(filter)"
|
|
84
81
|
>
|
|
@@ -3,8 +3,8 @@ import { computed, unref } from "vue";
|
|
|
3
3
|
import { useRoute, useRouter } from "vue-router";
|
|
4
4
|
import ShellPageAction from "@jskit-ai/shell-web/client/components/ShellPageAction";
|
|
5
5
|
import ShellPageActions from "@jskit-ai/shell-web/client/components/ShellPageActions";
|
|
6
|
+
import ShellPrimaryAction from "@jskit-ai/shell-web/client/components/ShellPrimaryAction";
|
|
6
7
|
import CrudListBulkActionSurface from "./CrudListBulkActionSurface.vue";
|
|
7
|
-
import CrudListCreateAction from "./CrudListCreateAction.vue";
|
|
8
8
|
import CrudListFilterSurface from "./CrudListFilterSurface.vue";
|
|
9
9
|
import CrudListRecordActionMenu from "./CrudListRecordActionMenu.vue";
|
|
10
10
|
import { useJskitText } from "../i18n.js";
|
|
@@ -132,7 +132,7 @@ function setSelectableRowsSelected(selected = true) {
|
|
|
132
132
|
@click="records.reload"
|
|
133
133
|
/>
|
|
134
134
|
</ShellPageActions>
|
|
135
|
-
<
|
|
135
|
+
<ShellPrimaryAction v-if="listPrimaryAction" :label="resolvedCreateLabel" :to="listPrimaryAction" />
|
|
136
136
|
|
|
137
137
|
<div class="crud-list-toolbar">
|
|
138
138
|
<v-text-field
|
|
@@ -34,7 +34,15 @@ const hooks = registerHooks({
|
|
|
34
34
|
const { default: CrudAddEditScreen } = await import(componentUrl);
|
|
35
35
|
hooks.deregister();
|
|
36
36
|
|
|
37
|
-
async function fixture(t, {
|
|
37
|
+
async function fixture(t, {
|
|
38
|
+
actions,
|
|
39
|
+
onSaveSuccess,
|
|
40
|
+
request,
|
|
41
|
+
screenResource = null,
|
|
42
|
+
parent = "",
|
|
43
|
+
navigationRuntime = null,
|
|
44
|
+
...options
|
|
45
|
+
} = {}) {
|
|
38
46
|
const node = (type, text = "") => ({ type, text, props: {}, children: [], parent: null });
|
|
39
47
|
const renderer = createRenderer({
|
|
40
48
|
createElement: node,
|
|
@@ -57,7 +65,7 @@ async function fixture(t, { actions, onSaveSuccess, request, screenResource = nu
|
|
|
57
65
|
});
|
|
58
66
|
const router = createRouter({
|
|
59
67
|
history: createMemoryHistory(),
|
|
60
|
-
routes: [{ path: "/books/:bookId?", component: { render: () => h("div") } }]
|
|
68
|
+
routes: [{ path: "/books/:bookId?", component: { render: () => h("div") }, meta: parent ? { jskit: { parent } } : {} }]
|
|
61
69
|
});
|
|
62
70
|
await router.push("/books/new?source=list");
|
|
63
71
|
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
|
@@ -132,6 +140,9 @@ async function fixture(t, { actions, onSaveSuccess, request, screenResource = nu
|
|
|
132
140
|
},
|
|
133
141
|
getRevision: () => 0
|
|
134
142
|
});
|
|
143
|
+
if (navigationRuntime) {
|
|
144
|
+
app.provide("jskit.shell-web.runtime.navigation.client", navigationRuntime);
|
|
145
|
+
}
|
|
135
146
|
app.provide("jskit.shell-web.runtime.web-error.client", {
|
|
136
147
|
report(value) { reports.push(value); },
|
|
137
148
|
dismiss() {}
|
|
@@ -188,6 +199,36 @@ test("default form actions retain Cancel, Save, validation feedback, and keyboar
|
|
|
188
199
|
assert.equal(reports.at(-1).severity, "success");
|
|
189
200
|
});
|
|
190
201
|
|
|
202
|
+
test("on a page with an Up arrow, the arrow is the form's close, which cancels, and the bar has no Cancel beside it", async (t) => {
|
|
203
|
+
const closes = [];
|
|
204
|
+
const finished = [];
|
|
205
|
+
const navigationRuntime = {
|
|
206
|
+
trail: ref([{ path: "/books?view=table" }]),
|
|
207
|
+
visibleParentPanes: ref(0),
|
|
208
|
+
pageTitleSource: ref(null),
|
|
209
|
+
pageClose: ref(null),
|
|
210
|
+
setPageTitle: () => () => {},
|
|
211
|
+
setPageClose(close) {
|
|
212
|
+
closes.push(close);
|
|
213
|
+
return () => closes.splice(closes.indexOf(close), 1);
|
|
214
|
+
},
|
|
215
|
+
finish(target, parentTarget) {
|
|
216
|
+
finished.push({ target, parentTarget });
|
|
217
|
+
return Promise.resolve();
|
|
218
|
+
},
|
|
219
|
+
up: () => Promise.resolve(),
|
|
220
|
+
pageUnavailable: () => false
|
|
221
|
+
};
|
|
222
|
+
const { button } = await fixture(t, { parent: "/books", navigationRuntime });
|
|
223
|
+
assert.equal(button("Cancel"), undefined);
|
|
224
|
+
assert.ok(button("Save book"));
|
|
225
|
+
assert.equal(closes.length, 1);
|
|
226
|
+
assert.equal(closes[0].label(), "Cancel");
|
|
227
|
+
await closes[0].close();
|
|
228
|
+
assert.equal(finished.length, 1);
|
|
229
|
+
assert.equal(finished[0].target, "", "Cancel goes back to where the form was opened from");
|
|
230
|
+
});
|
|
231
|
+
|
|
191
232
|
test("actions slot supports local guidance and save-and-add-another through onSaveSuccess", async (t) => {
|
|
192
233
|
let actionScope;
|
|
193
234
|
let saved;
|
|
@@ -3,12 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import test from "node:test";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
createChromiumLaunchOptions,
|
|
9
|
-
startViteFixture,
|
|
10
|
-
stopProcess
|
|
11
|
-
} from "../../../tooling/testUtils/browserFixture.mjs";
|
|
6
|
+
import { sharedBrowserFixture } from "../../../tooling/testUtils/browserFixture.mjs";
|
|
12
7
|
|
|
13
8
|
const TEST_DIRECTORY = path.dirname(fileURLToPath(import.meta.url));
|
|
14
9
|
const PACKAGE_ROOT = path.resolve(TEST_DIRECTORY, "..");
|
|
@@ -75,17 +70,17 @@ async function selectPickerDayWithKeyboard(picker, day) {
|
|
|
75
70
|
await dayButton.press("Space");
|
|
76
71
|
}
|
|
77
72
|
|
|
73
|
+
const openFixture = sharedBrowserFixture({ fixtureRoot: FIXTURE_ROOT });
|
|
74
|
+
|
|
78
75
|
test("CRUD date filters render and operate without clipping across responsive layouts", {
|
|
79
76
|
skip: RUN_BROWSER_TEST
|
|
80
77
|
? false
|
|
81
78
|
: "set JSKIT_HTTP_WEB_DATE_FILTER_VISUAL_INTEGRATION=1 to run the browser visual regression",
|
|
82
79
|
timeout: 180_000
|
|
83
|
-
}, async () => {
|
|
84
|
-
const viteRuntime = await
|
|
85
|
-
let browser = null;
|
|
80
|
+
}, async (t) => {
|
|
81
|
+
const { vite: viteRuntime, browser } = await openFixture(t);
|
|
86
82
|
|
|
87
83
|
try {
|
|
88
|
-
browser = await chromium.launch(createChromiumLaunchOptions());
|
|
89
84
|
const context = await browser.newContext({
|
|
90
85
|
baseURL: viteRuntime.baseURL,
|
|
91
86
|
locale: "en-US"
|
|
@@ -183,9 +178,6 @@ test("CRUD date filters render and operate without clipping across responsive la
|
|
|
183
178
|
);
|
|
184
179
|
await page.getByLabel("Arrival from", { exact: true }).waitFor({ state: "visible" });
|
|
185
180
|
} finally {
|
|
186
|
-
|
|
187
|
-
await browser.close();
|
|
188
|
-
}
|
|
189
|
-
await stopProcess(viteRuntime);
|
|
181
|
+
await browser.close();
|
|
190
182
|
}
|
|
191
183
|
});
|
|
@@ -38,6 +38,9 @@ test("CrudListFilterSurface is one Material 3 chip row over a filter sheet, with
|
|
|
38
38
|
assert.match(surfaceSource, /useShellWindowSizeClass/);
|
|
39
39
|
assert.match(surfaceSource, /prepend-icon="\$tune"/);
|
|
40
40
|
assert.match(surfaceSource, /v-for="filter in flagFilters"[\s\S]*:aria-pressed=/);
|
|
41
|
+
// material-web draws an aria-pressed chip as a filter chip, so the flag chips set no look of their own.
|
|
42
|
+
const flagChip = surfaceSource.match(/<v-chip\s+v-for="filter in flagFilters"[^>]*>/u)?.[0] || "";
|
|
43
|
+
assert.doesNotMatch(flagChip, /:variant=|:color=|prepend-icon/u);
|
|
41
44
|
assert.match(surfaceSource, /v-for="chip in valueChips"[\s\S]*closable/);
|
|
42
45
|
|
|
43
46
|
assert.match(source, /defineProps/);
|
|
@@ -23,7 +23,7 @@ async function readClientFile(...parts) {
|
|
|
23
23
|
|
|
24
24
|
test("every CRUD list create action retains its configured label and destination", async () => {
|
|
25
25
|
const componentUrl = new URL("../src/client/components/CrudListScreen.vue", import.meta.url).href;
|
|
26
|
-
const createActionUrl =
|
|
26
|
+
const createActionUrl = import.meta.resolve("@jskit-ai/shell-web/client/components/ShellPrimaryAction");
|
|
27
27
|
const hooks = registerHooks({
|
|
28
28
|
load(url, context, nextLoad) {
|
|
29
29
|
if (!url.endsWith(".vue")) return nextLoad(url, context);
|
|
@@ -140,12 +140,11 @@ test("CRUD screen components own list/view/form chrome centrally", async () => {
|
|
|
140
140
|
const bulkActionSource = await readComponent("CrudListBulkActionSurface.vue");
|
|
141
141
|
const rowActionSource = await readComponent("CrudListRecordActionMenu.vue");
|
|
142
142
|
|
|
143
|
-
const createActionSource = await readComponent("CrudListCreateAction.vue");
|
|
144
|
-
|
|
145
143
|
assert.match(listSource, /CrudListBulkActionSurface/);
|
|
146
144
|
assert.match(listSource, /CrudListFilterSurface/);
|
|
147
145
|
assert.match(listSource, /CrudListRecordActionMenu/);
|
|
148
|
-
|
|
146
|
+
// shell-web's adaptive primary action: an extended FAB on compact and medium windows, the bar's primary on wider.
|
|
147
|
+
assert.match(listSource, /<ShellPrimaryAction v-if="listPrimaryAction" :label="resolvedCreateLabel" :to="listPrimaryAction" \/>/);
|
|
149
148
|
assert.match(listSource, /<ShellPageActions>[\s\S]*icon="\$refresh"[\s\S]*<\/ShellPageActions>/);
|
|
150
149
|
assert.match(listSource, /class="crud-list-cards"/);
|
|
151
150
|
assert.match(listSource, /class="crud-list-table"/);
|
|
@@ -165,8 +164,6 @@ test("CRUD screen components own list/view/form chrome centrally", async () => {
|
|
|
165
164
|
assert.match(listSource, /variant="solo-filled"[\s\S]*rounded="pill"[\s\S]*prepend-inner-icon="\$search"/);
|
|
166
165
|
assert.doesNotMatch(listSource, /@media|<v-sheet|\sborder(?=[\s>])|\bborder\s*:|min-height:\s*48px/u);
|
|
167
166
|
assert.match(listSource, /selectableRows/);
|
|
168
|
-
assert.match(createActionSource, /<v-fab[\s\S]*v-if="isCompact \|\| isMedium"[\s\S]*\bapp\b[\s\S]*\bextended\b/);
|
|
169
|
-
assert.match(createActionSource, /<ShellPageAction primary icon="\$add"/);
|
|
170
167
|
assert.match(rowActionSource, /icon="\$moreVert"/);
|
|
171
168
|
assert.match(listSource, /<slot[\s\S]*name="card-fields"/);
|
|
172
169
|
assert.match(listSource, /<slot name="table-header"/);
|
|
@@ -205,8 +202,7 @@ test("CRUD screen components own list/view/form chrome centrally", async () => {
|
|
|
205
202
|
addEditSource,
|
|
206
203
|
deleteActionSource,
|
|
207
204
|
bulkActionSource,
|
|
208
|
-
rowActionSource
|
|
209
|
-
createActionSource
|
|
205
|
+
rowActionSource
|
|
210
206
|
].join("\n");
|
|
211
207
|
assert.doesNotMatch(sharedSources, /:loading=|v-progress-(?:circular|linear)/u);
|
|
212
208
|
assert.doesNotMatch(sharedSources, /ui-generator|generated-ui/u);
|
|
@@ -55,7 +55,7 @@ const CRUD_PROBES = Object.freeze([
|
|
|
55
55
|
{ name: "rail", selector: "[data-testid=jskit-shell-rail]", width: true },
|
|
56
56
|
{ name: "drawer", selector: "[data-testid=jskit-shell-drawer].v-navigation-drawer--active", width: true },
|
|
57
57
|
{ name: "content", selector: ".shell-layout__content", width: true },
|
|
58
|
-
{ name: "fab", selector: ".
|
|
58
|
+
{ name: "fab", selector: ".shell-primary-action .v-btn" },
|
|
59
59
|
{ name: "search", selector: ".crud-list-search .v-field", width: true },
|
|
60
60
|
{ name: "card", selector: ".crud-list-card", width: true },
|
|
61
61
|
{ name: "cardTitle", selector: ".crud-list-card__title" },
|
|
@@ -125,46 +125,49 @@ async function serveBooks(page, screen) {
|
|
|
125
125
|
test("the CRUD screens keep their Material 3 baselines in light and dark at every window size", {
|
|
126
126
|
skip: RUN_BROWSER_TEST ? false : "set JSKIT_MATERIAL_BASELINES=1 to check the Material 3 baselines",
|
|
127
127
|
timeout: 300_000
|
|
128
|
-
}, async () => {
|
|
128
|
+
}, async (t) => {
|
|
129
|
+
// Stopped in after hooks, which run when the test fails or times out too (a body's `finally` doesn't after a
|
|
130
|
+
// timeout, and the server and browser would keep the test file's process alive).
|
|
129
131
|
const vite = await startViteFixture({ fixtureRoot: FIXTURE_ROOT });
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
132
|
+
t.after(() => stopProcess(vite));
|
|
133
|
+
const browser = await chromium.launch(createChromiumLaunchOptions());
|
|
134
|
+
t.after(() => browser.close());
|
|
135
|
+
for (const viewport of VIEWPORTS) {
|
|
136
|
+
// The app follows the system's light or dark setting, Material 3's default.
|
|
137
|
+
for (const colorScheme of ["light", "dark"]) {
|
|
138
|
+
const context = await browser.newContext({
|
|
139
|
+
baseURL: vite.baseURL,
|
|
140
|
+
colorScheme,
|
|
141
|
+
locale: "en-US",
|
|
142
|
+
reducedMotion: "reduce",
|
|
143
|
+
timezoneId: "UTC",
|
|
144
|
+
viewport
|
|
145
|
+
});
|
|
146
|
+
try {
|
|
147
|
+
for (const screen of SCREENS) {
|
|
148
|
+
const page = await context.newPage();
|
|
149
|
+
await serveBooks(page, screen);
|
|
150
|
+
await page.goto(screen.path);
|
|
151
|
+
await expect(page.locator(screen.ready).filter({ visible: true }).first()).toBeVisible();
|
|
152
|
+
if (screen.openDelete) {
|
|
153
|
+
// A phone's bar keeps only a primary action, so the record's Delete is in its "More actions" menu.
|
|
154
|
+
const compact = viewport.width < 600;
|
|
155
|
+
if (compact) {
|
|
156
|
+
await page.getByRole("button", { name: "More actions" }).click();
|
|
153
157
|
}
|
|
154
|
-
await
|
|
155
|
-
|
|
156
|
-
name: `crud-${screen.name}-${viewport.width}-${colorScheme}`,
|
|
157
|
-
probes: CRUD_PROBES
|
|
158
|
-
});
|
|
159
|
-
await page.close();
|
|
158
|
+
await page.getByRole(compact ? "menuitem" : "button", { name: /^Delete/u }).first().click();
|
|
159
|
+
await expect(page.locator(".v-overlay--active .crud-delete-action__headline")).toBeVisible();
|
|
160
160
|
}
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
await expectMaterialBaseline(page, {
|
|
162
|
+
directory: BASELINE_DIRECTORY,
|
|
163
|
+
name: `crud-${screen.name}-${viewport.width}-${colorScheme}`,
|
|
164
|
+
probes: CRUD_PROBES
|
|
165
|
+
});
|
|
166
|
+
await page.close();
|
|
163
167
|
}
|
|
168
|
+
} finally {
|
|
169
|
+
await context.close();
|
|
164
170
|
}
|
|
165
171
|
}
|
|
166
|
-
} finally {
|
|
167
|
-
await browser?.close();
|
|
168
|
-
await stopProcess(vite);
|
|
169
172
|
}
|
|
170
173
|
});
|
|
@@ -2,8 +2,8 @@ import assert from "node:assert/strict";
|
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import test from "node:test";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { expect } from "@playwright/test";
|
|
6
|
+
import { sharedBrowserFixture } from "../../../tooling/testUtils/browserFixture.mjs";
|
|
7
7
|
|
|
8
8
|
const FIELDS = Object.freeze(["Service", "Retired service", "Extras"]);
|
|
9
9
|
|
|
@@ -22,16 +22,16 @@ async function assertNoStoredIdShown(page) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
const openFixture = sharedBrowserFixture({ fixtureRoot: fileURLToPath(new URL("../fixtures/select-field/", import.meta.url)) });
|
|
26
|
+
|
|
25
27
|
test("SelectField never shows a stored id while options load and titles unmatched values afterwards", {
|
|
26
28
|
skip: process.env.JSKIT_HTTP_WEB_SELECT_FIELD_BROWSER === "1"
|
|
27
29
|
? false
|
|
28
30
|
: "set JSKIT_HTTP_WEB_SELECT_FIELD_BROWSER=1 to run the select field browser regression",
|
|
29
31
|
timeout: 120_000
|
|
30
|
-
}, async () => {
|
|
31
|
-
const
|
|
32
|
-
let browser = null;
|
|
32
|
+
}, async (t) => {
|
|
33
|
+
const { vite: runtime, browser } = await openFixture(t);
|
|
33
34
|
try {
|
|
34
|
-
browser = await chromium.launch(createChromiumLaunchOptions());
|
|
35
35
|
const page = await browser.newPage({ baseURL: runtime.baseURL });
|
|
36
36
|
const errors = [];
|
|
37
37
|
page.on("pageerror", (error) => errors.push(error.message));
|
|
@@ -57,7 +57,6 @@ test("SelectField never shows a stored id while options load and titles unmatche
|
|
|
57
57
|
assert.deepEqual(await readModels(page), { service: 53, retired: 99, serviceIds: [53] });
|
|
58
58
|
assert.deepEqual(errors, []);
|
|
59
59
|
} finally {
|
|
60
|
-
await browser
|
|
61
|
-
await stopProcess(runtime);
|
|
60
|
+
await browser.close();
|
|
62
61
|
}
|
|
63
62
|
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import ShellPageAction from "@jskit-ai/shell-web/client/components/ShellPageAction";
|
|
3
|
-
import ShellPageActions from "@jskit-ai/shell-web/client/components/ShellPageActions";
|
|
4
|
-
import { useShellWindowSizeClass } from "@jskit-ai/shell-web/client/composables/useShellWindowSizeClass";
|
|
5
|
-
|
|
6
|
-
// A list's create action as Material 3 places it: an extended FAB above the navigation bar or beside the rail on
|
|
7
|
-
// compact and medium windows, the app bar's filled primary action on expanded and large ones. Its layout order puts
|
|
8
|
-
// it inside the shell's navigation bar, so the FAB sits above the bar instead of over it.
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
label: {
|
|
11
|
-
type: String,
|
|
12
|
-
required: true
|
|
13
|
-
},
|
|
14
|
-
to: {
|
|
15
|
-
type: [String, Object],
|
|
16
|
-
required: true
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const { isCompact, isMedium } = useShellWindowSizeClass();
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
24
|
-
<v-fab
|
|
25
|
-
v-if="isCompact || isMedium"
|
|
26
|
-
class="crud-list-fab"
|
|
27
|
-
app
|
|
28
|
-
extended
|
|
29
|
-
location="bottom end"
|
|
30
|
-
order="1"
|
|
31
|
-
prepend-icon="$add"
|
|
32
|
-
:text="props.label"
|
|
33
|
-
:to="props.to"
|
|
34
|
-
/>
|
|
35
|
-
<ShellPageActions v-else>
|
|
36
|
-
<ShellPageAction primary icon="$add" :label="props.label" :to="props.to" />
|
|
37
|
-
</ShellPageActions>
|
|
38
|
-
</template>
|