@gjsify/adwaita-web 0.36.0 → 0.38.0
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/dist/adwaita-web.css +504 -34
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/accent.d.ts +28 -0
- package/lib/types/adw-accent.spec.d.ts +2 -0
- package/lib/types/adw-shortcut-label.spec.d.ts +2 -0
- package/lib/types/breakpoints.d.ts +10 -12
- package/lib/types/elements/adw-about-dialog.d.ts +19 -36
- package/lib/types/elements/adw-action-row.d.ts +9 -12
- package/lib/types/elements/adw-alert-dialog.d.ts +0 -12
- package/lib/types/elements/adw-avatar.d.ts +1 -0
- package/lib/types/elements/adw-bottom-sheet.d.ts +7 -12
- package/lib/types/elements/adw-button-content.d.ts +3 -4
- package/lib/types/elements/adw-button-row.d.ts +1 -1
- package/lib/types/elements/adw-carousel.d.ts +28 -49
- package/lib/types/elements/adw-checks.d.ts +2 -8
- package/lib/types/elements/adw-combo-row.d.ts +6 -6
- package/lib/types/elements/adw-data-grid.d.ts +5 -10
- package/lib/types/elements/adw-drop-down.d.ts +3 -11
- package/lib/types/elements/adw-entry-row.d.ts +20 -23
- package/lib/types/elements/adw-icon.d.ts +2 -4
- package/lib/types/elements/adw-inline-view-switcher.d.ts +18 -31
- package/lib/types/elements/adw-navigation-split-view.d.ts +7 -12
- package/lib/types/elements/adw-navigation-view.d.ts +2 -10
- package/lib/types/elements/adw-overlay-split-view.d.ts +28 -52
- package/lib/types/elements/adw-password-entry-row.d.ts +4 -5
- package/lib/types/elements/adw-popover.d.ts +2 -7
- package/lib/types/elements/adw-preferences-dialog.d.ts +21 -34
- package/lib/types/elements/adw-preferences-group.d.ts +12 -14
- package/lib/types/elements/adw-progress-bar.d.ts +3 -4
- package/lib/types/elements/adw-shortcut-label.d.ts +20 -0
- package/lib/types/elements/adw-sidebar.d.ts +5 -10
- package/lib/types/elements/adw-spinner.d.ts +3 -5
- package/lib/types/elements/adw-split-button.d.ts +6 -16
- package/lib/types/elements/adw-switch-row.d.ts +3 -3
- package/lib/types/elements/adw-tab-view.d.ts +16 -26
- package/lib/types/elements/adw-toast-overlay.d.ts +8 -13
- package/lib/types/elements/adw-view-stack.d.ts +7 -17
- package/lib/types/elements/adw-view-switcher-bar.d.ts +4 -8
- package/lib/types/elements/adw-view-switcher.d.ts +18 -38
- package/lib/types/elements/adw-wrap-box.d.ts +7 -17
- package/lib/types/elements/view-switcher-dom.d.ts +10 -13
- package/lib/types/index.d.ts +3 -0
- package/lib/types/source-view/hex.d.ts +7 -13
- package/lib/types/style-classes.spec.d.ts +11 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +18 -7
- package/scss/_about_dialog.scss +3 -2
- package/scss/_action_row.scss +33 -0
- package/scss/_avatar.scss +12 -0
- package/scss/_button.scss +44 -22
- package/scss/_card.scss +11 -8
- package/scss/_checks.scss +2 -4
- package/scss/_dialog.scss +3 -2
- package/scss/_headerbar.scss +23 -0
- package/scss/_popover.scss +8 -4
- package/scss/_preferences.scss +7 -7
- package/scss/_progress_bar.scss +9 -6
- package/scss/_reset.scss +1 -1
- package/scss/_shortcut_label.scss +80 -0
- package/scss/_sidebar.scss +57 -0
- package/scss/_status_page.scss +20 -0
- package/scss/_style_classes.scss +407 -0
- package/scss/_switch.scss +4 -3
- package/scss/_theme.scss +20 -2
- package/scss/_variables.scss +34 -1
- package/scss/adwaita-skin.scss +12 -0
- package/src/accent.ts +74 -0
- package/src/adw-about-dialog.spec.ts +34 -49
- package/src/adw-accent.spec.ts +105 -0
- package/src/adw-action-rows.spec.ts +25 -33
- package/src/adw-avatar.spec.ts +51 -20
- package/src/adw-banner.spec.ts +5 -8
- package/src/adw-button-content.spec.ts +9 -12
- package/src/adw-button-row.spec.ts +2 -4
- package/src/adw-carousel.spec.ts +40 -53
- package/src/adw-checks.spec.ts +36 -47
- package/src/adw-drop-down.spec.ts +25 -32
- package/src/adw-header-bar.spec.ts +5 -7
- package/src/adw-icon.spec.ts +23 -32
- package/src/adw-progress-bar.spec.ts +10 -12
- package/src/adw-row-state.spec.ts +9 -10
- package/src/adw-shortcut-label.spec.ts +112 -0
- package/src/adw-sidebar.spec.ts +17 -24
- package/src/adw-switch.spec.ts +11 -17
- package/src/adw-tab-view.spec.ts +7 -10
- package/src/adw-toast-overlay.spec.ts +7 -11
- package/src/adw-view-switcher-bar.spec.ts +10 -14
- package/src/adw-wrap-box.spec.ts +25 -36
- package/src/bottom-sheet.spec.ts +30 -36
- package/src/breakpoints.ts +15 -18
- package/src/chrome.spec.ts +13 -21
- package/src/elements/adw-about-dialog.ts +71 -114
- package/src/elements/adw-action-row.ts +22 -37
- package/src/elements/adw-alert-dialog.ts +25 -50
- package/src/elements/adw-avatar.ts +40 -15
- package/src/elements/adw-banner.ts +14 -18
- package/src/elements/adw-bottom-sheet.ts +31 -52
- package/src/elements/adw-button-content.ts +30 -37
- package/src/elements/adw-button-row.ts +14 -24
- package/src/elements/adw-carousel.ts +87 -148
- package/src/elements/adw-checks.ts +43 -56
- package/src/elements/adw-clamp.ts +8 -9
- package/src/elements/adw-combo-row.ts +17 -25
- package/src/elements/adw-data-grid.ts +26 -38
- package/src/elements/adw-dialog.ts +25 -56
- package/src/elements/adw-drop-down.ts +31 -51
- package/src/elements/adw-entry-row.ts +39 -46
- package/src/elements/adw-expander-row.ts +30 -53
- package/src/elements/adw-icon.ts +30 -53
- package/src/elements/adw-inline-view-switcher.ts +38 -67
- package/src/elements/adw-menu-button.ts +28 -58
- package/src/elements/adw-navigation-split-view.ts +35 -47
- package/src/elements/adw-navigation-view.ts +12 -28
- package/src/elements/adw-overlay-split-view.ts +100 -175
- package/src/elements/adw-password-entry-row.ts +18 -28
- package/src/elements/adw-popover.ts +28 -44
- package/src/elements/adw-preferences-dialog.ts +41 -66
- package/src/elements/adw-preferences-group.ts +33 -46
- package/src/elements/adw-progress-bar.ts +27 -47
- package/src/elements/adw-shortcut-label.ts +138 -0
- package/src/elements/adw-sidebar.ts +31 -39
- package/src/elements/adw-spin-row.ts +7 -14
- package/src/elements/adw-spinner.ts +31 -43
- package/src/elements/adw-split-button.ts +45 -75
- package/src/elements/adw-switch-row.ts +29 -46
- package/src/elements/adw-switch.ts +28 -47
- package/src/elements/adw-tab-view.ts +62 -103
- package/src/elements/adw-toast-overlay.ts +28 -35
- package/src/elements/adw-toggle-group.ts +9 -16
- package/src/elements/adw-view-stack.ts +32 -51
- package/src/elements/adw-view-switcher-bar.ts +26 -50
- package/src/elements/adw-view-switcher.ts +60 -110
- package/src/elements/adw-window-title.ts +4 -4
- package/src/elements/adw-wrap-box.ts +33 -59
- package/src/elements/view-switcher-dom.ts +15 -22
- package/src/entry-rows.spec.ts +18 -24
- package/src/index.ts +24 -15
- package/src/navigation-view.spec.ts +7 -10
- package/src/preferences-search.ts +11 -15
- package/src/preferences.spec.ts +13 -15
- package/src/source-view/adw-source-view.ts +6 -19
- package/src/source-view/hex.ts +7 -13
- package/src/split-button.spec.ts +32 -44
- package/src/split-views.spec.ts +83 -149
- package/src/style-classes.spec.ts +181 -0
- package/src/style-isolation.spec.ts +3 -6
- package/src/styles.generated.ts +1 -1
- package/src/tab-view.spec.ts +26 -35
- package/src/test.browser.mts +6 -0
- package/src/view-stack.spec.ts +23 -34
- package/src/view-switcher.spec.ts +56 -84
package/src/bottom-sheet.spec.ts
CHANGED
|
@@ -2,18 +2,15 @@
|
|
|
2
2
|
// the core suite and the NativeScript renderer assert against
|
|
3
3
|
// (`@gjsify/adwaita-core/conformance`).
|
|
4
4
|
//
|
|
5
|
-
// `Adw.BottomSheet` has four dismissal paths and they are four
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// already-closed sheet did nothing (libadwaita forwards it to the parent).
|
|
11
|
-
// Nothing failed, because nothing compared the element to the C source.
|
|
5
|
+
// `Adw.BottomSheet` has four dismissal paths and they are four DIFFERENT gates, so one
|
|
6
|
+
// shared `_attemptClose()` cannot express them: the drag handle is `can_target = FALSE`
|
|
7
|
+
// and closes nothing; Escape on a closed-but-focused sheet still signals
|
|
8
|
+
// `close-attempt`; and the `sheet.close` action on an already-closed sheet forwards to
|
|
9
|
+
// the parent.
|
|
12
10
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// `notify::open` carrying an unchanged payload.
|
|
11
|
+
// The open STATE must be HELD, not read back off the attribute — reading it made
|
|
12
|
+
// `open="false"` render OPEN and let a re-spelt attribute fire a `notify::open` with an
|
|
13
|
+
// unchanged payload.
|
|
17
14
|
import { describe, expect, it } from '@gjsify/unit';
|
|
18
15
|
|
|
19
16
|
import type { AdwBottomSheet } from './elements/adw-bottom-sheet.js';
|
|
@@ -75,8 +72,8 @@ export const AdwBottomSheetTest = async () => {
|
|
|
75
72
|
});
|
|
76
73
|
|
|
77
74
|
expect(returned).toBe(outcome);
|
|
78
|
-
// The verdict must be VISIBLE, not just returned:
|
|
79
|
-
//
|
|
75
|
+
// The verdict must be VISIBLE, not just returned: returning the right word
|
|
76
|
+
// and closing anyway is still wrong.
|
|
80
77
|
expect(sheet.open).toBe(outcome === 'close' ? false : open);
|
|
81
78
|
expect(attempts).toBe(outcome === 'close-attempt' ? 1 : 0);
|
|
82
79
|
expect(delegated).toBe(outcome === 'delegate' ? 1 : 0);
|
|
@@ -120,9 +117,9 @@ export const AdwBottomSheetTest = async () => {
|
|
|
120
117
|
|
|
121
118
|
await describe('adw-bottom-sheet open attribute semantics', async () => {
|
|
122
119
|
await it('open="false" renders CLOSED', () => {
|
|
123
|
-
//
|
|
124
|
-
//
|
|
125
|
-
// adw-bottom-sheet.c
|
|
120
|
+
// `hasAttribute('open')` for the getter while every other boolean uses
|
|
121
|
+
// `!== 'false'` gives one element two conventions.
|
|
122
|
+
// adw-bottom-sheet.c — `open = !!open` on a strict gboolean.
|
|
126
123
|
const sheet = document.createElement('adw-bottom-sheet') as AdwBottomSheet;
|
|
127
124
|
sheet.setAttribute('open', 'false');
|
|
128
125
|
document.body.appendChild(sheet);
|
|
@@ -141,10 +138,9 @@ export const AdwBottomSheetTest = async () => {
|
|
|
141
138
|
});
|
|
142
139
|
|
|
143
140
|
await it('re-spelling the attribute fires no spurious notify::open', () => {
|
|
144
|
-
//
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
// adw-bottom-sheet.c:1672-1682 returns before notifying.
|
|
141
|
+
// Guarding only on `oldValue === newValue` lets `open=""` → `open="open"` fire
|
|
142
|
+
// a second notification carrying an UNCHANGED payload.
|
|
143
|
+
// adw-bottom-sheet.c returns before notifying.
|
|
148
144
|
const sheet = mountSheet();
|
|
149
145
|
const payloads: boolean[] = [];
|
|
150
146
|
sheet.addEventListener('notify::open', (event) => {
|
|
@@ -170,9 +166,8 @@ export const AdwBottomSheetTest = async () => {
|
|
|
170
166
|
|
|
171
167
|
await describe('adw-bottom-sheet affordances', async () => {
|
|
172
168
|
await it('the drag handle is decorative — not focusable, not a button, closes nothing', () => {
|
|
173
|
-
// gtk_widget_set_can_focus/can_target (self->drag_handle, FALSE)
|
|
174
|
-
//
|
|
175
|
-
// role="button", tabindex=0 and a click-to-close handler.
|
|
169
|
+
// `gtk_widget_set_can_focus/can_target (self->drag_handle, FALSE)` — so no
|
|
170
|
+
// role="button", no tabindex=0 and no click-to-close handler.
|
|
176
171
|
const sheet = mountSheet();
|
|
177
172
|
sheet.open = true;
|
|
178
173
|
const handle = dragHandle(sheet);
|
|
@@ -207,8 +202,8 @@ export const AdwBottomSheetTest = async () => {
|
|
|
207
202
|
});
|
|
208
203
|
|
|
209
204
|
await it('a dimming click on a CLOSED sheet does nothing and signals nothing', () => {
|
|
210
|
-
// The scrim is `can_target = open
|
|
211
|
-
//
|
|
205
|
+
// The scrim is `can_target = open`, so it is not reachable at all — unlike
|
|
206
|
+
// Escape, it does not signal.
|
|
212
207
|
const sheet = mountSheet();
|
|
213
208
|
sheet.canClose = false;
|
|
214
209
|
const { attempts } = recordSignals(sheet, () => {
|
|
@@ -228,10 +223,9 @@ export const AdwBottomSheetTest = async () => {
|
|
|
228
223
|
});
|
|
229
224
|
|
|
230
225
|
await it('Escape on a CLOSED but focused sheet still raises close-attempt', () => {
|
|
231
|
-
// maybe_close_cb's emit is the fallthrough for every case that is
|
|
232
|
-
// (can_close && open)
|
|
233
|
-
//
|
|
234
|
-
// `_attemptClose`), so the corner was unreachable.
|
|
226
|
+
// `maybe_close_cb`'s emit is the fallthrough for every case that is NOT
|
|
227
|
+
// (can_close && open); guarding it away in the key handler and in
|
|
228
|
+
// `_attemptClose` makes the corner unreachable.
|
|
235
229
|
const sheet = mountSheet();
|
|
236
230
|
const { attempts } = recordSignals(sheet, () => {
|
|
237
231
|
insideSheet(sheet).dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));
|
|
@@ -254,9 +248,9 @@ export const AdwBottomSheetTest = async () => {
|
|
|
254
248
|
});
|
|
255
249
|
|
|
256
250
|
await it('sheet.close on an already-closed sheet delegates upward', () => {
|
|
257
|
-
// sheet_close_cb activates the PARENT's `sheet.close` action
|
|
258
|
-
//
|
|
259
|
-
//
|
|
251
|
+
// `sheet_close_cb` activates the PARENT's `sheet.close` action rather than
|
|
252
|
+
// doing nothing; a bubbling event is the DOM equivalent, so an enclosing
|
|
253
|
+
// sheet or dialog can act on it.
|
|
260
254
|
const sheet = mountSheet();
|
|
261
255
|
const host = sheet.parentElement as HTMLElement;
|
|
262
256
|
let seenOnAncestor = 0;
|
|
@@ -278,10 +272,10 @@ export const AdwBottomSheetTest = async () => {
|
|
|
278
272
|
});
|
|
279
273
|
|
|
280
274
|
await it('consumes the slot wrappers instead of leaving them in the content', () => {
|
|
281
|
-
// `<child type="sheet">` is GtkBuilder markup
|
|
282
|
-
//
|
|
283
|
-
// <adw-bottom-sheet-
|
|
284
|
-
//
|
|
275
|
+
// `<child type="sheet">` is GtkBuilder markup and nothing of it survives into
|
|
276
|
+
// the widget tree, so the emptied <adw-bottom-sheet-sheet> /
|
|
277
|
+
// <adw-bottom-sheet-content> wrappers must not fall through to `unslotted` and
|
|
278
|
+
// land in the content layer.
|
|
285
279
|
const sheet = mountSheet();
|
|
286
280
|
const content = sheet.querySelector('.adw-bottom-sheet-content') as HTMLElement;
|
|
287
281
|
expect(Array.from(content.children).map((el) => el.tagName.toLowerCase())).toStrictEqual(['button']);
|
package/src/breakpoints.ts
CHANGED
|
@@ -8,10 +8,9 @@
|
|
|
8
8
|
// `ResizeObserver` — which this module supplies under the same name, so the two
|
|
9
9
|
// ports read alike.
|
|
10
10
|
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
// on GTK and on NativeScript stayed frozen in one layout in the browser.
|
|
11
|
+
// Without a size source `<adw-navigation-split-view collapsed>` is a manual attribute the
|
|
12
|
+
// application has to flip itself, and markup that adapts on GTK and on NativeScript stays
|
|
13
|
+
// frozen in one layout in the browser.
|
|
15
14
|
//
|
|
16
15
|
// Reference: refs/libadwaita/src/adw-breakpoint.c
|
|
17
16
|
// Copyright (c) GNOME contributors (libadwaita). LGPLv2.1+.
|
|
@@ -21,19 +20,17 @@ import { AdwBreakpoint } from '@gjsify/adwaita-core';
|
|
|
21
20
|
/**
|
|
22
21
|
* Drive `breakpoints` from `element`'s own box, and return a dispose function.
|
|
23
22
|
*
|
|
24
|
-
* `ResizeObserver` delivers an initial observation on `observe()`, so the
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* The size read is the BORDER box in CSS pixels, the browser's counterpart to
|
|
29
|
-
* the `sp`/DIP units an Adwaita condition is written in.
|
|
23
|
+
* `ResizeObserver` delivers an initial observation on `observe()`, so the breakpoints
|
|
24
|
+
* settle on the correct state before first paint — no flash of the wrong layout, no
|
|
25
|
+
* separate seeding pass. The size read is the BORDER box in CSS pixels, the browser's
|
|
26
|
+
* counterpart to the `sp`/DIP units an Adwaita condition is written in.
|
|
30
27
|
*/
|
|
31
28
|
export function addBreakpoints(element: Element, breakpoints: readonly AdwBreakpoint[]): () => void {
|
|
32
29
|
const observer = new ResizeObserver((entries) => {
|
|
33
30
|
const entry = entries[entries.length - 1];
|
|
34
31
|
if (!entry) return;
|
|
35
|
-
// borderBoxSize is the spec'd path; contentRect is the fallback for the
|
|
36
|
-
//
|
|
32
|
+
// borderBoxSize is the spec'd path; contentRect is the fallback for the shape older
|
|
33
|
+
// engines report.
|
|
37
34
|
const box = entry.borderBoxSize?.[0];
|
|
38
35
|
const size = box
|
|
39
36
|
? { width: box.inlineSize, height: box.blockSize }
|
|
@@ -45,13 +42,13 @@ export function addBreakpoints(element: Element, breakpoints: readonly AdwBreakp
|
|
|
45
42
|
}
|
|
46
43
|
|
|
47
44
|
/**
|
|
48
|
-
* Wire a `breakpoint="<condition>"` attribute to a boolean setter, the browser
|
|
49
|
-
*
|
|
45
|
+
* Wire a `breakpoint="<condition>"` attribute to a boolean setter, the browser equivalent
|
|
46
|
+
* of an `Adw.Breakpoint` with one `add_setter()` call. Returns a dispose function; call it
|
|
47
|
+
* before re-binding and on disconnect.
|
|
50
48
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* flip state because its condition had a typo.
|
|
49
|
+
* A missing or unparsable condition binds nothing and returns a no-op, leaving whatever
|
|
50
|
+
* the attribute already says untouched — an element must not silently flip state because
|
|
51
|
+
* its condition had a typo.
|
|
55
52
|
*/
|
|
56
53
|
export function bindBreakpointSetter(
|
|
57
54
|
element: Element,
|
package/src/chrome.spec.ts
CHANGED
|
@@ -2,16 +2,12 @@
|
|
|
2
2
|
// <adw-spinner> and <adw-toolbar-view> — driven by the SAME vectors the
|
|
3
3
|
// NativeScript renderer asserts against (`@gjsify/adwaita-core/conformance`).
|
|
4
4
|
//
|
|
5
|
-
// Each of the three
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// child to nothing, the spinner defaulted to 24px and stroked a 2px ring where
|
|
9
|
-
// Adwaita strokes 3px, and the toolbar view carried none of the four style
|
|
10
|
-
// classes at all. Nothing failed, because nothing compared them.
|
|
5
|
+
// Each of the three answered a question libadwaita had already answered, and answered it
|
|
6
|
+
// differently from the NativeScript port: clamp tightening and `maximum-size="0"`, the
|
|
7
|
+
// spinner's default size and 3px stroke, and the toolbar view's four style classes.
|
|
11
8
|
//
|
|
12
|
-
// Sizes are driven by really resizing a host element and awaiting a real
|
|
13
|
-
//
|
|
14
|
-
// faking one.
|
|
9
|
+
// Sizes are driven by really resizing a host element and awaiting a real ResizeObserver
|
|
10
|
+
// delivery, as `breakpoints.spec.ts` does — never by faking one.
|
|
15
11
|
import { describe, expect, it } from '@gjsify/unit';
|
|
16
12
|
|
|
17
13
|
import { ADW_SPINNER_MIN_SIZE, ADW_SPINNER_TRACK_OPACITY, spinnerGeometry } from '@gjsify/adwaita-core';
|
|
@@ -54,8 +50,8 @@ function mountClamp(available: number): {
|
|
|
54
50
|
const { host, resize } = mountSized(available);
|
|
55
51
|
const clamp = document.createElement('adw-clamp');
|
|
56
52
|
const child = document.createElement('div');
|
|
57
|
-
// A bare block child fills the clamp and is capped by the max-width the
|
|
58
|
-
//
|
|
53
|
+
// A bare block child fills the clamp and is capped by the max-width the element
|
|
54
|
+
// writes — the shape every story uses.
|
|
59
55
|
child.textContent = 'clamped';
|
|
60
56
|
clamp.appendChild(child);
|
|
61
57
|
host.appendChild(clamp);
|
|
@@ -96,9 +92,8 @@ function mountToolbarView(topBarHeight: number, bottomBarHeight: number): { host
|
|
|
96
92
|
|
|
97
93
|
export const AdwChromeTest = async () => {
|
|
98
94
|
await describe('adw-clamp allocation (AdwClampLayout conformance vectors)', async () => {
|
|
99
|
-
// The browser resolves the child's own minimum through the normal
|
|
100
|
-
//
|
|
101
|
-
// describe what this element can be held to.
|
|
95
|
+
// The browser resolves the child's own minimum through the normal `min-width`
|
|
96
|
+
// cascade, so only rows with a zero child minimum describe this element.
|
|
102
97
|
const vectors = CLAMP_ALLOCATE_VECTORS.filter((v) => v.params.childMin === 0);
|
|
103
98
|
|
|
104
99
|
for (const { availableSize, params, childSize, sizeClass, offset, rule } of vectors) {
|
|
@@ -110,7 +105,7 @@ export const AdwChromeTest = async () => {
|
|
|
110
105
|
|
|
111
106
|
expect(clampedWidth(child)).toBe(childSize);
|
|
112
107
|
expect(sizeClassOf(child)).toBe(sizeClass);
|
|
113
|
-
// `margin-inline: auto` splits the remainder evenly
|
|
108
|
+
// `margin-inline: auto` splits the remainder evenly where libadwaita
|
|
114
109
|
// truncates, so the two can differ by half a pixel.
|
|
115
110
|
const leading = child.getBoundingClientRect().left - clamp.getBoundingClientRect().left;
|
|
116
111
|
expect(Math.abs(leading - offset) <= 1).toBe(true);
|
|
@@ -120,8 +115,7 @@ export const AdwChromeTest = async () => {
|
|
|
120
115
|
}
|
|
121
116
|
|
|
122
117
|
await it('follows the viewport instead of pinning the child to the maximum', async () => {
|
|
123
|
-
//
|
|
124
|
-
// hand the child ALL of the available width, not the cap.
|
|
118
|
+
// A narrow clamp hands the child ALL of the available width, not the cap.
|
|
125
119
|
const { host, clamp, child, resize } = mountClamp(1000);
|
|
126
120
|
await settle();
|
|
127
121
|
expect(clampedWidth(child)).toBe(600);
|
|
@@ -132,8 +126,6 @@ export const AdwChromeTest = async () => {
|
|
|
132
126
|
});
|
|
133
127
|
|
|
134
128
|
await it('honours tightening-threshold, which the element used to ignore', async () => {
|
|
135
|
-
// The storybook has exposed this control all along and only the GTK
|
|
136
|
-
// pane responded to it.
|
|
137
129
|
const { host, clamp, child } = mountClamp(700);
|
|
138
130
|
clamp.setAttribute('maximum-size', '600');
|
|
139
131
|
clamp.setAttribute('tightening-threshold', '400');
|
|
@@ -323,7 +315,7 @@ export const AdwChromeTest = async () => {
|
|
|
323
315
|
|
|
324
316
|
await it('KEEPS SPINNING under reduced motion — a frozen busy indicator reads as a hang', () => {
|
|
325
317
|
// libadwaita opts the spinner out of the animation setting on purpose
|
|
326
|
-
|
|
318
|
+
//. The old stylesheet had
|
|
327
319
|
// `@media (prefers-reduced-motion: reduce) { animation: none }`, so
|
|
328
320
|
// this asserts the ABSENCE of any CSS animation to switch off: the
|
|
329
321
|
// arc is driven per frame from JS and cannot be disabled by a query.
|
|
@@ -345,7 +337,7 @@ export const AdwChromeTest = async () => {
|
|
|
345
337
|
expect(arc.getAttribute('stroke-dashoffset')).not.toBe(first);
|
|
346
338
|
|
|
347
339
|
// Unmapping removes it from the shared ticker — `widget_map_cb`
|
|
348
|
-
//
|
|
340
|
+
// is what plays the animation, so
|
|
349
341
|
// an off-screen spinner burns nothing.
|
|
350
342
|
spinner.remove();
|
|
351
343
|
const parked = arc.getAttribute('stroke-dashoffset');
|