@jskit-ai/shell-web 0.2.54 → 0.2.55

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.
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  // A button in each colour that has a container role and each variant, for its label's contrast at rest, hovered,
3
- // focused and pressed: a state layer is drawn under the label, so it is part of what the label is read against.
3
+ // focused and pressed: a state layer is drawn under the label, so it is part of what the label is read against. Each
4
+ // is there again active, as a button whose route is current or whose menu is open is drawn, with its activated layer.
4
5
  const COLORS = Object.freeze(["primary", "secondary", "tertiary", "error", "success", "warning", "info"]);
5
6
  const VARIANTS = Object.freeze(["flat", "elevated", "tonal", "outlined", "text"]);
6
7
  </script>
@@ -18,5 +19,17 @@ const VARIANTS = Object.freeze(["flat", "elevated", "tonal", "outlined", "text"]
18
19
  {{ variant }}
19
20
  </v-btn>
20
21
  </div>
22
+ <div v-for="color in COLORS" :key="`active-${color}`" class="d-flex flex-wrap ga-2">
23
+ <v-btn
24
+ v-for="variant in VARIANTS"
25
+ :key="variant"
26
+ :color="color"
27
+ :variant="variant"
28
+ active
29
+ :data-testid="`active-${color}-${variant}`"
30
+ >
31
+ {{ variant }}
32
+ </v-btn>
33
+ </div>
21
34
  </section>
22
35
  </template>
@@ -116,6 +116,15 @@ function jumpToLastBooking() {
116
116
  </v-list>
117
117
  </v-card>
118
118
  </v-menu>
119
+ <!-- A filled button's menu: Vuetify draws the button as active while its menu is open. -->
120
+ <v-menu>
121
+ <template #activator="{ props: menu }">
122
+ <v-btn color="primary" v-bind="menu">Filled menu</v-btn>
123
+ </template>
124
+ <v-list data-testid="fixture-filled-menu-list">
125
+ <v-list-item title="Second" />
126
+ </v-list>
127
+ </v-menu>
119
128
  </div>
120
129
 
121
130
  <v-btn disabled data-testid="fixture-disabled-button">Update password</v-btn>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/shell-web",
3
- "version": "0.2.54",
3
+ "version": "0.2.55",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "jskit test"
@@ -51,7 +51,7 @@
51
51
  "@jskit-ai/architecture-inspector": "0.1.34"
52
52
  },
53
53
  "devDependencies": {
54
- "@jskit-ai/material-web": "0.1.13",
54
+ "@jskit-ai/material-web": "0.1.14",
55
55
  "@vue/compiler-sfc": "3.5.44"
56
56
  },
57
57
  "peerDependencies": {
@@ -151,13 +151,62 @@ test("a menu mounted while closed covers nothing, and still opens and closes wit
151
151
  await expect(items).toBeAttached();
152
152
  });
153
153
 
154
- // A state layer lies under the label, so a hovered, focused or pressed button's label is read against its container
155
- // with the layer over it. Material 3's layers (hover 8%, focus and pressed 10%) keep every label at 4.5:1: a filled
156
- // button's on-colour over its colour, a tonal button's on-container colour over its tint.
157
- test("every button's label keeps 4.5:1 at rest, hovered, focused and pressed, in each colour, variant and theme", {
154
+ // An open menu lies over the page only where its content is. Vuetify holds the content in an overlay root that spans
155
+ // the whole window, transparent and taking no clicks, and axe read every text of the page under that root as
156
+ // undecided (bgOverlap): 36 texts on mobilynet's page with its "Add to project" menu open.
157
+ test("an open menu leaves every text beside it judged: only the menu's content lies over the page", {
158
158
  skip: SKIP,
159
- timeout: 180_000
159
+ timeout: 60_000
160
+ }, async (t) => {
161
+ const { vite, browser } = await open(t);
162
+ const page = await browser.newPage({ baseURL: vite.baseURL, viewport: { width: 1280, height: 900 }, reducedMotion: "reduce" });
163
+ t.after(() => page.close());
164
+ await page.goto("/home/components");
165
+ await expect(page.getByTestId("jskit-shell-page-title")).toBeVisible();
166
+ await expectJudged(page, "components at 1280", []);
167
+
168
+ // Each menu opened with the mouse, which stays over its button: Vuetify draws the button as active while its menu is
169
+ // open, and the label is read against the layers it then shows, once the click's ripple has gone (as the button
170
+ // contrast tests wait for it: a released press leaves it fading out for a moment).
171
+ await page.getByRole("button", { name: "Rich menu" }).click();
172
+ await expect(page.getByTestId("fixture-menu-panel")).toBeVisible();
173
+ await expect(page.locator(".v-ripple__container")).toHaveCount(0);
174
+ await expectJudged(page, "components at 1280 with a text button's menu open", []);
175
+ await page.keyboard.press("Escape");
176
+ await expect(page.getByTestId("fixture-menu-panel")).toBeHidden();
177
+
178
+ await page.getByRole("button", { name: "Filled menu" }).click();
179
+ await expect(page.getByTestId("fixture-filled-menu-list")).toBeVisible();
180
+ await expect(page.locator(".v-ripple__container")).toHaveCount(0);
181
+ await expectJudged(page, "components at 1280 with a filled button's menu open", []);
182
+ });
183
+
184
+ // A snackbar's message lies over the page only where it draws: Vuetify holds it in an overlay the size of the window,
185
+ // as it holds a menu. The form's Save reports one, as a saved form does.
186
+ test("a snackbar leaves every text beside it judged: only its message lies over the page", {
187
+ skip: SKIP,
188
+ timeout: 60_000
160
189
  }, async (t) => {
190
+ const { vite, browser } = await open(t);
191
+ const page = await browser.newPage({ baseURL: vite.baseURL, viewport: { width: 1280, height: 900 }, reducedMotion: "reduce" });
192
+ t.after(() => page.close());
193
+ await page.goto("/home/feedback");
194
+ await expect(page.getByTestId("fixture-feedback")).toBeVisible();
195
+ await expectJudged(page, "feedback at 1280", []);
196
+
197
+ // The page's own count is an <output>, a status too; the snackbar's message is the other one.
198
+ await page.getByTestId("fixture-form-save").click();
199
+ await expect(page.getByRole("status").filter({ hasText: "Integration configuration saved." })).toBeVisible();
200
+ await expect(page.locator(".v-ripple__container")).toHaveCount(0);
201
+ await expectJudged(page, "feedback at 1280 with a snackbar shown", []);
202
+ });
203
+
204
+ // A state layer lies under the label, so a hovered, focused or pressed button's label is read against its container
205
+ // with the layer over it. Material 3's layers (hover 8%, focus and pressed 10%) keep every label at 4.5:1: a filled
206
+ // button's on-colour over its colour, a tonal button's on-container colour over its tint. An active button shows one
207
+ // layer at a time over it too, as Material 3 does: Vuetify added its activated layer to the others, 18% or 20% of a
208
+ // text button's colour under its label, which took a primary label to 4.13:1.
209
+ async function expectEveryStateReadable(t, prefix) {
161
210
  const { vite, browser } = await open(t);
162
211
  const failures = [];
163
212
  let judged = 0;
@@ -172,7 +221,7 @@ test("every button's label keeps 4.5:1 at rest, hovered, focused and pressed, in
172
221
  await page.goto(`/home/button-contrast?theme=${theme}`);
173
222
  await expect(page.getByTestId("jskit-shell-page-title")).toHaveText("Button contrast");
174
223
  await page.addScriptTag({ path: AXE_PATH });
175
- const buttons = await page.locator("[data-testid^=contrast-]").all();
224
+ const buttons = await page.locator(`[data-testid^=${prefix}-]`).all();
176
225
  assert.equal(buttons.length, 35, "seven colours in five variants");
177
226
  for (const button of buttons) {
178
227
  const name = await button.getAttribute("data-testid");
@@ -212,4 +261,14 @@ test("every button's label keeps 4.5:1 at rest, hovered, focused and pressed, in
212
261
  }
213
262
  assert.equal(judged, 280, "every button judged in four states and two themes");
214
263
  assert.deepEqual(failures, [], "every label at 4.5:1 or more in every state");
215
- });
264
+ }
265
+
266
+ test("every button's label keeps 4.5:1 at rest, hovered, focused and pressed, in each colour, variant and theme", {
267
+ skip: SKIP,
268
+ timeout: 180_000
269
+ }, (t) => expectEveryStateReadable(t, "contrast"));
270
+
271
+ test("an active button's label keeps 4.5:1 at rest, hovered, focused and pressed, in each colour, variant and theme", {
272
+ skip: SKIP,
273
+ timeout: 180_000
274
+ }, (t) => expectEveryStateReadable(t, "active"));