@operato/data-grist 10.29.74 → 10.29.76

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.
Files changed (162) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/src/data-card/record-card.js +1 -1
  3. package/dist/src/data-card/record-card.js.map +1 -1
  4. package/dist/src/data-grid/data-grid-field.js +18 -0
  5. package/dist/src/data-grid/data-grid-field.js.map +1 -1
  6. package/dist/src/data-list/data-list-field.js +4 -1
  7. package/dist/src/data-list/data-list-field.js.map +1 -1
  8. package/dist/src/data-list/record-partial.js +15 -1
  9. package/dist/src/data-list/record-partial.js.map +1 -1
  10. package/dist/src/filters/filter-checkbox.js +1 -1
  11. package/dist/src/filters/filter-checkbox.js.map +1 -1
  12. package/dist/src/filters/filter-input-barcode.js +1 -1
  13. package/dist/src/filters/filter-input-barcode.js.map +1 -1
  14. package/dist/src/filters/filter-input.js +1 -1
  15. package/dist/src/filters/filter-input.js.map +1 -1
  16. package/dist/src/filters/filter-range-date.js +1 -1
  17. package/dist/src/filters/filter-range-date.js.map +1 -1
  18. package/dist/src/filters/filter-range-number.js +1 -1
  19. package/dist/src/filters/filter-range-number.js.map +1 -1
  20. package/dist/src/filters/filter-select-buttons.js +1 -1
  21. package/dist/src/filters/filter-select-buttons.js.map +1 -1
  22. package/dist/src/types.d.ts +1 -1
  23. package/dist/src/types.js.map +1 -1
  24. package/dist/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +9 -9
  26. package/test/cell-button-row-height.test.ts +63 -0
  27. package/test/office-density.test.ts +57 -0
  28. package/dist/test/accessible-name.test.d.ts +0 -2
  29. package/dist/test/accessible-name.test.js +0 -324
  30. package/dist/test/accessible-name.test.js.map +0 -1
  31. package/dist/test/accumulator-labels.test.d.ts +0 -1
  32. package/dist/test/accumulator-labels.test.js +0 -32
  33. package/dist/test/accumulator-labels.test.js.map +0 -1
  34. package/dist/test/address-intents.test.d.ts +0 -1
  35. package/dist/test/address-intents.test.js +0 -201
  36. package/dist/test/address-intents.test.js.map +0 -1
  37. package/dist/test/card-selector.test.d.ts +0 -1
  38. package/dist/test/card-selector.test.js +0 -58
  39. package/dist/test/card-selector.test.js.map +0 -1
  40. package/dist/test/card-thumb.test.d.ts +0 -1
  41. package/dist/test/card-thumb.test.js +0 -44
  42. package/dist/test/card-thumb.test.js.map +0 -1
  43. package/dist/test/card-totals-narrow.test.d.ts +0 -1
  44. package/dist/test/card-totals-narrow.test.js +0 -103
  45. package/dist/test/card-totals-narrow.test.js.map +0 -1
  46. package/dist/test/column-resize.test.d.ts +0 -1
  47. package/dist/test/column-resize.test.js +0 -153
  48. package/dist/test/column-resize.test.js.map +0 -1
  49. package/dist/test/control-heights.test.d.ts +0 -1
  50. package/dist/test/control-heights.test.js +0 -25
  51. package/dist/test/control-heights.test.js.map +0 -1
  52. package/dist/test/count-handler.test.d.ts +0 -1
  53. package/dist/test/count-handler.test.js +0 -56
  54. package/dist/test/count-handler.test.js.map +0 -1
  55. package/dist/test/create-paste-policy.test.d.ts +0 -1
  56. package/dist/test/create-paste-policy.test.js +0 -159
  57. package/dist/test/create-paste-policy.test.js.map +0 -1
  58. package/dist/test/data-integrity.test.d.ts +0 -1
  59. package/dist/test/data-integrity.test.js +0 -145
  60. package/dist/test/data-integrity.test.js.map +0 -1
  61. package/dist/test/destructive-actions.test.d.ts +0 -11
  62. package/dist/test/destructive-actions.test.js +0 -147
  63. package/dist/test/destructive-actions.test.js.map +0 -1
  64. package/dist/test/edit-lifecycle.test.d.ts +0 -2
  65. package/dist/test/edit-lifecycle.test.js +0 -270
  66. package/dist/test/edit-lifecycle.test.js.map +0 -1
  67. package/dist/test/edit-rebase.test.d.ts +0 -1
  68. package/dist/test/edit-rebase.test.js +0 -185
  69. package/dist/test/edit-rebase.test.js.map +0 -1
  70. package/dist/test/editor-commit.test.d.ts +0 -2
  71. package/dist/test/editor-commit.test.js +0 -68
  72. package/dist/test/editor-commit.test.js.map +0 -1
  73. package/dist/test/fetch-failure-state.test.d.ts +0 -1
  74. package/dist/test/fetch-failure-state.test.js +0 -129
  75. package/dist/test/fetch-failure-state.test.js.map +0 -1
  76. package/dist/test/field-contains-content.test.d.ts +0 -1
  77. package/dist/test/field-contains-content.test.js +0 -101
  78. package/dist/test/field-contains-content.test.js.map +0 -1
  79. package/dist/test/field-hint.test.d.ts +0 -2
  80. package/dist/test/field-hint.test.js +0 -54
  81. package/dist/test/field-hint.test.js.map +0 -1
  82. package/dist/test/filter-labels.test.d.ts +0 -2
  83. package/dist/test/filter-labels.test.js +0 -140
  84. package/dist/test/filter-labels.test.js.map +0 -1
  85. package/dist/test/filter-ownership.test.d.ts +0 -1
  86. package/dist/test/filter-ownership.test.js +0 -83
  87. package/dist/test/filter-ownership.test.js.map +0 -1
  88. package/dist/test/filter-select-buttons-count.test.d.ts +0 -1
  89. package/dist/test/filter-select-buttons-count.test.js +0 -35
  90. package/dist/test/filter-select-buttons-count.test.js.map +0 -1
  91. package/dist/test/filter-typing.test.d.ts +0 -2
  92. package/dist/test/filter-typing.test.js +0 -66
  93. package/dist/test/filter-typing.test.js.map +0 -1
  94. package/dist/test/filters-phone-wrap.test.d.ts +0 -1
  95. package/dist/test/filters-phone-wrap.test.js +0 -17
  96. package/dist/test/filters-phone-wrap.test.js.map +0 -1
  97. package/dist/test/first-click-stays.test.d.ts +0 -1
  98. package/dist/test/first-click-stays.test.js +0 -77
  99. package/dist/test/first-click-stays.test.js.map +0 -1
  100. package/dist/test/fixed-column-opaque.test.d.ts +0 -1
  101. package/dist/test/fixed-column-opaque.test.js +0 -134
  102. package/dist/test/fixed-column-opaque.test.js.map +0 -1
  103. package/dist/test/flexible-columns.test.d.ts +0 -1
  104. package/dist/test/flexible-columns.test.js +0 -134
  105. package/dist/test/flexible-columns.test.js.map +0 -1
  106. package/dist/test/grid-single-scroller.test.d.ts +0 -1
  107. package/dist/test/grid-single-scroller.test.js +0 -107
  108. package/dist/test/grid-single-scroller.test.js.map +0 -1
  109. package/dist/test/group-heading.test.d.ts +0 -1
  110. package/dist/test/group-heading.test.js +0 -208
  111. package/dist/test/group-heading.test.js.map +0 -1
  112. package/dist/test/latest-fetch-wins.test.d.ts +0 -1
  113. package/dist/test/latest-fetch-wins.test.js +0 -91
  114. package/dist/test/latest-fetch-wins.test.js.map +0 -1
  115. package/dist/test/list-defaults.test.d.ts +0 -2
  116. package/dist/test/list-defaults.test.js +0 -145
  117. package/dist/test/list-defaults.test.js.map +0 -1
  118. package/dist/test/list-records.test.d.ts +0 -1
  119. package/dist/test/list-records.test.js +0 -46
  120. package/dist/test/list-records.test.js.map +0 -1
  121. package/dist/test/page-errors.d.ts +0 -1
  122. package/dist/test/page-errors.js +0 -44
  123. package/dist/test/page-errors.js.map +0 -1
  124. package/dist/test/paste-integrity.test.d.ts +0 -1
  125. package/dist/test/paste-integrity.test.js +0 -163
  126. package/dist/test/paste-integrity.test.js.map +0 -1
  127. package/dist/test/record-card-height.test.d.ts +0 -1
  128. package/dist/test/record-card-height.test.js +0 -15
  129. package/dist/test/record-card-height.test.js.map +0 -1
  130. package/dist/test/record-view-popup-editor.test.d.ts +0 -1
  131. package/dist/test/record-view-popup-editor.test.js +0 -71
  132. package/dist/test/record-view-popup-editor.test.js.map +0 -1
  133. package/dist/test/renderer-date-calendar-day.test.d.ts +0 -1
  134. package/dist/test/renderer-date-calendar-day.test.js +0 -48
  135. package/dist/test/renderer-date-calendar-day.test.js.map +0 -1
  136. package/dist/test/request-generation.test.d.ts +0 -1
  137. package/dist/test/request-generation.test.js +0 -153
  138. package/dist/test/request-generation.test.js.map +0 -1
  139. package/dist/test/resubmit.test.d.ts +0 -1
  140. package/dist/test/resubmit.test.js +0 -83
  141. package/dist/test/resubmit.test.js.map +0 -1
  142. package/dist/test/row-hover-visible.test.d.ts +0 -1
  143. package/dist/test/row-hover-visible.test.js +0 -139
  144. package/dist/test/row-hover-visible.test.js.map +0 -1
  145. package/dist/test/search-term.test.d.ts +0 -1
  146. package/dist/test/search-term.test.js +0 -108
  147. package/dist/test/search-term.test.js.map +0 -1
  148. package/dist/test/searchable-select.test.d.ts +0 -1
  149. package/dist/test/searchable-select.test.js +0 -65
  150. package/dist/test/searchable-select.test.js.map +0 -1
  151. package/dist/test/select-empty-value.test.d.ts +0 -1
  152. package/dist/test/select-empty-value.test.js +0 -61
  153. package/dist/test/select-empty-value.test.js.map +0 -1
  154. package/dist/test/shift-range-select.test.d.ts +0 -1
  155. package/dist/test/shift-range-select.test.js +0 -100
  156. package/dist/test/shift-range-select.test.js.map +0 -1
  157. package/dist/test/sparkline-renderer.test.d.ts +0 -1
  158. package/dist/test/sparkline-renderer.test.js +0 -36
  159. package/dist/test/sparkline-renderer.test.js.map +0 -1
  160. package/dist/test/wheel-one-scroller.test.d.ts +0 -2
  161. package/dist/test/wheel-one-scroller.test.js +0 -275
  162. package/dist/test/wheel-one-scroller.test.js.map +0 -1
@@ -1,270 +0,0 @@
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 '../src/record-view/record-view.js';
6
- import { RecordDelete } from '../src/handlers/record-delete.js';
7
- import { failOnPageErrors } from './page-errors.js';
8
- /*
9
- * An edit waits while its column's validation runs (a server check, say). What happens to the rows meanwhile decides
10
- * whether it still applies: selecting, refreshing and adding rows keep the row it was typed into, so it applies;
11
- * deleting that row, undo and a reset replace it, so it does not. Typing the shown value again supersedes it. The
12
- * edits here go through the real editors - typed into the input and committed the way leaving the cell commits.
13
- */
14
- const deferred = () => {
15
- let resolve;
16
- const promise = new Promise(done => (resolve = done));
17
- return { promise, resolve };
18
- };
19
- const settle = (ms = 0) => new Promise(resolve => setTimeout(resolve, ms));
20
- /* The title column waits for the validation the test hands it; `other` has none. */
21
- let validating;
22
- const columns = [
23
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
24
- {
25
- type: 'string',
26
- name: 'title',
27
- header: 'title',
28
- record: { editable: true },
29
- validation: () => validating !== null && validating !== void 0 ? validating : true
30
- },
31
- { type: 'string', name: 'other', header: 'other', record: { editable: true } }
32
- ];
33
- const mount = async (mode, records) => {
34
- const el = await fixture(html `<ox-grist
35
- style="height:300px"
36
- .mode=${mode}
37
- .config=${{ columns, rows: { appendable: true, selectable: { multiple: true } }, list: { fields: ['title'] } }}
38
- .data=${{ records }}
39
- ></ox-grist>`);
40
- await idle(el);
41
- return el;
42
- };
43
- const rows = (el) => el.grist.data.records;
44
- /* `updateComplete` resolves false while an update set another one going (a list takes its records in `updated`). */
45
- const idle = async (el) => {
46
- while (!((await el.updateComplete) && (await el.grist.updateComplete)))
47
- ;
48
- };
49
- /* Type into the editor of a field and commit it as leaving the cell does. */
50
- const typeInto = async (editor, text) => {
51
- await editor.updateComplete;
52
- const input = editor.renderRoot.querySelector('input');
53
- input.value = text;
54
- input.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
55
- input.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
56
- editor.flush();
57
- };
58
- /* A grid cell: open its editor the way a double-click does, type, commit, close. */
59
- const typeInGrid = async (el, row, name, text) => {
60
- await idle(el);
61
- const body = el.grist.renderRoot.querySelector('ox-grid-body');
62
- const column = body.columns.filter((column) => !column.hidden).findIndex((column) => column.name === name);
63
- body.startEditTarget(row, column);
64
- await body.updateComplete;
65
- const field = body.renderRoot.querySelector(`#cell-${row}-${column}`);
66
- await field.updateComplete;
67
- await typeInto(field.renderRoot.querySelector('*'), text);
68
- body.resetEdit();
69
- await body.updateComplete;
70
- };
71
- /*
72
- * A list item or card: its record view, as `RecordViewHandler` opens it for that item and hands its changes to the
73
- * item. Built here in place of the popup; it is the item's own child, so its changes reach the list the same way.
74
- */
75
- const typeInItem = async (el, index, name, text) => {
76
- /* Anything may draw the list again before the next edit (a page attached on scroll, a selection). */
77
- el.grist.requestUpdate();
78
- await idle(el);
79
- const items = el.grist.renderRoot.querySelectorAll('ox-record-partial, ox-record-card');
80
- const item = items[index];
81
- const view = document.createElement('ox-record-view');
82
- Object.assign(view, { columns: el.compiledConfig.columns, record: item.record, rowIndex: item.rowIndex });
83
- item.appendChild(view);
84
- await view.updateComplete;
85
- const body = view.renderRoot.querySelector('ox-record-view-body');
86
- await body.updateComplete;
87
- const field = Array.from(body.renderRoot.querySelectorAll('ox-grid-field')).find(one => { var _a; return ((_a = one.column) === null || _a === void 0 ? void 0 : _a.name) === name; });
88
- field.editing = true;
89
- await field.updateComplete;
90
- await typeInto(field.renderRoot.querySelector('*'), text);
91
- view.remove();
92
- };
93
- describe('an edit waiting for validation', () => {
94
- failOnPageErrors();
95
- afterEach(() => {
96
- validating = undefined;
97
- });
98
- it('applies after another field of the row was edited meanwhile', async () => {
99
- const el = await mount('GRID', [{ id: '1', title: 'A', other: 'x' }]);
100
- const pending = deferred();
101
- validating = pending.promise;
102
- await typeInGrid(el, 0, 'title', 'checked');
103
- validating = undefined;
104
- await typeInGrid(el, 0, 'other', 'y');
105
- pending.resolve(true);
106
- await settle();
107
- expect(rows(el)[0]).to.include({ title: 'checked', other: 'y' });
108
- });
109
- it('applies after rows were selected, which rebuilds the rows around the same records', async () => {
110
- const el = await mount('GRID', [
111
- { id: '1', title: 'A' },
112
- { id: '2', title: 'B' }
113
- ]);
114
- const pending = deferred();
115
- validating = pending.promise;
116
- await typeInGrid(el, 0, 'title', 'checked');
117
- const before = rows(el);
118
- el.select(record => record.id === '2');
119
- await idle(el);
120
- expect(rows(el) !== before).to.equal(true);
121
- pending.resolve(true);
122
- await settle();
123
- expect(rows(el)[0].title).to.equal('checked');
124
- expect(rows(el)[1].title).to.equal('B');
125
- });
126
- it('applies to its row after a row was added on top', async () => {
127
- const el = await mount('GRID', [{ id: '1', title: 'A' }]);
128
- const pending = deferred();
129
- validating = pending.promise;
130
- await typeInGrid(el, 0, 'title', 'checked');
131
- el.addRecordToTop({ title: 'top' });
132
- await idle(el);
133
- pending.resolve(true);
134
- await settle();
135
- expect(rows(el).map(record => record.title)).to.eql(['top', 'checked']);
136
- });
137
- it('is superseded by typing the shown value again', async () => {
138
- const el = await mount('GRID', [{ id: '1', title: 'A' }]);
139
- const pending = deferred();
140
- validating = pending.promise;
141
- await typeInGrid(el, 0, 'title', 'mistake');
142
- validating = undefined;
143
- await typeInGrid(el, 0, 'title', 'A');
144
- pending.resolve(true);
145
- await settle();
146
- expect(rows(el)[0].title).to.equal('A');
147
- expect(el.dirtyRecords).to.have.length(0);
148
- });
149
- it('does not apply to a row deleted meanwhile', async () => {
150
- const el = await mount('GRID', [
151
- { id: '1', title: 'A' },
152
- { id: '2', title: 'B' }
153
- ]);
154
- const pending = deferred();
155
- validating = pending.promise;
156
- await typeInGrid(el, 1, 'title', 'checked');
157
- const record = rows(el)[1];
158
- const field = el.grist.renderRoot.querySelector('ox-grid-body').renderRoot.querySelector('#cell-1-1');
159
- RecordDelete(el.compiledConfig.columns, el.grist.data, field.column, record, 1, field);
160
- pending.resolve(true);
161
- await settle();
162
- expect(rows(el).map(record => record.title)).to.eql(['A']);
163
- expect(record.title).to.equal('B');
164
- });
165
- it('does not apply after undo, and an edit after undo does', async () => {
166
- const el = await mount('GRID', [{ id: '1', title: 'A' }]);
167
- /* Snapshots for undo are taken at most once a second, by one timer for every grid on the page. */
168
- await settle(1100);
169
- await typeInGrid(el, 0, 'other', 'first');
170
- const pending = deferred();
171
- validating = pending.promise;
172
- await typeInGrid(el, 0, 'title', 'checked');
173
- el.undo();
174
- await idle(el);
175
- pending.resolve(true);
176
- await settle();
177
- expect(rows(el)[0]).to.include({ title: 'A' });
178
- expect(rows(el)[0].other).to.equal(undefined);
179
- validating = undefined;
180
- await typeInGrid(el, 0, 'title', 'after undo');
181
- expect(rows(el)[0].title).to.equal('after undo');
182
- }).timeout(5000);
183
- it('does not apply after a reset', async () => {
184
- const el = await mount('GRID', [{ id: '1', title: 'A' }]);
185
- const pending = deferred();
186
- validating = pending.promise;
187
- await typeInGrid(el, 1, 'title', 'new row');
188
- el.reset();
189
- await idle(el);
190
- pending.resolve(true);
191
- await settle();
192
- expect(rows(el).map(record => record.title)).to.eql(['A']);
193
- });
194
- });
195
- /* The owner replacing the rows: a new row still being validated was typed into rows that are gone. */
196
- describe('a new row waiting for validation', () => {
197
- failOnPageErrors();
198
- afterEach(() => {
199
- validating = undefined;
200
- });
201
- /* [name, what comes before the edit, the replacement] */
202
- const replacements = [
203
- ['undo', () => { }, el => el.undo()],
204
- ['redo', el => el.undo(), el => el.redo()],
205
- ['a restored draft', () => { }, el => el.restoreUnsavedDraft({ records: [{ id: '1', title: 'draft' }] }, null)]
206
- ];
207
- for (const [name, before, replace] of replacements) {
208
- it(`is not added after ${name}`, async () => {
209
- const el = await mount('GRID', [{ id: '1', title: 'A' }]);
210
- /* Snapshots for undo are taken at most once a second, by one timer for every grid on the page. */
211
- await settle(1100);
212
- await typeInGrid(el, 0, 'other', 'first');
213
- before(el);
214
- await idle(el);
215
- const pending = deferred();
216
- validating = pending.promise;
217
- await typeInGrid(el, 1, 'title', 'new row');
218
- replace(el);
219
- await idle(el);
220
- pending.resolve(true);
221
- await settle();
222
- expect(rows(el)).to.have.length(1);
223
- }).timeout(5000);
224
- }
225
- });
226
- for (const mode of ['GRID', 'LIST', 'CARD']) {
227
- describe(`the append row of a ${mode}`, () => {
228
- failOnPageErrors();
229
- afterEach(() => {
230
- validating = undefined;
231
- });
232
- const type = (el, row, name, text) => mode === 'GRID' ? typeInGrid(el, row, name, text) : typeInItem(el, row, name, text);
233
- it('takes a field still being validated and one typed meanwhile into one new row', async () => {
234
- const el = await mount(mode, [{ id: '1', title: 'A' }]);
235
- const pending = deferred();
236
- validating = pending.promise;
237
- await type(el, 1, 'title', 'new');
238
- validating = undefined;
239
- await type(el, 1, 'other', 'meanwhile');
240
- pending.resolve(true);
241
- await settle();
242
- await idle(el);
243
- expect(rows(el)).to.have.length(2);
244
- expect(rows(el)[1]).to.include({ title: 'new', other: 'meanwhile', __dirty__: '+' });
245
- expect(el.exportPatchList({})).to.eql([{ patchFlag: '+', title: 'new', other: 'meanwhile' }]);
246
- });
247
- it('offers a fresh empty row once its row was added', async () => {
248
- const el = await mount(mode, []);
249
- await type(el, 0, 'title', 'first');
250
- await idle(el);
251
- await type(el, 1, 'title', 'second');
252
- expect(rows(el).map(record => record.title)).to.eql(['first', 'second']);
253
- });
254
- it('is not added again when its new row was deleted while a field waited', async () => {
255
- const el = await mount(mode, []);
256
- const pending = deferred();
257
- validating = pending.promise;
258
- await type(el, 0, 'title', 'waits');
259
- validating = undefined;
260
- await type(el, 0, 'other', 'adds the row');
261
- await idle(el);
262
- /* Resetting a new row removes it (`record-reset` of a row that has no origin). */
263
- el.grist.onRecordChanged(undefined, 0, null);
264
- pending.resolve(true);
265
- await settle();
266
- expect(rows(el)).to.have.length(0);
267
- });
268
- });
269
- }
270
- //# sourceMappingURL=edit-lifecycle.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit-lifecycle.test.js","sourceRoot":"","sources":["../../test/edit-lifecycle.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;AAC7B,OAAO,mCAAmC,CAAA;AAG1C,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAEnD;;;;;GAKG;AAEH,MAAM,QAAQ,GAAG,GAAG,EAAE;IACpB,IAAI,OAAkC,CAAA;IACtC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAU,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAA;IAC9D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AAC7B,CAAC,CAAA;AACD,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,IA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nC,UAAU,GAAG,SAAS,CAAA;YACtB,MAAM,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,cAAc,CAAC,CAAA;YAC1C,MAAM,IAAI,CAAC,EAAE,CAAC,CAAA;YACd,kFAAkF;YAClF,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,SAAgB,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;YACnD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;YACrB,MAAM,MAAM,EAAE,CAAA;YACd,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QACpC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC","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 '../src/record-view/record-view.js'\nimport { DataGrist } from '../src/data-grist.js'\nimport { OxGristEditor } from '../src/editors/ox-grist-editor.js'\nimport { RecordDelete } from '../src/handlers/record-delete.js'\nimport { failOnPageErrors } from './page-errors.js'\n\n/*\n * An edit waits while its column's validation runs (a server check, say). What happens to the rows meanwhile decides\n * whether it still applies: selecting, refreshing and adding rows keep the row it was typed into, so it applies;\n * deleting that row, undo and a reset replace it, so it does not. Typing the shown value again supersedes it. The\n * edits here go through the real editors - typed into the input and committed the way leaving the cell commits.\n */\n\nconst deferred = () => {\n let resolve!: (value: boolean) => void\n const promise = new Promise<boolean>(done => (resolve = done))\n return { promise, resolve }\n}\nconst settle = (ms = 0) => new Promise(resolve => setTimeout(resolve, ms))\n\n/* The title column waits for the validation the test hands it; `other` has none. */\nlet validating: Promise<boolean> | undefined\nconst columns = [\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'title',\n header: 'title',\n record: { editable: true },\n validation: () => validating ?? true\n },\n { type: 'string', name: 'other', header: 'other', record: { editable: true } }\n]\n\nconst mount = async (mode: 'GRID' | 'LIST' | 'CARD', records: any[]) => {\n const el = await fixture<DataGrist>(html`<ox-grist\n style=\"height:300px\"\n .mode=${mode}\n .config=${{ columns, rows: { appendable: true, selectable: { multiple: true } }, list: { fields: ['title'] } }}\n .data=${{ records }}\n ></ox-grist>`)\n await idle(el)\n return el\n}\n\nconst rows = (el: DataGrist) => el.grist.data.records\n\n/* `updateComplete` resolves false while an update set another one going (a list takes its records in `updated`). */\nconst idle = async (el: DataGrist) => {\n while (!((await el.updateComplete) && (await el.grist.updateComplete)));\n}\n\n/* Type into the editor of a field and commit it as leaving the cell does. */\nconst typeInto = async (editor: OxGristEditor, text: string) => {\n await editor.updateComplete\n const input = editor.renderRoot.querySelector('input') as HTMLInputElement\n input.value = text\n input.dispatchEvent(new Event('input', { bubbles: true, composed: true }))\n input.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n editor.flush()\n}\n\n/* A grid cell: open its editor the way a double-click does, type, commit, close. */\nconst typeInGrid = async (el: DataGrist, row: number, name: string, text: string) => {\n await idle(el)\n const body = el.grist.renderRoot.querySelector('ox-grid-body') as any\n const column = body.columns.filter((column: any) => !column.hidden).findIndex((column: any) => column.name === name)\n body.startEditTarget(row, column)\n await body.updateComplete\n const field = body.renderRoot.querySelector(`#cell-${row}-${column}`) as any\n await field.updateComplete\n await typeInto(field.renderRoot.querySelector('*') as OxGristEditor, text)\n body.resetEdit()\n await body.updateComplete\n}\n\n/*\n * A list item or card: its record view, as `RecordViewHandler` opens it for that item and hands its changes to the\n * item. Built here in place of the popup; it is the item's own child, so its changes reach the list the same way.\n */\nconst typeInItem = async (el: DataGrist, index: number, name: string, text: string) => {\n /* Anything may draw the list again before the next edit (a page attached on scroll, a selection). */\n el.grist.requestUpdate()\n await idle(el)\n const items = el.grist.renderRoot.querySelectorAll('ox-record-partial, ox-record-card')\n const item = items[index] as any\n const view = document.createElement('ox-record-view') as any\n Object.assign(view, { columns: el.compiledConfig.columns, record: item.record, rowIndex: item.rowIndex })\n item.appendChild(view)\n await view.updateComplete\n const body = view.renderRoot.querySelector('ox-record-view-body') as any\n await body.updateComplete\n const field = Array.from(body.renderRoot.querySelectorAll('ox-grid-field') as NodeListOf<any>).find(\n one => one.column?.name === name\n )\n field.editing = true\n await field.updateComplete\n await typeInto(field.renderRoot.querySelector('*') as OxGristEditor, text)\n view.remove()\n}\n\ndescribe('an edit waiting for validation', () => {\n failOnPageErrors()\n\n afterEach(() => {\n validating = undefined\n })\n\n it('applies after another field of the row was edited meanwhile', async () => {\n const el = await mount('GRID', [{ id: '1', title: 'A', other: 'x' }])\n const pending = deferred()\n validating = pending.promise\n await typeInGrid(el, 0, 'title', 'checked')\n validating = undefined\n await typeInGrid(el, 0, 'other', 'y')\n pending.resolve(true)\n await settle()\n expect(rows(el)[0]).to.include({ title: 'checked', other: 'y' })\n })\n\n it('applies after rows were selected, which rebuilds the rows around the same records', async () => {\n const el = await mount('GRID', [\n { id: '1', title: 'A' },\n { id: '2', title: 'B' }\n ])\n const pending = deferred()\n validating = pending.promise\n await typeInGrid(el, 0, 'title', 'checked')\n const before = rows(el)\n el.select(record => record.id === '2')\n await idle(el)\n expect(rows(el) !== before).to.equal(true)\n pending.resolve(true)\n await settle()\n expect(rows(el)[0].title).to.equal('checked')\n expect(rows(el)[1].title).to.equal('B')\n })\n\n it('applies to its row after a row was added on top', async () => {\n const el = await mount('GRID', [{ id: '1', title: 'A' }])\n const pending = deferred()\n validating = pending.promise\n await typeInGrid(el, 0, 'title', 'checked')\n el.addRecordToTop({ title: 'top' })\n await idle(el)\n pending.resolve(true)\n await settle()\n expect(rows(el).map(record => record.title)).to.eql(['top', 'checked'])\n })\n\n it('is superseded by typing the shown value again', async () => {\n const el = await mount('GRID', [{ id: '1', title: 'A' }])\n const pending = deferred()\n validating = pending.promise\n await typeInGrid(el, 0, 'title', 'mistake')\n validating = undefined\n await typeInGrid(el, 0, 'title', 'A')\n pending.resolve(true)\n await settle()\n expect(rows(el)[0].title).to.equal('A')\n expect(el.dirtyRecords).to.have.length(0)\n })\n\n it('does not apply to a row deleted meanwhile', async () => {\n const el = await mount('GRID', [\n { id: '1', title: 'A' },\n { id: '2', title: 'B' }\n ])\n const pending = deferred()\n validating = pending.promise\n await typeInGrid(el, 1, 'title', 'checked')\n const record = rows(el)[1]\n const field = (el.grist.renderRoot.querySelector('ox-grid-body') as any).renderRoot.querySelector('#cell-1-1')\n RecordDelete(el.compiledConfig.columns, el.grist.data, field.column, record, 1, field)\n pending.resolve(true)\n await settle()\n expect(rows(el).map(record => record.title)).to.eql(['A'])\n expect(record.title).to.equal('B')\n })\n\n it('does not apply after undo, and an edit after undo does', async () => {\n const el = await mount('GRID', [{ id: '1', title: 'A' }])\n /* Snapshots for undo are taken at most once a second, by one timer for every grid on the page. */\n await settle(1100)\n await typeInGrid(el, 0, 'other', 'first')\n const pending = deferred()\n validating = pending.promise\n await typeInGrid(el, 0, 'title', 'checked')\n el.undo()\n await idle(el)\n pending.resolve(true)\n await settle()\n expect(rows(el)[0]).to.include({ title: 'A' })\n expect(rows(el)[0].other).to.equal(undefined)\n validating = undefined\n await typeInGrid(el, 0, 'title', 'after undo')\n expect(rows(el)[0].title).to.equal('after undo')\n }).timeout(5000)\n\n it('does not apply after a reset', async () => {\n const el = await mount('GRID', [{ id: '1', title: 'A' }])\n const pending = deferred()\n validating = pending.promise\n await typeInGrid(el, 1, 'title', 'new row')\n el.reset()\n await idle(el)\n pending.resolve(true)\n await settle()\n expect(rows(el).map(record => record.title)).to.eql(['A'])\n })\n})\n\n/* The owner replacing the rows: a new row still being validated was typed into rows that are gone. */\ndescribe('a new row waiting for validation', () => {\n failOnPageErrors()\n\n afterEach(() => {\n validating = undefined\n })\n\n /* [name, what comes before the edit, the replacement] */\n const replacements: [string, (el: DataGrist) => void, (el: DataGrist) => void][] = [\n ['undo', () => {}, el => el.undo()],\n ['redo', el => el.undo(), el => el.redo()],\n ['a restored draft', () => {}, el => el.restoreUnsavedDraft({ records: [{ id: '1', title: 'draft' }] }, null)]\n ]\n\n for (const [name, before, replace] of replacements) {\n it(`is not added after ${name}`, async () => {\n const el = await mount('GRID', [{ id: '1', title: 'A' }])\n /* Snapshots for undo are taken at most once a second, by one timer for every grid on the page. */\n await settle(1100)\n await typeInGrid(el, 0, 'other', 'first')\n before(el)\n await idle(el)\n const pending = deferred()\n validating = pending.promise\n await typeInGrid(el, 1, 'title', 'new row')\n replace(el)\n await idle(el)\n pending.resolve(true)\n await settle()\n expect(rows(el)).to.have.length(1)\n }).timeout(5000)\n }\n})\n\nfor (const mode of ['GRID', 'LIST', 'CARD'] as const) {\n describe(`the append row of a ${mode}`, () => {\n failOnPageErrors()\n\n afterEach(() => {\n validating = undefined\n })\n\n const type = (el: DataGrist, row: number, name: string, text: string) =>\n mode === 'GRID' ? typeInGrid(el, row, name, text) : typeInItem(el, row, name, text)\n\n it('takes a field still being validated and one typed meanwhile into one new row', async () => {\n const el = await mount(mode, [{ id: '1', title: 'A' }])\n const pending = deferred()\n validating = pending.promise\n await type(el, 1, 'title', 'new')\n validating = undefined\n await type(el, 1, 'other', 'meanwhile')\n pending.resolve(true)\n await settle()\n await idle(el)\n expect(rows(el)).to.have.length(2)\n expect(rows(el)[1]).to.include({ title: 'new', other: 'meanwhile', __dirty__: '+' })\n expect(el.exportPatchList({})).to.eql([{ patchFlag: '+', title: 'new', other: 'meanwhile' }])\n })\n\n it('offers a fresh empty row once its row was added', async () => {\n const el = await mount(mode, [])\n await type(el, 0, 'title', 'first')\n await idle(el)\n await type(el, 1, 'title', 'second')\n expect(rows(el).map(record => record.title)).to.eql(['first', 'second'])\n })\n\n it('is not added again when its new row was deleted while a field waited', async () => {\n const el = await mount(mode, [])\n const pending = deferred()\n validating = pending.promise\n await type(el, 0, 'title', 'waits')\n validating = undefined\n await type(el, 0, 'other', 'adds the row')\n await idle(el)\n /* Resetting a new row removes it (`record-reset` of a row that has no origin). */\n el.grist.onRecordChanged(undefined as any, 0, null)\n pending.resolve(true)\n await settle()\n expect(rows(el)).to.have.length(0)\n })\n })\n}\n"]}
@@ -1 +0,0 @@
1
- import '../src/data-grist.js';
@@ -1,185 +0,0 @@
1
- import { expect, fixture } from '@open-wc/testing';
2
- import { html } from 'lit';
3
- import '../src/data-grist.js';
4
- import { editsOf, editsSince, layEdits, mergeHeld, settleSent } from '../src/edit-rebase.js';
5
- const edited = (id, before, after) => ({
6
- id,
7
- ...before,
8
- ...after,
9
- __dirty__: 'M',
10
- __dirtyfields__: Object.fromEntries(Object.keys(after).map(name => [name, { before: before[name], after: after[name] }]))
11
- });
12
- describe('edits kept across a read (edit-rebase)', () => {
13
- it('keeps what was edited after a save was sent, and nothing that was sent', () => {
14
- const a = edited('a', { amount: 1 }, { amount: 2 });
15
- const sent = editsOf([a]);
16
- /* While the save is out: A changed again in another field, B edited, a new row typed. */
17
- a.memo = 'later';
18
- a.__dirtyfields__.memo = { before: undefined, after: 'later' };
19
- const b = edited('b', { amount: 5 }, { amount: 6 });
20
- const added = { title: 'new', __dirty__: '+' };
21
- const { edits, lost } = editsSince(editsOf([a, b, added]), sent);
22
- expect(lost).to.eql([]);
23
- expect(edits.map(one => [one.id, one.flag, one.values])).to.eql([
24
- ['a', 'M', { memo: 'later' }],
25
- ['b', 'M', { amount: 6 }],
26
- [undefined, '+', { title: 'new' }]
27
- ]);
28
- });
29
- it('drops a row whose sent edit was not touched again', () => {
30
- const a = edited('a', { amount: 1 }, { amount: 2 });
31
- expect(editsSince(editsOf([a]), editsOf([a])).edits).to.eql([]);
32
- });
33
- it('turns later edits of a saved new row into edits of the row the save made', () => {
34
- const added = { title: 'new', __dirty__: '+' };
35
- const sent = editsOf([added]);
36
- added.amount = 9;
37
- const { edits } = editsSince(editsOf([added]), sent, new Map([[added, 'n1']]));
38
- expect(edits).to.eql([{ id: 'n1', flag: 'M', values: { amount: 9 } }]);
39
- });
40
- it('says a saved new row it cannot find again instead of adding it twice', () => {
41
- const added = { title: 'new', __dirty__: '+' };
42
- const sent = editsOf([added]);
43
- added.amount = 9;
44
- const { edits, lost } = editsSince(editsOf([added]), sent);
45
- expect(edits).to.eql([]);
46
- expect(lost.map(one => one.values)).to.eql([{ amount: 9 }]);
47
- });
48
- it('lays edits on the rows read and returns the ones whose row is gone', () => {
49
- const records = [{ id: 'a', amount: 2 }];
50
- const unplaced = layEdits(records, [
51
- { id: 'a', flag: 'M', values: { memo: 'later' } },
52
- { id: 'gone', flag: 'M', values: { amount: 1 } },
53
- { flag: '+', values: { title: 'new' } }
54
- ]);
55
- expect(records).to.eql([
56
- { id: 'a', amount: 2, memo: 'later', __dirty__: 'M' },
57
- { title: 'new', __dirty__: '+' }
58
- ]);
59
- expect(unplaced.map(one => one.id)).to.eql(['gone']);
60
- });
61
- it('a grid read after a slow save keeps the edits typed meanwhile as edits', async () => {
62
- const server = [
63
- { id: 'a', amount: 1 },
64
- { id: 'b', amount: 5 }
65
- ];
66
- const grist = await fixture(html `<ox-grist
67
- style="display:block;width:600px;height:300px"
68
- .config=${{ columns: [{ name: 'amount', header: 'amount', type: 'number', record: { editable: true } }], pagination: { limit: 20 } }}
69
- .fetchHandler=${async () => ({ records: server.map(one => ({ ...one })), total: server.length })}
70
- ></ox-grist>`);
71
- await grist.fetch();
72
- await grist.updateComplete;
73
- const rows = () => grist.dirtyData.records;
74
- const set = (id, amount) => {
75
- const record = rows().find(one => one.id === id);
76
- record.amount = amount;
77
- record.__dirty__ = 'M';
78
- grist.checkDirties();
79
- };
80
- set('a', 2);
81
- const sent = editsOf(grist.dirtyRecords);
82
- set('b', 6); // typed while the save of A is out
83
- server[0].amount = 2; // the save of A lands
84
- const { edits } = editsSince(editsOf(grist.dirtyRecords), sent);
85
- await grist.fetchKeepingEdits(edits);
86
- expect(grist.dirtyRecords.map(one => [one.id, one.amount])).to.eql([['b', 6]]);
87
- expect(rows().find(one => one.id === 'a').amount).to.equal(2);
88
- expect(rows().find(one => one.id === 'a').__dirty__).to.equal(undefined);
89
- });
90
- });
91
- describe('edits kept across a read and the browser draft (ADR-0098)', () => {
92
- it('settles the draft of the edits before the save, and keeps the ones laid back', async () => {
93
- const actions = [];
94
- const grist = await fixture(html `<ox-grist
95
- style="display:block;width:600px;height:300px"
96
- .urlParamsSensitive=${true}
97
- .config=${{ columns: [{ name: 'amount', header: 'amount', type: 'number', record: { editable: true } }], pagination: { limit: 20 } }}
98
- .fetchHandler=${async () => ({ records: [{ id: 'a', amount: 2 }, { id: 'b', amount: 5 }], total: 2 })}
99
- @list-draft=${(event) => actions.push(event.detail.action)}
100
- ></ox-grist>`);
101
- await grist.fetch();
102
- await grist.updateComplete;
103
- actions.length = 0;
104
- await grist.fetchKeepingEdits([{ id: 'b', flag: 'M', values: { amount: 6 } }]);
105
- await grist.updateComplete;
106
- expect(actions[0]).to.equal('discard');
107
- expect(actions.indexOf('loaded')).to.be.greaterThan(0);
108
- expect(actions.lastIndexOf('edit')).to.be.greaterThan(actions.indexOf('loaded'));
109
- });
110
- });
111
- describe('a read that fails after a save', () => {
112
- it('leaves the edits on the screen, keeps them in the browser again and says the failure', async () => {
113
- const actions = [];
114
- let fail = false;
115
- const grist = await fixture(html `<ox-grist
116
- style="display:block;width:600px;height:300px"
117
- .urlParamsSensitive=${true}
118
- .config=${{ columns: [{ name: 'amount', header: 'amount', type: 'number', record: { editable: true } }], pagination: { limit: 20 } }}
119
- .fetchHandler=${async () => {
120
- if (fail)
121
- throw new Error('offline');
122
- return { records: [{ id: 'a', amount: 2 }], total: 1 };
123
- }}
124
- @list-draft=${(event) => actions.push(event.detail.action)}
125
- ></ox-grist>`);
126
- await grist.fetch();
127
- await grist.updateComplete;
128
- const record = grist.dirtyData.records[0];
129
- record.amount = 7;
130
- record.__dirty__ = 'M';
131
- grist.checkDirties();
132
- actions.length = 0;
133
- fail = true;
134
- let said;
135
- await grist.fetchKeepingEdits(editsOf(grist.dirtyRecords)).catch(error => (said = error));
136
- expect(String(said)).to.contain('offline');
137
- expect(grist.dirtyRecords.map(one => [one.id, one.amount])).to.eql([['a', 7]]);
138
- expect(actions[0]).to.equal('discard');
139
- expect(actions[actions.length - 1]).to.equal('edit');
140
- });
141
- });
142
- describe('a save that landed when the list cannot be read again (settleSent)', () => {
143
- it('marks what was sent as saved, keeps what was typed after it, and gives a saved new row its id', async () => {
144
- const grist = await fixture(html `<ox-grist
145
- style="display:block;width:600px;height:300px"
146
- .config=${{ columns: [{ name: 'amount', header: 'amount', type: 'number', record: { editable: true } }, { name: 'memo', header: 'memo', record: { editable: true } }], pagination: { limit: 20 } }}
147
- .fetchHandler=${async () => ({ records: [{ id: 'a', amount: 1, memo: '' }], total: 1 })}
148
- ></ox-grist>`);
149
- await grist.fetch();
150
- await grist.updateComplete;
151
- const [a] = grist.dirtyData.records;
152
- a.amount = 2;
153
- a.__dirty__ = 'M';
154
- const added = { amount: 9, __dirty__: '+' };
155
- grist.dirtyData.records.push(added);
156
- grist.checkDirties();
157
- const sent = editsOf(grist.dirtyRecords);
158
- a.memo = 'later'; // typed while the save was out
159
- grist.checkDirties();
160
- settleSent(sent, new Map([[added, 'n1']]));
161
- grist.checkDirties();
162
- expect(grist.dirtyRecords.map(one => { var _a; return [one.id, Object.keys((_a = one.__dirtyfields__) !== null && _a !== void 0 ? _a : {})]; })).to.eql([['a', ['memo']]]);
163
- expect(added.id).to.equal('n1');
164
- });
165
- });
166
- describe('held entries joined with the edits made since (mergeHeld)', () => {
167
- it('never lays an older held value over a newer input; the held value stays held', () => {
168
- const current = [{ id: 'a', flag: 'M', values: { memo: 'newer input' } }];
169
- const held = [
170
- { id: 'a', flag: 'M', values: { memo: 'older held input', amount: 5 } },
171
- { id: 'b', flag: 'M', values: { memo: 'only held' } }
172
- ];
173
- const { edits, kept } = mergeHeld(current, held);
174
- const records = [{ id: 'a', memo: '', amount: 1 }, { id: 'b', memo: '' }];
175
- expect(layEdits(records, edits)).to.eql([]);
176
- expect(records.map(one => [one.id, one.memo, one.amount])).to.eql([['a', 'newer input', 5], ['b', 'only held', undefined]]);
177
- expect(kept).to.eql([{ id: 'a', flag: 'M', values: { memo: 'older held input' } }]);
178
- expect(current[0].values).to.eql({ memo: 'newer input' }, 'the edits passed in are not changed');
179
- });
180
- it('takes a held value equal to the current one as the same entry', () => {
181
- const { kept } = mergeHeld([{ id: 'a', flag: 'M', values: { memo: 'x' } }], [{ id: 'a', flag: 'M', values: { memo: 'x' } }]);
182
- expect(kept).to.eql([]);
183
- });
184
- });
185
- //# sourceMappingURL=edit-rebase.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edit-rebase.test.js","sourceRoot":"","sources":["../../test/edit-rebase.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAG5F,MAAM,MAAM,GAAG,CAAC,EAAU,EAAE,MAA2B,EAAE,KAA0B,EAAe,EAAE,CAAC,CAAC;IACpG,EAAE;IACF,GAAG,MAAM;IACT,GAAG,KAAK;IACR,SAAS,EAAE,GAAG;IACd,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;CAC1H,CAAC,CAAA;AAEF,QAAQ,CAAC,wCAAwC,EAAE,GAAG,EAAE;IACtD,EAAE,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAChF,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,CAA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,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;QAC3H,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC,CAAA;QACnF,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,qCAAqC,CAAC,CAAA;IAClG,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACvE,MAAM,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAA;QAC5H,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACzB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { expect, fixture } from '@open-wc/testing'\nimport { html } from 'lit'\n\nimport '../src/data-grist.js'\nimport { DataGrist } from '../src/data-grist.js'\nimport { editsOf, editsSince, layEdits, mergeHeld, settleSent } from '../src/edit-rebase.js'\nimport { GristRecord } from '../src/types.js'\n\nconst edited = (id: string, before: Record<string, any>, after: Record<string, any>): GristRecord => ({\n id,\n ...before,\n ...after,\n __dirty__: 'M',\n __dirtyfields__: Object.fromEntries(Object.keys(after).map(name => [name, { before: before[name], after: after[name] }]))\n})\n\ndescribe('edits kept across a read (edit-rebase)', () => {\n it('keeps what was edited after a save was sent, and nothing that was sent', () => {\n const a = edited('a', { amount: 1 }, { amount: 2 })\n const sent = editsOf([a])\n /* While the save is out: A changed again in another field, B edited, a new row typed. */\n a.memo = 'later'\n a.__dirtyfields__!.memo = { before: undefined, after: 'later' }\n const b = edited('b', { amount: 5 }, { amount: 6 })\n const added: GristRecord = { title: 'new', __dirty__: '+' }\n\n const { edits, lost } = editsSince(editsOf([a, b, added]), sent)\n\n expect(lost).to.eql([])\n expect(edits.map(one => [one.id, one.flag, one.values])).to.eql([\n ['a', 'M', { memo: 'later' }],\n ['b', 'M', { amount: 6 }],\n [undefined, '+', { title: 'new' }]\n ])\n })\n\n it('drops a row whose sent edit was not touched again', () => {\n const a = edited('a', { amount: 1 }, { amount: 2 })\n expect(editsSince(editsOf([a]), editsOf([a])).edits).to.eql([])\n })\n\n it('turns later edits of a saved new row into edits of the row the save made', () => {\n const added: GristRecord = { title: 'new', __dirty__: '+' }\n const sent = editsOf([added])\n added.amount = 9\n\n const { edits } = editsSince(editsOf([added]), sent, new Map([[added, 'n1']]))\n expect(edits).to.eql([{ id: 'n1', flag: 'M', values: { amount: 9 } }])\n })\n\n it('says a saved new row it cannot find again instead of adding it twice', () => {\n const added: GristRecord = { title: 'new', __dirty__: '+' }\n const sent = editsOf([added])\n added.amount = 9\n\n const { edits, lost } = editsSince(editsOf([added]), sent)\n expect(edits).to.eql([])\n expect(lost.map(one => one.values)).to.eql([{ amount: 9 }])\n })\n\n it('lays edits on the rows read and returns the ones whose row is gone', () => {\n const records: GristRecord[] = [{ id: 'a', amount: 2 }]\n const unplaced = layEdits(records, [\n { id: 'a', flag: 'M', values: { memo: 'later' } },\n { id: 'gone', flag: 'M', values: { amount: 1 } },\n { flag: '+', values: { title: 'new' } }\n ])\n expect(records).to.eql([\n { id: 'a', amount: 2, memo: 'later', __dirty__: 'M' },\n { title: 'new', __dirty__: '+' }\n ])\n expect(unplaced.map(one => one.id)).to.eql(['gone'])\n })\n\n it('a grid read after a slow save keeps the edits typed meanwhile as edits', async () => {\n const server = [\n { id: 'a', amount: 1 },\n { id: 'b', amount: 5 }\n ]\n const grist = await fixture<DataGrist>(\n html`<ox-grist\n style=\"display:block;width:600px;height:300px\"\n .config=${{ columns: [{ name: 'amount', header: 'amount', type: 'number', record: { editable: true } }], pagination: { limit: 20 } }}\n .fetchHandler=${async () => ({ records: server.map(one => ({ ...one })), total: server.length })}\n ></ox-grist>`\n )\n await grist.fetch()\n await grist.updateComplete\n\n const rows = () => grist.dirtyData.records as GristRecord[]\n const set = (id: string, amount: number) => {\n const record = rows().find(one => one.id === id)!\n record.amount = amount\n record.__dirty__ = 'M'\n grist.checkDirties()\n }\n\n set('a', 2)\n const sent = editsOf(grist.dirtyRecords)\n set('b', 6) // typed while the save of A is out\n server[0].amount = 2 // the save of A lands\n\n const { edits } = editsSince(editsOf(grist.dirtyRecords), sent)\n await grist.fetchKeepingEdits(edits)\n\n expect(grist.dirtyRecords.map(one => [one.id, one.amount])).to.eql([['b', 6]])\n expect(rows().find(one => one.id === 'a')!.amount).to.equal(2)\n expect(rows().find(one => one.id === 'a')!.__dirty__).to.equal(undefined)\n })\n})\n\ndescribe('edits kept across a read and the browser draft (ADR-0098)', () => {\n it('settles the draft of the edits before the save, and keeps the ones laid back', async () => {\n const actions: string[] = []\n const grist = await fixture<DataGrist>(\n html`<ox-grist\n style=\"display:block;width:600px;height:300px\"\n .urlParamsSensitive=${true}\n .config=${{ columns: [{ name: 'amount', header: 'amount', type: 'number', record: { editable: true } }], pagination: { limit: 20 } }}\n .fetchHandler=${async () => ({ records: [{ id: 'a', amount: 2 }, { id: 'b', amount: 5 }], total: 2 })}\n @list-draft=${(event: CustomEvent) => actions.push(event.detail.action)}\n ></ox-grist>`\n )\n await grist.fetch()\n await grist.updateComplete\n actions.length = 0\n\n await grist.fetchKeepingEdits([{ id: 'b', flag: 'M', values: { amount: 6 } }])\n await grist.updateComplete\n\n expect(actions[0]).to.equal('discard')\n expect(actions.indexOf('loaded')).to.be.greaterThan(0)\n expect(actions.lastIndexOf('edit')).to.be.greaterThan(actions.indexOf('loaded'))\n })\n})\n\ndescribe('a read that fails after a save', () => {\n it('leaves the edits on the screen, keeps them in the browser again and says the failure', async () => {\n const actions: string[] = []\n let fail = false\n const grist = await fixture<DataGrist>(\n html`<ox-grist\n style=\"display:block;width:600px;height:300px\"\n .urlParamsSensitive=${true}\n .config=${{ columns: [{ name: 'amount', header: 'amount', type: 'number', record: { editable: true } }], pagination: { limit: 20 } }}\n .fetchHandler=${async () => {\n if (fail) throw new Error('offline')\n return { records: [{ id: 'a', amount: 2 }], total: 1 }\n }}\n @list-draft=${(event: CustomEvent) => actions.push(event.detail.action)}\n ></ox-grist>`\n )\n await grist.fetch()\n await grist.updateComplete\n const record = (grist.dirtyData.records as GristRecord[])[0]\n record.amount = 7\n record.__dirty__ = 'M'\n grist.checkDirties()\n actions.length = 0\n fail = true\n\n let said: unknown\n await grist.fetchKeepingEdits(editsOf(grist.dirtyRecords)).catch(error => (said = error))\n\n expect(String(said)).to.contain('offline')\n expect(grist.dirtyRecords.map(one => [one.id, one.amount])).to.eql([['a', 7]])\n expect(actions[0]).to.equal('discard')\n expect(actions[actions.length - 1]).to.equal('edit')\n })\n})\n\ndescribe('a save that landed when the list cannot be read again (settleSent)', () => {\n it('marks what was sent as saved, keeps what was typed after it, and gives a saved new row its id', async () => {\n const grist = await fixture<DataGrist>(\n html`<ox-grist\n style=\"display:block;width:600px;height:300px\"\n .config=${{ columns: [{ name: 'amount', header: 'amount', type: 'number', record: { editable: true } }, { name: 'memo', header: 'memo', record: { editable: true } }], pagination: { limit: 20 } }}\n .fetchHandler=${async () => ({ records: [{ id: 'a', amount: 1, memo: '' }], total: 1 })}\n ></ox-grist>`\n )\n await grist.fetch()\n await grist.updateComplete\n const [a] = grist.dirtyData.records as GristRecord[]\n a.amount = 2\n a.__dirty__ = 'M'\n const added = { amount: 9, __dirty__: '+' } as GristRecord\n ;(grist.dirtyData.records as GristRecord[]).push(added)\n grist.checkDirties()\n const sent = editsOf(grist.dirtyRecords)\n a.memo = 'later' // typed while the save was out\n grist.checkDirties()\n\n settleSent(sent, new Map([[added, 'n1']]))\n grist.checkDirties()\n\n expect(grist.dirtyRecords.map(one => [one.id, Object.keys(one.__dirtyfields__ ?? {})])).to.eql([['a', ['memo']]])\n expect(added.id).to.equal('n1')\n })\n})\n\ndescribe('held entries joined with the edits made since (mergeHeld)', () => {\n it('never lays an older held value over a newer input; the held value stays held', () => {\n const current = [{ id: 'a', flag: 'M' as const, values: { memo: 'newer input' } }]\n const held = [\n { id: 'a', flag: 'M' as const, values: { memo: 'older held input', amount: 5 } },\n { id: 'b', flag: 'M' as const, values: { memo: 'only held' } }\n ]\n const { edits, kept } = mergeHeld(current, held)\n const records: GristRecord[] = [{ id: 'a', memo: '', amount: 1 }, { id: 'b', memo: '' }]\n expect(layEdits(records, edits)).to.eql([])\n expect(records.map(one => [one.id, one.memo, one.amount])).to.eql([['a', 'newer input', 5], ['b', 'only held', undefined]])\n expect(kept).to.eql([{ id: 'a', flag: 'M', values: { memo: 'older held input' } }])\n expect(current[0].values).to.eql({ memo: 'newer input' }, 'the edits passed in are not changed')\n })\n\n it('takes a held value equal to the current one as the same entry', () => {\n const { kept } = mergeHeld([{ id: 'a', flag: 'M', values: { memo: 'x' } }], [{ id: 'a', flag: 'M', values: { memo: 'x' } }])\n expect(kept).to.eql([])\n })\n})\n"]}
@@ -1,2 +0,0 @@
1
- import '../src/editors/ox-grist-editor-select.js';
2
- import '../src/editors/ox-grist-editor-text.js';
@@ -1,68 +0,0 @@
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/editors/ox-grist-editor-select.js';
5
- import '../src/editors/ox-grist-editor-text.js';
6
- import { buildColumn } from '../src/configure/column-builder.js';
7
- import { OxGristEditor } from '../src/editors/ox-grist-editor.js';
8
- /*
9
- * An editor commits, on blur or flush, only a value the user entered into its control since it opened. Leaving a
10
- * page flushes every mounted editor: a popup editor's <div> was read as `undefined` and cleared its cell, and an
11
- * untouched select re-parsed '1' for 1 (or took its first option) and marked the row changed (2026-10-19).
12
- */
13
- /* A popup editor as most of them are: the cell shows the value in a <div>, the popup's confirmation commits. */
14
- class ProbeDivEditor extends OxGristEditor {
15
- get editorTemplate() {
16
- return html `<div tabindex="0">${this.value}</div>`;
17
- }
18
- }
19
- customElements.define('probe-div-editor', ProbeDivEditor);
20
- const mount = async (tag, column, record) => {
21
- const editor = (await fixture(html `${Object.assign(document.createElement(tag), { column: buildColumn(column), record, row: 0 })}`));
22
- await editor.updateComplete;
23
- const changes = [];
24
- editor.addEventListener('field-change', event => changes.push(event.detail));
25
- return { editor, changes };
26
- };
27
- describe('what an editor commits', () => {
28
- it('a popup editor nobody typed into commits nothing on flush', async () => {
29
- const { editor, changes } = await mount('probe-div-editor', { type: 'string', name: 'crontab', record: { editable: true } }, { crontab: '0 * * * *' });
30
- editor.flush();
31
- expect(changes.length).to.equal(0);
32
- });
33
- it('an untouched select with number values commits nothing on flush', async () => {
34
- const { editor, changes } = await mount('ox-grist-editor-select', { type: 'select', name: 'grade', record: { editable: true, options: [{ display: 'one', value: 1 }, { display: 'two', value: 2 }] } }, { grade: 1 });
35
- editor.flush();
36
- expect(changes.length).to.equal(0);
37
- });
38
- it('an untouched select whose value is not among its options commits nothing on flush', async () => {
39
- const { editor, changes } = await mount('ox-grist-editor-select', { type: 'select', name: 'grade', record: { editable: true, options: ['a', 'b'] } }, { grade: 'retired' });
40
- editor.flush();
41
- expect(changes.length).to.equal(0);
42
- });
43
- it('leaving an untouched select commits nothing', async () => {
44
- const { editor, changes } = await mount('ox-grist-editor-select', { type: 'select', name: 'grade', record: { editable: true, options: [{ display: 'one', value: 1 }, { display: 'two', value: 2 }] } }, { grade: 1 });
45
- editor._onfocusout();
46
- expect(changes.length).to.equal(0);
47
- });
48
- it('text typed and not yet committed is committed on flush', async () => {
49
- const { editor, changes } = await mount('ox-grist-editor-text', { type: 'string', name: 'title', record: { editable: true } }, { title: 'before' });
50
- const input = editor.renderRoot.querySelector('input');
51
- input.value = 'after';
52
- input.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
53
- editor.flush();
54
- expect(changes.length).to.equal(1);
55
- expect(changes[0].after).to.equal('after');
56
- });
57
- it('a select the user changed is committed on flush', async () => {
58
- const { editor, changes } = await mount('ox-grist-editor-select', { type: 'select', name: 'grade', record: { editable: true, options: ['a', 'b'] } }, { grade: 'a' });
59
- const select = editor.renderRoot.querySelector('select');
60
- select.value = 'b';
61
- select.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
62
- select.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
63
- editor.flush();
64
- expect(changes.length).to.equal(1);
65
- expect(changes[0].after).to.equal('b');
66
- });
67
- });
68
- //# sourceMappingURL=editor-commit.test.js.map