@operato/data-grist 10.29.77 → 10.29.78
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/dist/src/data-card/record-card.d.ts +4 -0
- package/dist/src/data-card/record-card.js +62 -20
- package/dist/src/data-card/record-card.js.map +1 -1
- package/dist/test/accessible-name.test.js +324 -0
- package/dist/test/accessible-name.test.js.map +1 -0
- package/dist/test/accumulator-labels.test.d.ts +1 -0
- package/dist/test/accumulator-labels.test.js +32 -0
- package/dist/test/accumulator-labels.test.js.map +1 -0
- package/dist/test/address-intents.test.js +201 -0
- package/dist/test/address-intents.test.js.map +1 -0
- package/dist/test/card-selector.test.js +71 -0
- package/dist/test/card-selector.test.js.map +1 -0
- package/dist/test/card-thumb.test.d.ts +1 -0
- package/dist/test/card-thumb.test.js +44 -0
- package/dist/test/card-thumb.test.js.map +1 -0
- package/dist/test/card-totals-narrow.test.js +103 -0
- package/dist/test/card-totals-narrow.test.js.map +1 -0
- package/dist/test/cell-button-row-height.test.js +53 -0
- package/dist/test/cell-button-row-height.test.js.map +1 -0
- package/dist/test/column-resize.test.js +153 -0
- package/dist/test/column-resize.test.js.map +1 -0
- package/dist/test/control-heights.test.js +25 -0
- package/dist/test/control-heights.test.js.map +1 -0
- package/dist/test/count-handler.test.js +56 -0
- package/dist/test/count-handler.test.js.map +1 -0
- package/dist/test/create-paste-policy.test.js +159 -0
- package/dist/test/create-paste-policy.test.js.map +1 -0
- package/dist/test/data-integrity.test.js +145 -0
- package/dist/test/data-integrity.test.js.map +1 -0
- package/dist/test/destructive-actions.test.js +147 -0
- package/dist/test/destructive-actions.test.js.map +1 -0
- package/dist/test/edit-lifecycle.test.js +270 -0
- package/dist/test/edit-lifecycle.test.js.map +1 -0
- package/dist/test/edit-rebase.test.js +185 -0
- package/dist/test/edit-rebase.test.js.map +1 -0
- package/dist/test/editor-commit.test.js +68 -0
- package/dist/test/editor-commit.test.js.map +1 -0
- package/dist/test/fetch-failure-state.test.js +129 -0
- package/dist/test/fetch-failure-state.test.js.map +1 -0
- package/dist/test/field-contains-content.test.js +101 -0
- package/dist/test/field-contains-content.test.js.map +1 -0
- package/dist/test/field-hint.test.js +54 -0
- package/dist/test/field-hint.test.js.map +1 -0
- package/dist/test/filter-labels.test.js +140 -0
- package/dist/test/filter-labels.test.js.map +1 -0
- package/dist/test/filter-ownership.test.js +83 -0
- package/dist/test/filter-ownership.test.js.map +1 -0
- package/dist/test/filter-select-buttons-count.test.js +35 -0
- package/dist/test/filter-select-buttons-count.test.js.map +1 -0
- package/dist/test/filter-typing.test.js +66 -0
- package/dist/test/filter-typing.test.js.map +1 -0
- package/dist/test/filters-phone-wrap.test.js +17 -0
- package/dist/test/filters-phone-wrap.test.js.map +1 -0
- package/dist/test/first-click-stays.test.js +77 -0
- package/dist/test/first-click-stays.test.js.map +1 -0
- package/dist/test/fixed-column-opaque.test.js +134 -0
- package/dist/test/fixed-column-opaque.test.js.map +1 -0
- package/dist/test/flexible-columns.test.js +134 -0
- package/dist/test/flexible-columns.test.js.map +1 -0
- package/dist/test/grid-single-scroller.test.js +107 -0
- package/dist/test/grid-single-scroller.test.js.map +1 -0
- package/dist/test/group-heading.test.js +208 -0
- package/dist/test/group-heading.test.js.map +1 -0
- package/dist/test/latest-fetch-wins.test.js +91 -0
- package/dist/test/latest-fetch-wins.test.js.map +1 -0
- package/dist/test/list-defaults.test.js +145 -0
- package/dist/test/list-defaults.test.js.map +1 -0
- package/dist/test/list-records.test.js +46 -0
- package/dist/test/list-records.test.js.map +1 -0
- package/dist/test/office-density.test.js +52 -0
- package/dist/test/office-density.test.js.map +1 -0
- package/dist/test/page-errors.d.ts +1 -0
- package/dist/test/page-errors.js +44 -0
- package/dist/test/page-errors.js.map +1 -0
- package/dist/test/paste-integrity.test.js +163 -0
- package/dist/test/paste-integrity.test.js.map +1 -0
- package/dist/test/record-card-height.test.js +15 -0
- package/dist/test/record-card-height.test.js.map +1 -0
- package/dist/test/record-view-popup-editor.test.js +71 -0
- package/dist/test/record-view-popup-editor.test.js.map +1 -0
- package/dist/test/renderer-date-calendar-day.test.js +48 -0
- package/dist/test/renderer-date-calendar-day.test.js.map +1 -0
- package/dist/test/request-generation.test.js +153 -0
- package/dist/test/request-generation.test.js.map +1 -0
- package/dist/test/resubmit.test.js +83 -0
- package/dist/test/resubmit.test.js.map +1 -0
- package/dist/test/row-hover-visible.test.js +139 -0
- package/dist/test/row-hover-visible.test.js.map +1 -0
- package/dist/test/search-term.test.js +108 -0
- package/dist/test/search-term.test.js.map +1 -0
- package/dist/test/searchable-select.test.js +65 -0
- package/dist/test/searchable-select.test.js.map +1 -0
- package/dist/test/select-empty-value.test.js +61 -0
- package/dist/test/select-empty-value.test.js.map +1 -0
- package/dist/test/shift-range-select.test.js +100 -0
- package/dist/test/shift-range-select.test.js.map +1 -0
- package/dist/test/sparkline-renderer.test.js +36 -0
- package/dist/test/sparkline-renderer.test.js.map +1 -0
- package/dist/test/wheel-one-scroller.test.js +275 -0
- package/dist/test/wheel-one-scroller.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/test/card-selector.test.ts +18 -4
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/* Elements are compared by presence, not by value: a failing element comparison makes chai render the DOM and hang the runner. */
|
|
2
|
+
import { expect, fixture } from '@open-wc/testing';
|
|
3
|
+
import { sendMouse } from '@web/test-runner-commands';
|
|
4
|
+
import { html } from 'lit';
|
|
5
|
+
import '../src/data-grist.js';
|
|
6
|
+
const settle = (ms = 150) => new Promise(resolve => setTimeout(resolve, ms));
|
|
7
|
+
const LONG = 'A very long account name that is far wider than any room the table has left for it';
|
|
8
|
+
async function grid(widths, width = 700, editable = false) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const columns = [
|
|
11
|
+
{ type: 'string', name: 'id', hidden: true },
|
|
12
|
+
{ type: 'string', name: 'name', header: 'name', width: (_a = widths.name) !== null && _a !== void 0 ? _a : 150, record: { editable } },
|
|
13
|
+
{ type: 'string', name: 'code', header: 'code', width: 100 },
|
|
14
|
+
{ type: 'string', name: 'memo', header: 'memo', width: (_b = widths.memo) !== null && _b !== void 0 ? _b : 120 }
|
|
15
|
+
];
|
|
16
|
+
const records = Array.from({ length: 5 }, (_, r) => ({ id: String(r), name: r % 2 ? LONG : 'short', code: 'C-' + r, memo: 'note ' + r }));
|
|
17
|
+
const el = (await fixture(html `
|
|
18
|
+
<ox-grist
|
|
19
|
+
style=${`width: ${width}px; height: 320px`}
|
|
20
|
+
mode="GRID"
|
|
21
|
+
.config=${{ columns, pagination: { infinite: true }, rows: { appendable: false, selectable: false } }}
|
|
22
|
+
.data=${{ records }}
|
|
23
|
+
></ox-grist>
|
|
24
|
+
`));
|
|
25
|
+
await settle();
|
|
26
|
+
await el.updateComplete;
|
|
27
|
+
const ox = el.renderRoot.querySelector('#grist');
|
|
28
|
+
await ox.updateComplete;
|
|
29
|
+
const scroller = ox.renderRoot.querySelector('div[grid]');
|
|
30
|
+
const header = ox.renderRoot.querySelector('ox-grid-header');
|
|
31
|
+
const body = ox.renderRoot.querySelector('ox-grid-body');
|
|
32
|
+
await body.updateComplete;
|
|
33
|
+
await settle(50);
|
|
34
|
+
return { ox, scroller, header, body };
|
|
35
|
+
}
|
|
36
|
+
function heads(header) {
|
|
37
|
+
return Array.from(header.renderRoot.querySelectorAll('[role=columnheader]'));
|
|
38
|
+
}
|
|
39
|
+
function width(element) {
|
|
40
|
+
return Math.round(element.getBoundingClientRect().width);
|
|
41
|
+
}
|
|
42
|
+
/** The largest distance, in left or in width, between a header cell and a cell of its column, over every row. */
|
|
43
|
+
function misalignment(header, body) {
|
|
44
|
+
const hs = heads(header);
|
|
45
|
+
let worst = 0;
|
|
46
|
+
for (const row of Array.from(body.renderRoot.querySelectorAll('div[grid-row]'))) {
|
|
47
|
+
const cells = Array.from(row.querySelectorAll(':scope > ox-grid-field'));
|
|
48
|
+
hs.forEach((h, i) => {
|
|
49
|
+
const cell = cells[i];
|
|
50
|
+
if (!cell)
|
|
51
|
+
return;
|
|
52
|
+
const a = h.getBoundingClientRect();
|
|
53
|
+
const b = cell.getBoundingClientRect();
|
|
54
|
+
worst = Math.max(worst, Math.abs(a.left - b.left), Math.abs(a.width - b.width));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return Math.round(worst);
|
|
58
|
+
}
|
|
59
|
+
/** Whether the text of a column's cell is cut in any row. */
|
|
60
|
+
function cut(body, index) {
|
|
61
|
+
return Array.from(body.renderRoot.querySelectorAll('div[grid-row]')).some(row => {
|
|
62
|
+
const cell = row.querySelectorAll(':scope > ox-grid-field')[index];
|
|
63
|
+
return !!cell && [cell, ...Array.from(cell.renderRoot.querySelectorAll('*'))].some(e => e.scrollWidth > e.clientWidth + 1);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
describe('a flexible column', () => {
|
|
67
|
+
/* Resizing the grid body inside a fixture trips Chrome's benign "ResizeObserver loop" error. */
|
|
68
|
+
const ignoreResizeLoop = (e) => {
|
|
69
|
+
if (String(e.message).includes('ResizeObserver loop')) {
|
|
70
|
+
e.stopImmediatePropagation();
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
let previousOnError = null;
|
|
75
|
+
before(() => {
|
|
76
|
+
window.addEventListener('error', ignoreResizeLoop, true);
|
|
77
|
+
previousOnError = window.onerror;
|
|
78
|
+
window.onerror = (message, ...rest) => String(message).includes('ResizeObserver loop') ? true : previousOnError === null || previousOnError === void 0 ? void 0 : previousOnError.call(window, message, ...rest);
|
|
79
|
+
});
|
|
80
|
+
after(async () => {
|
|
81
|
+
window.removeEventListener('error', ignoreResizeLoop, true);
|
|
82
|
+
window.onerror = previousOnError;
|
|
83
|
+
await sendMouse({ type: 'move', position: [0, 0] });
|
|
84
|
+
});
|
|
85
|
+
it('with room, takes the room on the right and stays under its header', async () => {
|
|
86
|
+
const { scroller, header, body } = await grid({ name: 'minmax(150px, 1fr)' }, 1200);
|
|
87
|
+
const name = heads(header)[0];
|
|
88
|
+
expect(width(name), 'the column takes the room').to.be.greaterThan(500);
|
|
89
|
+
expect(scroller.scrollWidth, 'nothing overflows').to.be.at.most(scroller.clientWidth);
|
|
90
|
+
expect(misalignment(header, body)).to.equal(0);
|
|
91
|
+
});
|
|
92
|
+
it('without room, stays at its floor, cuts its text and stays under its header', async () => {
|
|
93
|
+
const { header, body } = await grid({ name: 'minmax(150px, 1fr)', memo: 600 }, 700);
|
|
94
|
+
expect(width(heads(header)[0])).to.equal(150);
|
|
95
|
+
expect(cut(body, 0), 'the long name is cut').to.equal(true);
|
|
96
|
+
expect(misalignment(header, body)).to.equal(0);
|
|
97
|
+
});
|
|
98
|
+
it('two flexible columns share the room one to two and stay under their headers', async () => {
|
|
99
|
+
const { header, body } = await grid({ name: 'minmax(100px, 1fr)', memo: 'minmax(100px, 2fr)' }, 900);
|
|
100
|
+
const [name, , memo] = heads(header);
|
|
101
|
+
/* fr shares the whole width of the tracks, not what is above their floors: 1fr and 2fr are x and 2x. */
|
|
102
|
+
const share = width(memo) / width(name);
|
|
103
|
+
expect(share).to.be.within(1.9, 2.1);
|
|
104
|
+
expect(misalignment(header, body)).to.equal(0);
|
|
105
|
+
});
|
|
106
|
+
it('leaves a table of fixed columns as it was', async () => {
|
|
107
|
+
const { body } = await grid({}, 700);
|
|
108
|
+
const cell = body.renderRoot.querySelector('ox-grid-field');
|
|
109
|
+
expect(getComputedStyle(cell).contain).to.equal('none');
|
|
110
|
+
});
|
|
111
|
+
it('prints with a valid template', async () => {
|
|
112
|
+
const { ox } = await grid({ name: 'minmax(150px, 1fr)' }, 700);
|
|
113
|
+
const print = ox.style.getPropertyValue('--grid-template-print-columns');
|
|
114
|
+
expect(CSS.supports('grid-template-columns', print), print).to.equal(true);
|
|
115
|
+
expect(print).to.contain('150fr');
|
|
116
|
+
});
|
|
117
|
+
it('dragging its edge gives it a width in px from where it stood', async () => {
|
|
118
|
+
const { header } = await grid({ name: 'minmax(150px, 1fr)' }, 1000, true);
|
|
119
|
+
const name = heads(header)[0];
|
|
120
|
+
const before = width(name);
|
|
121
|
+
const splitter = name.querySelector('span[splitter]');
|
|
122
|
+
expect(!!splitter, 'an editable column has a handle').to.equal(true);
|
|
123
|
+
const r = splitter.getBoundingClientRect();
|
|
124
|
+
const x = Math.round(r.left + r.width / 2);
|
|
125
|
+
const y = Math.round(r.top + r.height / 2);
|
|
126
|
+
await sendMouse({ type: 'move', position: [x, y] });
|
|
127
|
+
await sendMouse({ type: 'down' });
|
|
128
|
+
await sendMouse({ type: 'move', position: [x - 40, y] });
|
|
129
|
+
await sendMouse({ type: 'up' });
|
|
130
|
+
await settle(300);
|
|
131
|
+
expect(width(heads(header)[0])).to.be.within(before - 45, before - 35);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
//# sourceMappingURL=flexible-columns.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flexible-columns.test.js","sourceRoot":"","sources":["../../test/flexible-columns.test.ts"],"names":[],"mappings":"AAAA,kIAAkI;AAClI,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,sBAAsB,CAAA;AAuB7B,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,GAAG,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAE5E,MAAM,IAAI,GAAG,oFAAoF,CAAA;AAEjG,KAAK,UAAU,IAAI,CAAC,MAAkC,EAAE,KAAK,GAAG,GAAG,EAAE,QAAQ,GAAG,KAAK;;IACnF,MAAM,OAAO,GAAU;QACrB,EAAE,IAAI,EAAE,QAAQ,EAAE,IA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CAAC,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC,CAAA;IACxE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/* Elements are compared by presence, not by value: a failing element comparison makes chai render the DOM and hang the runner. */\nimport { expect, fixture } from '@open-wc/testing'\nimport { sendMouse } from '@web/test-runner-commands'\nimport { html } from 'lit'\n\nimport '../src/data-grist.js'\n\n/**\n * A column that takes the room left over: `width: 'minmax(150px, 1fr)'`.\n *\n * A string width goes into grid-template-columns as it is, so fr was always accepted — and broke the\n * table. The header and the body are two CSS grids with the same template. A flexible track is sized\n * from what its cells hold, and the two grids hold different things: the body grew the column to its\n * longest text while the header kept it at its floor. Measured on the balance screen: 182px apart with\n * one fr column whose text was longer than the room, 251px with two fr columns.\n *\n * ```\n * aligned every cell sits under its header, room or no room\n * room a flexible column takes the room on the right; the filler after the last column gets none\n * no room it stays at its floor and its text is cut (\"…\"), as a fixed column's is\n * ratio 1fr and 2fr share the room one to two\n * print the print template is a valid template (px became fr letter by letter: minmax(150fr, 1fr))\n * resize dragging a flexible column's edge gives it a width in px from where it stood\n * ```\n */\n\ntype Root = HTMLElement & { renderRoot: ShadowRoot; updateComplete: Promise<unknown> }\n\nconst settle = (ms = 150) => new Promise(resolve => setTimeout(resolve, ms))\n\nconst LONG = 'A very long account name that is far wider than any room the table has left for it'\n\nasync function grid(widths: { name?: any; memo?: any }, width = 700, editable = false) {\n const columns: any[] = [\n { type: 'string', name: 'id', hidden: true },\n { type: 'string', name: 'name', header: 'name', width: widths.name ?? 150, record: { editable } },\n { type: 'string', name: 'code', header: 'code', width: 100 },\n { type: 'string', name: 'memo', header: 'memo', width: widths.memo ?? 120 }\n ]\n\n const records = Array.from({ length: 5 }, (_, r) => ({ id: String(r), name: r % 2 ? LONG : 'short', code: 'C-' + r, memo: 'note ' + r }))\n\n const el = (await fixture(html`\n <ox-grist\n style=${`width: ${width}px; height: 320px`}\n mode=\"GRID\"\n .config=${{ columns, pagination: { infinite: true }, rows: { appendable: false, selectable: false } }}\n .data=${{ records }}\n ></ox-grist>\n `)) as Root\n\n await settle()\n await el.updateComplete\n\n const ox = el.renderRoot.querySelector('#grist') as Root\n await ox.updateComplete\n const scroller = ox.renderRoot.querySelector('div[grid]') as HTMLElement\n const header = ox.renderRoot.querySelector('ox-grid-header') as Root\n const body = ox.renderRoot.querySelector('ox-grid-body') as Root\n await body.updateComplete\n await settle(50)\n\n return { ox, scroller, header, body }\n}\n\nfunction heads(header: Root) {\n return Array.from(header.renderRoot.querySelectorAll('[role=columnheader]')) as HTMLElement[]\n}\n\nfunction width(element: Element) {\n return Math.round(element.getBoundingClientRect().width)\n}\n\n/** The largest distance, in left or in width, between a header cell and a cell of its column, over every row. */\nfunction misalignment(header: Root, body: Root) {\n const hs = heads(header)\n let worst = 0\n for (const row of Array.from(body.renderRoot.querySelectorAll('div[grid-row]'))) {\n const cells = Array.from(row.querySelectorAll(':scope > ox-grid-field')) as HTMLElement[]\n hs.forEach((h, i) => {\n const cell = cells[i]\n if (!cell) return\n const a = h.getBoundingClientRect()\n const b = cell.getBoundingClientRect()\n worst = Math.max(worst, Math.abs(a.left - b.left), Math.abs(a.width - b.width))\n })\n }\n return Math.round(worst)\n}\n\n/** Whether the text of a column's cell is cut in any row. */\nfunction cut(body: Root, index: number) {\n return Array.from(body.renderRoot.querySelectorAll('div[grid-row]')).some(row => {\n const cell = row.querySelectorAll(':scope > ox-grid-field')[index] as Root | undefined\n return !!cell && [cell, ...Array.from(cell.renderRoot.querySelectorAll('*'))].some(e => e.scrollWidth > e.clientWidth + 1)\n })\n}\n\ndescribe('a flexible column', () => {\n /* Resizing the grid body inside a fixture trips Chrome's benign \"ResizeObserver loop\" error. */\n const ignoreResizeLoop = (e: ErrorEvent) => {\n if (String(e.message).includes('ResizeObserver loop')) {\n e.stopImmediatePropagation()\n e.preventDefault()\n }\n }\n let previousOnError: OnErrorEventHandler = null\n before(() => {\n window.addEventListener('error', ignoreResizeLoop, true)\n previousOnError = window.onerror\n window.onerror = (message, ...rest) =>\n String(message).includes('ResizeObserver loop') ? true : previousOnError?.call(window, message, ...rest)\n })\n after(async () => {\n window.removeEventListener('error', ignoreResizeLoop, true)\n window.onerror = previousOnError\n await sendMouse({ type: 'move', position: [0, 0] })\n })\n\n it('with room, takes the room on the right and stays under its header', async () => {\n const { scroller, header, body } = await grid({ name: 'minmax(150px, 1fr)' }, 1200)\n\n const name = heads(header)[0]\n expect(width(name), 'the column takes the room').to.be.greaterThan(500)\n expect(scroller.scrollWidth, 'nothing overflows').to.be.at.most(scroller.clientWidth)\n expect(misalignment(header, body)).to.equal(0)\n })\n\n it('without room, stays at its floor, cuts its text and stays under its header', async () => {\n const { header, body } = await grid({ name: 'minmax(150px, 1fr)', memo: 600 }, 700)\n\n expect(width(heads(header)[0])).to.equal(150)\n expect(cut(body, 0), 'the long name is cut').to.equal(true)\n expect(misalignment(header, body)).to.equal(0)\n })\n\n it('two flexible columns share the room one to two and stay under their headers', async () => {\n const { header, body } = await grid({ name: 'minmax(100px, 1fr)', memo: 'minmax(100px, 2fr)' }, 900)\n\n const [name, , memo] = heads(header)\n /* fr shares the whole width of the tracks, not what is above their floors: 1fr and 2fr are x and 2x. */\n const share = width(memo) / width(name)\n expect(share).to.be.within(1.9, 2.1)\n expect(misalignment(header, body)).to.equal(0)\n })\n\n it('leaves a table of fixed columns as it was', async () => {\n const { body } = await grid({}, 700)\n\n const cell = body.renderRoot.querySelector('ox-grid-field') as HTMLElement\n expect(getComputedStyle(cell).contain).to.equal('none')\n })\n\n it('prints with a valid template', async () => {\n const { ox } = await grid({ name: 'minmax(150px, 1fr)' }, 700)\n\n const print = ox.style.getPropertyValue('--grid-template-print-columns')\n expect(CSS.supports('grid-template-columns', print), print).to.equal(true)\n expect(print).to.contain('150fr')\n })\n\n it('dragging its edge gives it a width in px from where it stood', async () => {\n const { header } = await grid({ name: 'minmax(150px, 1fr)' }, 1000, true)\n\n const name = heads(header)[0]\n const before = width(name)\n const splitter = name.querySelector('span[splitter]') as HTMLElement\n expect(!!splitter, 'an editable column has a handle').to.equal(true)\n\n const r = splitter.getBoundingClientRect()\n const x = Math.round(r.left + r.width / 2)\n const y = Math.round(r.top + r.height / 2)\n await sendMouse({ type: 'move', position: [x, y] })\n await sendMouse({ type: 'down' })\n await sendMouse({ type: 'move', position: [x - 40, y] })\n await sendMouse({ type: 'up' })\n await settle(300)\n\n expect(width(heads(header)[0])).to.be.within(before - 45, before - 35)\n })\n})\n"]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* Elements are compared by presence, not by value: a failing element comparison makes chai render the DOM and hang the runner. */
|
|
2
|
+
import { expect, fixture } from '@open-wc/testing';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
import '../src/data-grist.js';
|
|
5
|
+
const settle = (ms = 150) => new Promise(resolve => setTimeout(resolve, ms));
|
|
6
|
+
async function grid() {
|
|
7
|
+
const columns = [
|
|
8
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
9
|
+
{ type: 'string', name: 'id', hidden: true },
|
|
10
|
+
{ type: 'string', name: 'code', header: 'code', width: 120, fixed: true }
|
|
11
|
+
];
|
|
12
|
+
for (let i = 0; i < 12; i++) {
|
|
13
|
+
columns.push({ type: 'string', name: 'c' + i, header: 'col ' + i, width: 110 });
|
|
14
|
+
}
|
|
15
|
+
const records = Array.from({ length: 60 }, (_, r) => {
|
|
16
|
+
const record = { id: String(r), code: 'C-' + r };
|
|
17
|
+
for (let i = 0; i < 12; i++)
|
|
18
|
+
record['c' + i] = `v${r}-${i}`;
|
|
19
|
+
return record;
|
|
20
|
+
});
|
|
21
|
+
const el = (await fixture(html `
|
|
22
|
+
<ox-grist
|
|
23
|
+
style="width: 600px; height: 320px"
|
|
24
|
+
mode="GRID"
|
|
25
|
+
.config=${{ columns, pagination: { pages: [100] } }}
|
|
26
|
+
.fetchHandler=${async () => ({ total: records.length, records })}
|
|
27
|
+
></ox-grist>
|
|
28
|
+
`));
|
|
29
|
+
await el.fetch();
|
|
30
|
+
await settle();
|
|
31
|
+
await el.updateComplete;
|
|
32
|
+
const grist = el.renderRoot.querySelector('#grist');
|
|
33
|
+
const scroller = grist.renderRoot.querySelector('div[grid]');
|
|
34
|
+
const header = grist.renderRoot.querySelector('ox-grid-header');
|
|
35
|
+
const body = grist.renderRoot.querySelector('ox-grid-body');
|
|
36
|
+
await body.updateComplete;
|
|
37
|
+
return { grist, scroller, header, body };
|
|
38
|
+
}
|
|
39
|
+
/** The largest horizontal distance between a column's header cell and its cell in the first row. */
|
|
40
|
+
function misalignment(header, body) {
|
|
41
|
+
const heads = Array.from(header.renderRoot.querySelectorAll('[role=columnheader]'));
|
|
42
|
+
const row = body.renderRoot.querySelector('div[grid-row]');
|
|
43
|
+
const cells = Array.from(row.querySelectorAll('ox-grid-field'));
|
|
44
|
+
const n = Math.min(heads.length, cells.length);
|
|
45
|
+
let worst = 0;
|
|
46
|
+
for (let i = 0; i < n; i++) {
|
|
47
|
+
worst = Math.max(worst, Math.abs(heads[i].getBoundingClientRect().left - cells[i].getBoundingClientRect().left));
|
|
48
|
+
}
|
|
49
|
+
return { n, worst };
|
|
50
|
+
}
|
|
51
|
+
describe('grid header and body share one scroller', () => {
|
|
52
|
+
/* Resizing the grid body inside a fixture trips Chrome's benign "ResizeObserver loop" error. */
|
|
53
|
+
const ignoreResizeLoop = (e) => {
|
|
54
|
+
if (String(e.message).includes('ResizeObserver loop')) {
|
|
55
|
+
e.stopImmediatePropagation();
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
let previousOnError = null;
|
|
60
|
+
before(() => {
|
|
61
|
+
window.addEventListener('error', ignoreResizeLoop, true);
|
|
62
|
+
previousOnError = window.onerror;
|
|
63
|
+
window.onerror = (message, ...rest) => String(message).includes('ResizeObserver loop') ? true : previousOnError === null || previousOnError === void 0 ? void 0 : previousOnError.call(window, message, ...rest);
|
|
64
|
+
});
|
|
65
|
+
after(() => {
|
|
66
|
+
window.removeEventListener('error', ignoreResizeLoop, true);
|
|
67
|
+
window.onerror = previousOnError;
|
|
68
|
+
});
|
|
69
|
+
it('neither the header nor the body scrolls on its own', async () => {
|
|
70
|
+
const { scroller, header, body } = await grid();
|
|
71
|
+
expect(scroller.scrollWidth, 'the grid must overflow, or this measures nothing').to.be.greaterThan(scroller.clientWidth);
|
|
72
|
+
expect(getComputedStyle(body).overflowX).to.equal('visible');
|
|
73
|
+
expect(getComputedStyle(header).overflowX).to.equal('visible');
|
|
74
|
+
expect(header.offsetWidth, 'header and body span the same width').to.equal(body.offsetWidth);
|
|
75
|
+
});
|
|
76
|
+
for (const where of ['start', 'middle', 'end']) {
|
|
77
|
+
it(`every column lines up with its header at the ${where}`, async () => {
|
|
78
|
+
const { scroller, header, body } = await grid();
|
|
79
|
+
const max = scroller.scrollWidth - scroller.clientWidth;
|
|
80
|
+
scroller.scrollLeft = where === 'start' ? 0 : where === 'middle' ? Math.round(max / 2) : max;
|
|
81
|
+
await settle(50);
|
|
82
|
+
const { n, worst } = misalignment(header, body);
|
|
83
|
+
expect(n, 'columns must be drawn, or this measures nothing').to.be.greaterThan(10);
|
|
84
|
+
expect(worst).to.equal(0);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
it('the header stays on top when the rows scroll', async () => {
|
|
88
|
+
const { scroller, header } = await grid();
|
|
89
|
+
scroller.scrollTop = 600;
|
|
90
|
+
await settle(50);
|
|
91
|
+
expect(scroller.scrollTop, 'the rows must scroll, or this measures nothing').to.be.greaterThan(0);
|
|
92
|
+
expect(header.getBoundingClientRect().top).to.equal(scroller.getBoundingClientRect().top);
|
|
93
|
+
});
|
|
94
|
+
it('a focused row that was under the header is brought out below it', async () => {
|
|
95
|
+
const { grist, scroller, header, body } = await grid();
|
|
96
|
+
scroller.scrollTop = 600;
|
|
97
|
+
await settle(50);
|
|
98
|
+
grist.focused = { row: 2, column: 3 };
|
|
99
|
+
await grist.updateComplete;
|
|
100
|
+
await body.updateComplete;
|
|
101
|
+
await settle(50);
|
|
102
|
+
const focused = body.renderRoot.querySelector('ox-grid-field[focused]');
|
|
103
|
+
expect(!!focused, 'a cell must take the focus').to.equal(true);
|
|
104
|
+
expect(focused.getBoundingClientRect().top).to.be.at.least(header.getBoundingClientRect().bottom - 1);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
//# sourceMappingURL=grid-single-scroller.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-single-scroller.test.js","sourceRoot":"","sources":["../../test/grid-single-scroller.test.ts"],"names":[],"mappings":"AAAA,kIAAkI;AAClI,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,sBAAsB,CAAA;AAqB7B,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,GAAG,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAE5E,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAU;QACrB,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE;QAC1C,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;QAC5C,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE;KAC1E,CAAA;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,EAAE,MAAM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,CAAC,SAAS,EAAE,gDAAgD,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;QACjG,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,qBAAqB,EAAE,CAAC,GAAG,CAAC,CAAA;IAC3F,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iEAAiE,EAAE,KAAK,IAAI,EAAE;QAC/E,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,EAAE,CAAA;QAEtD,QAAQ,CAAC,SAAS,GAAG,GAAG,CAAA;QACxB,MAAM,MAAM,CAAC,EAAE,CAAC,CAAA;QAEhB,KAAK,CAAC,OAAO,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAA;QACrC,MAAM,KAAK,CAAC,cAAc,CAAA;QAC1B,MAAM,IAAI,CAAC,cAAc,CAAA;QACzB,MAAM,MAAM,CAAC,EAAE,CAAC,CAAA;QAEhB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,wBAAwB,CAAgB,CAAA;QACtF,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,4BAA4B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9D,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACvG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/* Elements are compared by presence, not by value: a failing element comparison makes chai render the DOM and hang the runner. */\nimport { expect, fixture } from '@open-wc/testing'\nimport { html } from 'lit'\n\nimport '../src/data-grist.js'\n\n/**\n * Header and body move as one.\n *\n * The body used to be its own scroller, and the header a second scroller that copied the body's\n * scrollLeft from its scroll event (and the other way round). Three things went wrong:\n *\n * ```\n * gap the compositor moves the body at once; the header only moves after the main thread\n * handles the event, so on a busy screen it trails by several frames\n * shake the sync ran both ways, so a late header event put the body back one frame\n * the end when the two scroll widths differ, the header stops while the body goes on\n * ```\n *\n * Now the role=grid box is the only scroller. The header sticks to its top and the body does not\n * scroll. Nothing copies a position, so nothing can trail or pull back.\n */\n\ntype Root = HTMLElement & { renderRoot: ShadowRoot; updateComplete: Promise<unknown> }\n\nconst settle = (ms = 150) => new Promise(resolve => setTimeout(resolve, ms))\n\nasync function grid() {\n const columns: any[] = [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'string', name: 'id', hidden: true },\n { type: 'string', name: 'code', header: 'code', width: 120, fixed: true }\n ]\n for (let i = 0; i < 12; i++) {\n columns.push({ type: 'string', name: 'c' + i, header: 'col ' + i, width: 110 })\n }\n\n const records = Array.from({ length: 60 }, (_, r) => {\n const record: any = { id: String(r), code: 'C-' + r }\n for (let i = 0; i < 12; i++) record['c' + i] = `v${r}-${i}`\n return record\n })\n\n const el = (await fixture(html`\n <ox-grist\n style=\"width: 600px; height: 320px\"\n mode=\"GRID\"\n .config=${{ columns, pagination: { pages: [100] } }}\n .fetchHandler=${async () => ({ total: records.length, records })}\n ></ox-grist>\n `)) as Root & { fetch(): Promise<void> }\n\n await el.fetch()\n await settle()\n await el.updateComplete\n\n const grist = el.renderRoot.querySelector('#grist') as Root & { focused?: { row: number; column: number } }\n const scroller = grist.renderRoot.querySelector('div[grid]') as HTMLElement\n const header = grist.renderRoot.querySelector('ox-grid-header') as Root\n const body = grist.renderRoot.querySelector('ox-grid-body') as Root\n await body.updateComplete\n\n return { grist, scroller, header, body }\n}\n\n/** The largest horizontal distance between a column's header cell and its cell in the first row. */\nfunction misalignment(header: Root, body: Root) {\n const heads = Array.from(header.renderRoot.querySelectorAll('[role=columnheader]')) as HTMLElement[]\n const row = body.renderRoot.querySelector('div[grid-row]') as HTMLElement\n const cells = Array.from(row.querySelectorAll('ox-grid-field')) as HTMLElement[]\n const n = Math.min(heads.length, cells.length)\n\n let worst = 0\n for (let i = 0; i < n; i++) {\n worst = Math.max(worst, Math.abs(heads[i].getBoundingClientRect().left - cells[i].getBoundingClientRect().left))\n }\n return { n, worst }\n}\n\ndescribe('grid header and body share one scroller', () => {\n /* Resizing the grid body inside a fixture trips Chrome's benign \"ResizeObserver loop\" error. */\n const ignoreResizeLoop = (e: ErrorEvent) => {\n if (String(e.message).includes('ResizeObserver loop')) {\n e.stopImmediatePropagation()\n e.preventDefault()\n }\n }\n let previousOnError: OnErrorEventHandler = null\n before(() => {\n window.addEventListener('error', ignoreResizeLoop, true)\n previousOnError = window.onerror\n window.onerror = (message, ...rest) =>\n String(message).includes('ResizeObserver loop') ? true : previousOnError?.call(window, message, ...rest)\n })\n after(() => {\n window.removeEventListener('error', ignoreResizeLoop, true)\n window.onerror = previousOnError\n })\n\n it('neither the header nor the body scrolls on its own', async () => {\n const { scroller, header, body } = await grid()\n\n expect(scroller.scrollWidth, 'the grid must overflow, or this measures nothing').to.be.greaterThan(\n scroller.clientWidth\n )\n expect(getComputedStyle(body).overflowX).to.equal('visible')\n expect(getComputedStyle(header).overflowX).to.equal('visible')\n expect(header.offsetWidth, 'header and body span the same width').to.equal(body.offsetWidth)\n })\n\n for (const where of ['start', 'middle', 'end'] as const) {\n it(`every column lines up with its header at the ${where}`, async () => {\n const { scroller, header, body } = await grid()\n\n const max = scroller.scrollWidth - scroller.clientWidth\n scroller.scrollLeft = where === 'start' ? 0 : where === 'middle' ? Math.round(max / 2) : max\n await settle(50)\n\n const { n, worst } = misalignment(header, body)\n expect(n, 'columns must be drawn, or this measures nothing').to.be.greaterThan(10)\n expect(worst).to.equal(0)\n })\n }\n\n it('the header stays on top when the rows scroll', async () => {\n const { scroller, header } = await grid()\n\n scroller.scrollTop = 600\n await settle(50)\n\n expect(scroller.scrollTop, 'the rows must scroll, or this measures nothing').to.be.greaterThan(0)\n expect(header.getBoundingClientRect().top).to.equal(scroller.getBoundingClientRect().top)\n })\n\n it('a focused row that was under the header is brought out below it', async () => {\n const { grist, scroller, header, body } = await grid()\n\n scroller.scrollTop = 600\n await settle(50)\n\n grist.focused = { row: 2, column: 3 }\n await grist.updateComplete\n await body.updateComplete\n await settle(50)\n\n const focused = body.renderRoot.querySelector('ox-grid-field[focused]') as HTMLElement\n expect(!!focused, 'a cell must take the focus').to.equal(true)\n expect(focused.getBoundingClientRect().top).to.be.at.least(header.getBoundingClientRect().bottom - 1)\n })\n})\n"]}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/* Elements are compared by presence, not by value: a failing element comparison makes chai render the DOM and hang the runner. */
|
|
2
|
+
import { expect, fixture } from '@open-wc/testing';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
import '../src/data-grist.js';
|
|
5
|
+
import { failOnPageErrors } from './page-errors.js';
|
|
6
|
+
/*
|
|
7
|
+
* Group headings (rows.groups): the management check reads 「자금 지연」 above its late money, in a table on a wide
|
|
8
|
+
* screen and over the cards on a phone (2026-11-06). A heading stands wherever the group value changes, written by
|
|
9
|
+
* the group column's renderer.
|
|
10
|
+
*/
|
|
11
|
+
const NAMES = { funds: 'Late money', books: 'Books' };
|
|
12
|
+
const records = [
|
|
13
|
+
{ id: '1', group: 'funds', what: 'Overdue collections', count: 23 },
|
|
14
|
+
{ id: '2', group: 'funds', what: 'Unpaid VAT', count: 1 },
|
|
15
|
+
{ id: '3', group: 'books', what: 'Lines without an account', count: 4 }
|
|
16
|
+
];
|
|
17
|
+
const config = (groups) => ({
|
|
18
|
+
columns: [
|
|
19
|
+
{ type: 'string', name: 'group', header: 'Group', hidden: true, record: { renderer: (value) => NAMES[value] } },
|
|
20
|
+
{ type: 'string', name: 'what', header: 'What' },
|
|
21
|
+
{ type: 'integer', name: 'count', header: 'Count' }
|
|
22
|
+
],
|
|
23
|
+
rows: { appendable: false, editable: false, selectable: false, groups },
|
|
24
|
+
list: { fields: ['what'], details: ['count'] }
|
|
25
|
+
});
|
|
26
|
+
const idle = async (el) => {
|
|
27
|
+
while (!((await el.updateComplete) && (await el.grist.updateComplete)))
|
|
28
|
+
;
|
|
29
|
+
};
|
|
30
|
+
const mount = async (mode, groups) => {
|
|
31
|
+
const el = await fixture(html `<ox-grist style="display:flex;width:700px;height:400px" mode=${mode} .config=${config(groups)} .data=${{ records }}></ox-grist>`);
|
|
32
|
+
await idle(el);
|
|
33
|
+
/* The grid draws its rows in ox-grid-body. */
|
|
34
|
+
const root = (mode == 'GRID' ? el.grist.renderRoot.querySelector('ox-grid-body').renderRoot : el.grist.renderRoot);
|
|
35
|
+
return root;
|
|
36
|
+
};
|
|
37
|
+
describe('group headings', () => {
|
|
38
|
+
failOnPageErrors();
|
|
39
|
+
for (const mode of ['GRID', 'CARD']) {
|
|
40
|
+
it(`stand where the group changes, in the group column's words (${mode})`, async () => {
|
|
41
|
+
const root = await mount(mode, [{ column: 'group' }]);
|
|
42
|
+
const headings = Array.from(root.querySelectorAll('[group-heading]'));
|
|
43
|
+
expect(headings.map(one => one.textContent.trim())).to.deep.equal(['Late money', 'Books']);
|
|
44
|
+
/* Each heading stands above the first row of its group and spans the whole row. */
|
|
45
|
+
const rows = Array.from(root.querySelectorAll(mode == 'GRID' ? 'ox-grid-field[role="gridcell"]' : 'ox-record-card'));
|
|
46
|
+
const firstOf = (text) => rows.find((one) => { var _a, _b; return ((_a = one.record) === null || _a === void 0 ? void 0 : _a.what) === text && (mode == 'CARD' || ((_b = one.column) === null || _b === void 0 ? void 0 : _b.name) === 'what'); }).getBoundingClientRect();
|
|
47
|
+
const box = (one) => (mode == 'GRID' ? one.firstElementChild : one).getBoundingClientRect();
|
|
48
|
+
expect(box(headings[0]).bottom).to.be.at.most(firstOf('Overdue collections').top + 0.5);
|
|
49
|
+
expect(box(headings[1]).top).to.be.at.least(firstOf('Unpaid VAT').bottom - 0.5);
|
|
50
|
+
expect(box(headings[1]).bottom).to.be.at.most(firstOf('Lines without an account').top + 0.5);
|
|
51
|
+
expect(box(headings[1]).width, 'the heading does not span the row').to.be.above(600);
|
|
52
|
+
});
|
|
53
|
+
it(`are not drawn when the rows are not grouped (${mode})`, async () => {
|
|
54
|
+
const root = await mount(mode, []);
|
|
55
|
+
expect(root.querySelector('[group-heading]')).to.equal(null);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
describe('a link a renderer returns', () => {
|
|
60
|
+
failOnPageErrors();
|
|
61
|
+
for (const mode of ['GRID', 'CARD']) {
|
|
62
|
+
it(`reads as the text around it, not the browser's blue underline (${mode})`, async () => {
|
|
63
|
+
var _a;
|
|
64
|
+
const linked = {
|
|
65
|
+
...config([]),
|
|
66
|
+
columns: [
|
|
67
|
+
{ type: 'string', name: 'what', header: 'What', record: { renderer: (value) => html `<a href="#open">${value}</a>` } },
|
|
68
|
+
{ type: 'integer', name: 'count', header: 'Count' }
|
|
69
|
+
]
|
|
70
|
+
};
|
|
71
|
+
const el = await fixture(html `<ox-grist style="display:flex;width:700px;height:400px;color:rgb(10, 20, 30)" mode=${mode} .config=${linked} .data=${{ records }}></ox-grist>`);
|
|
72
|
+
await idle(el);
|
|
73
|
+
const root = (mode == 'GRID' ? el.grist.renderRoot.querySelector('ox-grid-body').renderRoot : el.grist.renderRoot);
|
|
74
|
+
const fields = Array.from(root.querySelectorAll(mode == 'GRID' ? 'ox-grid-field' : 'ox-record-card'));
|
|
75
|
+
const holder = mode == 'GRID' ? fields.find(one => { var _a; return ((_a = one.column) === null || _a === void 0 ? void 0 : _a.name) === 'what'; }) : fields[0].renderRoot.querySelector('ox-card-field');
|
|
76
|
+
const link = holder.renderRoot.querySelector('a');
|
|
77
|
+
const style = getComputedStyle(link);
|
|
78
|
+
expect(style.textDecorationLine).to.equal('none');
|
|
79
|
+
expect(style.color).to.equal(getComputedStyle((_a = link.parentElement) !== null && _a !== void 0 ? _a : holder).color);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
describe('a card field with nothing to show', () => {
|
|
84
|
+
failOnPageErrors();
|
|
85
|
+
it('takes no place - no label stands alone', async () => {
|
|
86
|
+
const labelled = {
|
|
87
|
+
...config([]),
|
|
88
|
+
columns: [
|
|
89
|
+
{ type: 'string', name: 'what', header: 'What' },
|
|
90
|
+
{ type: 'integer', name: 'count', header: 'Count', label: { renderer: () => 'Count' }, record: { renderer: (value) => value !== null && value !== void 0 ? value : '' } }
|
|
91
|
+
]
|
|
92
|
+
};
|
|
93
|
+
const el = await fixture(html `<ox-grist style="display:flex;width:700px;height:400px" mode="CARD" .config=${labelled} .data=${{ records: [{ id: '1', what: 'Azure' }, { id: '2', what: 'VAT', count: 1 }] }}></ox-grist>`);
|
|
94
|
+
await idle(el);
|
|
95
|
+
const cards = Array.from(el.grist.renderRoot.querySelectorAll('ox-record-card'));
|
|
96
|
+
const countOf = (card) => card.renderRoot.querySelector('[detail] ox-card-field');
|
|
97
|
+
expect(countOf(cards[0]).getBoundingClientRect().width, 'an empty field stands').to.equal(0);
|
|
98
|
+
expect(countOf(cards[1]).getBoundingClientRect().width, 'a field with a value is gone').to.be.above(0);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
describe('the rows under a row (tree.childrenProperty)', () => {
|
|
102
|
+
failOnPageErrors();
|
|
103
|
+
const tree = [
|
|
104
|
+
{ id: '1', group: 'funds', what: 'Planned money not seen', count: 3, children: [{ id: '1a', what: 'Azure', count: 7 }, { id: '1b', what: 'Office 365' }] },
|
|
105
|
+
{ id: '2', group: 'funds', what: 'Unpaid VAT', count: 1 },
|
|
106
|
+
{ id: '3', group: 'books', what: 'Lines without an account', count: 4 }
|
|
107
|
+
];
|
|
108
|
+
const treeConfig = { ...config([{ column: 'group' }]), tree: { childrenProperty: 'children', expanded: () => true } };
|
|
109
|
+
const mount = async (mode) => {
|
|
110
|
+
const el = await fixture(html `<ox-grist style="display:flex;width:700px;height:500px" mode=${mode} .config=${treeConfig} .data=${{ records: tree }}></ox-grist>`);
|
|
111
|
+
await idle(el);
|
|
112
|
+
return el;
|
|
113
|
+
};
|
|
114
|
+
it('stand inside the parent card on a card list, not as cards of their own', async () => {
|
|
115
|
+
const el = await mount('CARD');
|
|
116
|
+
const cards = Array.from(el.grist.renderRoot.querySelectorAll('ox-record-card'));
|
|
117
|
+
expect(cards.map(card => card.record.what)).to.deep.equal(['Planned money not seen', 'Unpaid VAT', 'Lines without an account']);
|
|
118
|
+
const children = Array.from(cards[0].renderRoot.querySelectorAll('[child]'));
|
|
119
|
+
expect(children.map(child => child.querySelector('ox-card-field').record.what)).to.deep.equal(['Azure', 'Office 365']);
|
|
120
|
+
expect(cards[1].renderRoot.querySelector('[children]'), 'a row with no children shows a children block').to.equal(null);
|
|
121
|
+
/* A child's title takes its own line; its details stand under it. */
|
|
122
|
+
const [title, detail] = Array.from(children[0].querySelectorAll('ox-card-field'));
|
|
123
|
+
const titleBox = title.getBoundingClientRect();
|
|
124
|
+
expect(detail.getBoundingClientRect().top, 'the details stand beside the title').to.be.above(titleBox.top + titleBox.height / 2);
|
|
125
|
+
/* The room between two children is wider than the room between a child's two lines. */
|
|
126
|
+
const between = children[1].getBoundingClientRect().top - children[0].getBoundingClientRect().bottom;
|
|
127
|
+
const within = detail.getBoundingClientRect().top - titleBox.bottom;
|
|
128
|
+
expect(between, 'the children run together').to.be.at.least(within + 8);
|
|
129
|
+
const headings = Array.from(el.grist.renderRoot.querySelectorAll('[group-heading]'));
|
|
130
|
+
expect(headings.map(one => one.textContent.trim())).to.deep.equal(['Late money', 'Books']);
|
|
131
|
+
});
|
|
132
|
+
it('stand as rows under the parent in the grid, and do not open a group again', async () => {
|
|
133
|
+
const el = await mount('GRID');
|
|
134
|
+
const body = el.grist.renderRoot.querySelector('ox-grid-body').renderRoot;
|
|
135
|
+
const whats = Array.from(body.querySelectorAll('ox-grid-field[role="gridcell"]')).filter(one => { var _a; return ((_a = one.column) === null || _a === void 0 ? void 0 : _a.name) === 'what'; }).map(one => one.record.what);
|
|
136
|
+
expect(whats).to.deep.equal(['Planned money not seen', 'Azure', 'Office 365', 'Unpaid VAT', 'Lines without an account']);
|
|
137
|
+
/* A child steps in under its parent at its first column, and only there. */
|
|
138
|
+
const cell = (what, name) => Array.from(body.querySelectorAll('ox-grid-field[role="gridcell"]')).find(one => { var _a; return one.record.what === what && ((_a = one.column) === null || _a === void 0 ? void 0 : _a.name) === name; });
|
|
139
|
+
const pad = (one) => parseFloat(getComputedStyle(one).paddingLeft);
|
|
140
|
+
expect(pad(cell('Azure', 'what')), 'a child does not step in').to.be.above(pad(cell('Planned money not seen', 'what')) + 8);
|
|
141
|
+
expect(pad(cell('Azure', 'count'))).to.equal(pad(cell('Planned money not seen', 'count')));
|
|
142
|
+
const headings = Array.from(body.querySelectorAll('[group-heading]'));
|
|
143
|
+
expect(headings.map(one => one.textContent.trim())).to.deep.equal(['Late money', 'Books']);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
describe('a page button a renderer returns', () => {
|
|
147
|
+
failOnPageErrors();
|
|
148
|
+
for (const mode of ['GRID', 'CARD']) {
|
|
149
|
+
it(`takes the page's quiet look, not the filled gutter button (${mode})`, async () => {
|
|
150
|
+
const acting = {
|
|
151
|
+
...config([]),
|
|
152
|
+
columns: [
|
|
153
|
+
{ type: 'string', name: 'what', header: 'What' },
|
|
154
|
+
{ type: 'string', name: 'act', header: '', record: { renderer: () => html `<button quiet small>Open</button>` } }
|
|
155
|
+
],
|
|
156
|
+
list: { fields: ['what'], details: ['act'] }
|
|
157
|
+
};
|
|
158
|
+
const el = await fixture(html `<ox-grist style="display:flex;width:700px;height:400px" mode=${mode} .config=${acting} .data=${{ records }}></ox-grist>`);
|
|
159
|
+
await idle(el);
|
|
160
|
+
const root = (mode == 'GRID' ? el.grist.renderRoot.querySelector('ox-grid-body').renderRoot : el.grist.renderRoot);
|
|
161
|
+
const fields = Array.from(root.querySelectorAll(mode == 'GRID' ? 'ox-grid-field' : 'ox-record-card'));
|
|
162
|
+
const holder = mode == 'GRID' ? fields.find(one => { var _a; return ((_a = one.column) === null || _a === void 0 ? void 0 : _a.name) === 'act'; }) : fields[0].renderRoot.querySelector('[detail] ox-card-field');
|
|
163
|
+
const button = holder.renderRoot.querySelector('button');
|
|
164
|
+
expect(getComputedStyle(button).backgroundColor, 'a quiet button is filled').to.be.oneOf(['rgba(0, 0, 0, 0)', 'transparent']);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
describe('an empty text detail on a card', () => {
|
|
169
|
+
failOnPageErrors();
|
|
170
|
+
it('takes no place with the default text renderer', async () => {
|
|
171
|
+
const texts = {
|
|
172
|
+
...config([]),
|
|
173
|
+
columns: [
|
|
174
|
+
{ type: 'string', name: 'what', header: 'What' },
|
|
175
|
+
{ type: 'string', name: 'summary', header: 'Summary', label: { renderer: () => 'Summary' } }
|
|
176
|
+
],
|
|
177
|
+
list: { fields: ['what'], details: ['summary'] }
|
|
178
|
+
};
|
|
179
|
+
const el = await fixture(html `<ox-grist style="display:flex;width:700px;height:400px" mode="CARD" .config=${texts} .data=${{ records: [{ id: '1', what: 'one' }, { id: '2', what: 'two', summary: 'said' }] }}></ox-grist>`);
|
|
180
|
+
await idle(el);
|
|
181
|
+
const cards = Array.from(el.grist.renderRoot.querySelectorAll('ox-record-card'));
|
|
182
|
+
const summaryOf = (card) => card.renderRoot.querySelector('[detail] ox-card-field');
|
|
183
|
+
expect(summaryOf(cards[0]).getBoundingClientRect().width, 'an empty summary stands').to.equal(0);
|
|
184
|
+
expect(summaryOf(cards[1]).getBoundingClientRect().width).to.be.above(0);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
describe('a gutter button with its title', () => {
|
|
188
|
+
failOnPageErrors();
|
|
189
|
+
it("keeps the gutter's small filled look - the page button look is for a renderer's button", async () => {
|
|
190
|
+
const acting = {
|
|
191
|
+
...config([]),
|
|
192
|
+
columns: [
|
|
193
|
+
{ type: 'gutter', gutterName: 'button', icon: 'play_arrow', title: 'Start', iconOnly: false, width: 72 },
|
|
194
|
+
{ type: 'string', name: 'what', header: 'What' }
|
|
195
|
+
]
|
|
196
|
+
};
|
|
197
|
+
const el = await fixture(html `<ox-grist style="display:flex;width:700px;height:400px" mode="GRID" .config=${acting} .data=${{ records }}></ox-grist>`);
|
|
198
|
+
await idle(el);
|
|
199
|
+
const root = el.grist.renderRoot.querySelector('ox-grid-body').renderRoot;
|
|
200
|
+
const field = Array.from(root.querySelectorAll('ox-grid-field')).find(one => { var _a; return ((_a = one.column) === null || _a === void 0 ? void 0 : _a.gutterName) === 'button'; });
|
|
201
|
+
const button = field.renderRoot.querySelector('button');
|
|
202
|
+
const look = getComputedStyle(button);
|
|
203
|
+
expect(look.fontWeight, 'not the page button weight').to.not.equal('600');
|
|
204
|
+
expect(look.fontSize, "the gutter's 0.8rem").to.equal(`${0.8 * parseFloat(getComputedStyle(document.documentElement).fontSize)}px`);
|
|
205
|
+
expect(look.borderTopWidth, 'no page button border').to.equal('0px');
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
//# sourceMappingURL=group-heading.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-heading.test.js","sourceRoot":"","sources":["../../test/group-heading.test.ts"],"names":[],"mappings":"AAAA,kIAAkI;AAClI,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAEnD;;;;GAIG;AAEH,MAAM,KAAK,GAA2B,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AAC7E,MAAM,OAAO,GAAG;IACd,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,E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AAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;aACjD;SACF,CAAA;QACD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAY,IAAI,CAAA,+EAA+E,MAAM,UAAU,EAAE,OAAO,EAAE,cAAc,CAAC,CAAA;QACjK,MAAM,IAAI,CAAC,EAAE,CAAC,CAAA;QACd,MAAM,IAAI,GAAI,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,cAAc,CAAS,CAAC,UAAwB,CAAA;QAChG,MAAM,KAAK,GAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,WAAC,OAAA,CAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,UAAU,MAAK,QAAQ,CAAA,EAAA,CAAC,CAAA;QAC5H,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAgB,CAAA;QACtE,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;QACrC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,4BAA4B,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACzE,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QACnI,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/* Elements are compared by presence, not by value: a failing element comparison makes chai render the DOM and hang the runner. */\nimport { expect, fixture } from '@open-wc/testing'\nimport { html } from 'lit'\n\nimport '../src/data-grist.js'\nimport { DataGrist } from '../src/data-grist.js'\nimport { failOnPageErrors } from './page-errors.js'\n\n/*\n * Group headings (rows.groups): the management check reads 「자금 지연」 above its late money, in a table on a wide\n * screen and over the cards on a phone (2026-11-06). A heading stands wherever the group value changes, written by\n * the group column's renderer.\n */\n\nconst NAMES: Record<string, string> = { funds: 'Late money', books: 'Books' }\nconst records = [\n { id: '1', group: 'funds', what: 'Overdue collections', count: 23 },\n { id: '2', group: 'funds', what: 'Unpaid VAT', count: 1 },\n { id: '3', group: 'books', what: 'Lines without an account', count: 4 }\n]\nconst config = (groups: any[]) => ({\n columns: [\n { type: 'string', name: 'group', header: 'Group', hidden: true, record: { renderer: (value: string) => NAMES[value] } },\n { type: 'string', name: 'what', header: 'What' },\n { type: 'integer', name: 'count', header: 'Count' }\n ],\n rows: { appendable: false, editable: false, selectable: false, groups },\n list: { fields: ['what'], details: ['count'] }\n})\n\nconst idle = async (el: DataGrist) => {\n while (!((await el.updateComplete) && (await el.grist.updateComplete)));\n}\n\nconst mount = async (mode: 'GRID' | 'CARD', groups: any[]) => {\n const el = await fixture<DataGrist>(\n html`<ox-grist style=\"display:flex;width:700px;height:400px\" mode=${mode} .config=${config(groups)} .data=${{ records }}></ox-grist>`\n )\n await idle(el)\n /* The grid draws its rows in ox-grid-body. */\n const root = (mode == 'GRID' ? (el.grist.renderRoot.querySelector('ox-grid-body') as any).renderRoot : el.grist.renderRoot) as ShadowRoot\n return root\n}\n\ndescribe('group headings', () => {\n failOnPageErrors()\n\n for (const mode of ['GRID', 'CARD'] as const) {\n it(`stand where the group changes, in the group column's words (${mode})`, async () => {\n const root = await mount(mode, [{ column: 'group' }])\n const headings = Array.from(root.querySelectorAll('[group-heading]')) as HTMLElement[]\n expect(headings.map(one => one.textContent!.trim())).to.deep.equal(['Late money', 'Books'])\n\n /* Each heading stands above the first row of its group and spans the whole row. */\n const rows = Array.from(root.querySelectorAll(mode == 'GRID' ? 'ox-grid-field[role=\"gridcell\"]' : 'ox-record-card')) as HTMLElement[]\n const firstOf = (text: string) =>\n rows.find((one: any) => one.record?.what === text && (mode == 'CARD' || one.column?.name === 'what'))!.getBoundingClientRect()\n const box = (one: HTMLElement) => (mode == 'GRID' ? (one.firstElementChild as HTMLElement) : one).getBoundingClientRect()\n expect(box(headings[0]).bottom).to.be.at.most(firstOf('Overdue collections').top + 0.5)\n expect(box(headings[1]).top).to.be.at.least(firstOf('Unpaid VAT').bottom - 0.5)\n expect(box(headings[1]).bottom).to.be.at.most(firstOf('Lines without an account').top + 0.5)\n expect(box(headings[1]).width, 'the heading does not span the row').to.be.above(600)\n })\n\n it(`are not drawn when the rows are not grouped (${mode})`, async () => {\n const root = await mount(mode, [])\n expect(root.querySelector('[group-heading]')).to.equal(null)\n })\n }\n})\n\ndescribe('a link a renderer returns', () => {\n failOnPageErrors()\n\n for (const mode of ['GRID', 'CARD'] as const) {\n it(`reads as the text around it, not the browser's blue underline (${mode})`, async () => {\n const linked = {\n ...config([]),\n columns: [\n { type: 'string', name: 'what', header: 'What', record: { renderer: (value: string) => html`<a href=\"#open\">${value}</a>` } },\n { type: 'integer', name: 'count', header: 'Count' }\n ]\n }\n const el = await fixture<DataGrist>(\n html`<ox-grist style=\"display:flex;width:700px;height:400px;color:rgb(10, 20, 30)\" mode=${mode} .config=${linked} .data=${{ records }}></ox-grist>`\n )\n await idle(el)\n const root = (mode == 'GRID' ? (el.grist.renderRoot.querySelector('ox-grid-body') as any).renderRoot : el.grist.renderRoot) as ShadowRoot\n const fields = Array.from(root.querySelectorAll(mode == 'GRID' ? 'ox-grid-field' : 'ox-record-card')) as any[]\n const holder = mode == 'GRID' ? fields.find(one => one.column?.name === 'what') : fields[0].renderRoot.querySelector('ox-card-field')\n const link = holder.renderRoot.querySelector('a') as HTMLElement\n const style = getComputedStyle(link)\n expect(style.textDecorationLine).to.equal('none')\n expect(style.color).to.equal(getComputedStyle(link.parentElement ?? holder).color)\n })\n }\n})\n\ndescribe('a card field with nothing to show', () => {\n failOnPageErrors()\n\n it('takes no place - no label stands alone', async () => {\n const labelled = {\n ...config([]),\n columns: [\n { type: 'string', name: 'what', header: 'What' },\n { type: 'integer', name: 'count', header: 'Count', label: { renderer: () => 'Count' }, record: { renderer: (value: any) => value ?? '' } }\n ]\n }\n const el = await fixture<DataGrist>(\n html`<ox-grist style=\"display:flex;width:700px;height:400px\" mode=\"CARD\" .config=${labelled} .data=${{ records: [{ id: '1', what: 'Azure' }, { id: '2', what: 'VAT', count: 1 }] }}></ox-grist>`\n )\n await idle(el)\n const cards = Array.from(el.grist.renderRoot.querySelectorAll('ox-record-card')) as any[]\n const countOf = (card: any) => card.renderRoot.querySelector('[detail] ox-card-field') as HTMLElement\n expect(countOf(cards[0]).getBoundingClientRect().width, 'an empty field stands').to.equal(0)\n expect(countOf(cards[1]).getBoundingClientRect().width, 'a field with a value is gone').to.be.above(0)\n })\n})\n\ndescribe('the rows under a row (tree.childrenProperty)', () => {\n failOnPageErrors()\n\n const tree = [\n { id: '1', group: 'funds', what: 'Planned money not seen', count: 3, children: [{ id: '1a', what: 'Azure', count: 7 }, { id: '1b', what: 'Office 365' }] },\n { id: '2', group: 'funds', what: 'Unpaid VAT', count: 1 },\n { id: '3', group: 'books', what: 'Lines without an account', count: 4 }\n ]\n const treeConfig = { ...config([{ column: 'group' }]), tree: { childrenProperty: 'children', expanded: () => true } }\n\n const mount = async (mode: 'GRID' | 'CARD') => {\n const el = await fixture<DataGrist>(\n html`<ox-grist style=\"display:flex;width:700px;height:500px\" mode=${mode} .config=${treeConfig} .data=${{ records: tree }}></ox-grist>`\n )\n await idle(el)\n return el\n }\n\n it('stand inside the parent card on a card list, not as cards of their own', async () => {\n const el = await mount('CARD')\n const cards = Array.from(el.grist.renderRoot.querySelectorAll('ox-record-card')) as any[]\n expect(cards.map(card => card.record.what)).to.deep.equal(['Planned money not seen', 'Unpaid VAT', 'Lines without an account'])\n const children = Array.from(cards[0].renderRoot.querySelectorAll('[child]')) as HTMLElement[]\n expect(children.map(child => (child.querySelector('ox-card-field') as any).record.what)).to.deep.equal(['Azure', 'Office 365'])\n expect(cards[1].renderRoot.querySelector('[children]'), 'a row with no children shows a children block').to.equal(null)\n /* A child's title takes its own line; its details stand under it. */\n const [title, detail] = Array.from(children[0].querySelectorAll('ox-card-field')) as HTMLElement[]\n const titleBox = title.getBoundingClientRect()\n expect(detail.getBoundingClientRect().top, 'the details stand beside the title').to.be.above(titleBox.top + titleBox.height / 2)\n /* The room between two children is wider than the room between a child's two lines. */\n const between = children[1].getBoundingClientRect().top - children[0].getBoundingClientRect().bottom\n const within = detail.getBoundingClientRect().top - titleBox.bottom\n expect(between, 'the children run together').to.be.at.least(within + 8)\n const headings = Array.from(el.grist.renderRoot.querySelectorAll('[group-heading]')) as HTMLElement[]\n expect(headings.map(one => one.textContent!.trim())).to.deep.equal(['Late money', 'Books'])\n })\n\n it('stand as rows under the parent in the grid, and do not open a group again', async () => {\n const el = await mount('GRID')\n const body = (el.grist.renderRoot.querySelector('ox-grid-body') as any).renderRoot as ShadowRoot\n const whats = (Array.from(body.querySelectorAll('ox-grid-field[role=\"gridcell\"]')) as any[]).filter(one => one.column?.name === 'what').map(one => one.record.what)\n expect(whats).to.deep.equal(['Planned money not seen', 'Azure', 'Office 365', 'Unpaid VAT', 'Lines without an account'])\n /* A child steps in under its parent at its first column, and only there. */\n const cell = (what: string, name: string) =>\n (Array.from(body.querySelectorAll('ox-grid-field[role=\"gridcell\"]')) as any[]).find(one => one.record.what === what && one.column?.name === name)\n const pad = (one: HTMLElement) => parseFloat(getComputedStyle(one).paddingLeft)\n expect(pad(cell('Azure', 'what')), 'a child does not step in').to.be.above(pad(cell('Planned money not seen', 'what')) + 8)\n expect(pad(cell('Azure', 'count'))).to.equal(pad(cell('Planned money not seen', 'count')))\n const headings = Array.from(body.querySelectorAll('[group-heading]')) as HTMLElement[]\n expect(headings.map(one => one.textContent!.trim())).to.deep.equal(['Late money', 'Books'])\n })\n})\n\ndescribe('a page button a renderer returns', () => {\n failOnPageErrors()\n\n for (const mode of ['GRID', 'CARD'] as const) {\n it(`takes the page's quiet look, not the filled gutter button (${mode})`, async () => {\n const acting = {\n ...config([]),\n columns: [\n { type: 'string', name: 'what', header: 'What' },\n { type: 'string', name: 'act', header: '', record: { renderer: () => html`<button quiet small>Open</button>` } }\n ],\n list: { fields: ['what'], details: ['act'] }\n }\n const el = await fixture<DataGrist>(\n html`<ox-grist style=\"display:flex;width:700px;height:400px\" mode=${mode} .config=${acting} .data=${{ records }}></ox-grist>`\n )\n await idle(el)\n const root = (mode == 'GRID' ? (el.grist.renderRoot.querySelector('ox-grid-body') as any).renderRoot : el.grist.renderRoot) as ShadowRoot\n const fields = Array.from(root.querySelectorAll(mode == 'GRID' ? 'ox-grid-field' : 'ox-record-card')) as any[]\n const holder = mode == 'GRID' ? fields.find(one => one.column?.name === 'act') : fields[0].renderRoot.querySelector('[detail] ox-card-field')\n const button = holder.renderRoot.querySelector('button') as HTMLElement\n expect(getComputedStyle(button).backgroundColor, 'a quiet button is filled').to.be.oneOf(['rgba(0, 0, 0, 0)', 'transparent'])\n })\n }\n})\n\ndescribe('an empty text detail on a card', () => {\n failOnPageErrors()\n\n it('takes no place with the default text renderer', async () => {\n const texts = {\n ...config([]),\n columns: [\n { type: 'string', name: 'what', header: 'What' },\n { type: 'string', name: 'summary', header: 'Summary', label: { renderer: () => 'Summary' } }\n ],\n list: { fields: ['what'], details: ['summary'] }\n }\n const el = await fixture<DataGrist>(\n html`<ox-grist style=\"display:flex;width:700px;height:400px\" mode=\"CARD\" .config=${texts} .data=${{ records: [{ id: '1', what: 'one' }, { id: '2', what: 'two', summary: 'said' }] }}></ox-grist>`\n )\n await idle(el)\n const cards = Array.from(el.grist.renderRoot.querySelectorAll('ox-record-card')) as any[]\n const summaryOf = (card: any) => card.renderRoot.querySelector('[detail] ox-card-field') as HTMLElement\n expect(summaryOf(cards[0]).getBoundingClientRect().width, 'an empty summary stands').to.equal(0)\n expect(summaryOf(cards[1]).getBoundingClientRect().width).to.be.above(0)\n })\n})\n\ndescribe('a gutter button with its title', () => {\n failOnPageErrors()\n\n it(\"keeps the gutter's small filled look - the page button look is for a renderer's button\", async () => {\n const acting = {\n ...config([]),\n columns: [\n { type: 'gutter', gutterName: 'button', icon: 'play_arrow', title: 'Start', iconOnly: false, width: 72 },\n { type: 'string', name: 'what', header: 'What' }\n ]\n }\n const el = await fixture<DataGrist>(html`<ox-grist style=\"display:flex;width:700px;height:400px\" mode=\"GRID\" .config=${acting} .data=${{ records }}></ox-grist>`)\n await idle(el)\n const root = (el.grist.renderRoot.querySelector('ox-grid-body') as any).renderRoot as ShadowRoot\n const field = (Array.from(root.querySelectorAll('ox-grid-field')) as any[]).find(one => one.column?.gutterName === 'button')\n const button = field.renderRoot.querySelector('button') as HTMLElement\n const look = getComputedStyle(button)\n expect(look.fontWeight, 'not the page button weight').to.not.equal('600')\n expect(look.fontSize, \"the gutter's 0.8rem\").to.equal(`${0.8 * parseFloat(getComputedStyle(document.documentElement).fontSize)}px`)\n expect(look.borderTopWidth, 'no page button border').to.equal('0px')\n })\n})\n"]}
|