@dile/crud 2.10.0 → 2.10.2
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/package.json +3 -3
- package/components/action/src/DileCrudSingleActions.spec.js +0 -126
- package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-closing-dialog-with-ESC-and-reopening-without-data-shows-reset-form-1.png +0 -0
- package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-initialData-is-cleared-after-being-applied-1.png +0 -0
- package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-initialData-is-only-applied-once-and-cleared-after-opening-1.png +0 -0
- package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-behavior-matches-original-when-no-initialData-1.png +0 -0
- package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-opens-confirm-dialog-1.png +0 -0
- package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-with-initialData-sets-form-values-1.png +0 -0
- package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-with-initialData-sets-form-values-before-opening-dialog-1.png +0 -0
- package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-without-initialData-resets-form-1.png +0 -0
- package/components/action/src/__screenshots__/DileCrudSingleActions.spec.js/DileCrudSingleActions-with-triggerAction-triggerAction-without-initialData-resets-form-to-empty-1.png +0 -0
- package/components/ajax/ajax.spec.js +0 -35
- package/components/ajax-select-crud/ajax-select-crud-overlay.spec.js +0 -186
- package/components/crud/__screenshots__/crud.spec.js/dile-crud-list-grid-view-switch-defaults-to-the-item-template-and-toggles-to-the-grid-on-click-when-both-views-are-configured-1.png +0 -0
- package/components/crud/__screenshots__/crud.spec.js/dile-crud-list-grid-view-switch-does-not-render-the-switch-button-when-customization-disableListWiewSwitch-is-true-1.png +0 -0
- package/components/crud/crud.spec.js +0 -453
- package/components/file-uploader/file-uploader.spec.js +0 -32
- package/components/list/__screenshots__/crud-data-grid.spec.js/dile-crud-data-grid-always-forces-sort-mode-to-external-regardless-of-config-1.png +0 -0
- package/components/list/__screenshots__/crud-data-grid.spec.js/dile-crud-data-grid-forwards-stickyFirstColumn--striped--responsiveMode-and-emptyMessage-with-sensible-defaults-1.png +0 -0
- package/components/list/__screenshots__/crud-data-grid.spec.js/dile-crud-data-grid-leaves-computeRowId-unset-when-config-computeItemId-is-not-a-function-1.png +0 -0
- package/components/list/__screenshots__/crud-list.spec.js/dile-crud-list-scope-changes-and-page-reset-keeps-the-current-page-on-refresh---and-goes-back-to-page-1-on-refresh---resetPage--true----1.png +0 -0
- package/components/list/__screenshots__/crud-list.spec.js/dile-crud-list-scope-changes-and-page-reset-reloads-from-the-first-page-with-the-new-scope-when-belongsTo-and-relationId-change-1.png +0 -0
- package/components/list/__screenshots__/crud-list.spec.js/dile-crud-list-scope-changes-and-page-reset-reloads-when-only-relationId-changes-1.png +0 -0
- package/components/list/crud-data-grid.spec.js +0 -207
- package/components/list/crud-item-actions.spec.js +0 -122
- package/components/list/crud-list.spec.js +0 -455
- package/components/many-relation/many-relation.spec.js +0 -154
- package/components/select-ajax-simple/select-ajax-simple.spec.js +0 -133
- package/components/single/src/DileCrudSingle.spec.js +0 -151
- package/components/single/src/__screenshots__/DileCrudSingle.spec.js/DileCrudSingle-triggerAction-and-triggerDirectAction-triggerAction-delegates-to-singleActionsElement-triggerAction-1.png +0 -0
- package/components/single/src/__screenshots__/DileCrudSingle.spec.js/DileCrudSingle-triggerAction-and-triggerDirectAction-triggerAction-without-initialData-works-1.png +0 -0
- package/components/single/src/__screenshots__/DileCrudSingle.spec.js/DileCrudSingle-triggerAction-and-triggerDirectAction-triggerDirectAction-delegates-to-singleActionsElement-triggerAction-1.png +0 -0
- package/components/single/src/__screenshots__/DileCrudSingle.spec.js/DileCrudSingle-triggerAction-and-triggerDirectAction-triggerDirectAction-without-initialData-still-works--backward-compatibility--1.png +0 -0
- package/components/steps-form/__screenshots__/steps-form.spec.js/dile-steps-form-translates-the-navigation-labels-with-the-language-property-1.png +0 -0
- package/components/steps-form/steps-form.spec.js +0 -230
- package/components/ui/__screenshots__/crud-sort-form.spec.js/dile-crud-sort-form-clicking-the-label-of-an-inactive-option-switches-to-it-using-its-own-configured-direction--without-flipping-it-1.png +0 -0
- package/components/ui/__screenshots__/crud-sort-form.spec.js/dile-crud-sort-form-clicking-the-label-of-the-already-active-option-toggles-its-direction-instead-of-doing-nothing-1.png +0 -0
- package/components/ui/__screenshots__/crud-sort-form.spec.js/dile-crud-sort-form-syncSort-suppresses-exactly-one-radio-group-echo--preserving-the-synced-direction-instead-of-falling-back-to-the-option-static-default-1.png +0 -0
- package/components/ui/crud-sort-form.spec.js +0 -132
- package/lib/CrudConfigBuilder.spec.js +0 -32
- package/lib/deepMerge.spec.js +0 -45
- package/lib/listViewMode.spec.js +0 -73
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
|
-
import { CrudConfigBuilder } from '../../lib/CrudConfigBuilder.js';
|
|
3
|
-
import './crud-data-grid.js';
|
|
4
|
-
import '@dile/ui/components/data-grid/data-grid.js';
|
|
5
|
-
|
|
6
|
-
describe('dile-crud-data-grid', () => {
|
|
7
|
-
afterEach(() => {
|
|
8
|
-
document.body.innerHTML = '';
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const sampleColumns = [
|
|
12
|
-
{ field: 'id', header: 'ID' },
|
|
13
|
-
{ field: 'name', header: 'Name' },
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
const sampleItems = [
|
|
17
|
-
{ id: 1, name: 'Item A' },
|
|
18
|
-
{ id: 2, name: 'Item B', deleted_at: '2026-01-01' },
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
async function createGrid(customConfig = {}, props = {}) {
|
|
22
|
-
const config = new CrudConfigBuilder('https://example.test/api/items', customConfig).getConfig();
|
|
23
|
-
const el = document.createElement('dile-crud-data-grid');
|
|
24
|
-
el.config = config;
|
|
25
|
-
el.items = props.items ?? sampleItems;
|
|
26
|
-
el.selectedIds = props.selectedIds ?? [];
|
|
27
|
-
if (props.sort !== undefined) {
|
|
28
|
-
el.sort = props.sort;
|
|
29
|
-
}
|
|
30
|
-
document.body.appendChild(el);
|
|
31
|
-
await el.updateComplete;
|
|
32
|
-
return el;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function innerGrid(el) {
|
|
36
|
-
return el.shadowRoot.querySelector('dile-data-grid');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
it('builds columns from config.grid.columns and auto-appends an Actions column by default', async () => {
|
|
40
|
-
const el = await createGrid({ grid: { columns: sampleColumns } });
|
|
41
|
-
|
|
42
|
-
expect(el.columns.length).toBe(3);
|
|
43
|
-
expect(el.columns[0]).toEqual(sampleColumns[0]);
|
|
44
|
-
expect(el.columns[1]).toEqual(sampleColumns[1]);
|
|
45
|
-
expect(el.columns[2].header).toBe('Actions');
|
|
46
|
-
expect(el.columns[2].align).toBe('right');
|
|
47
|
-
expect(el.columns[2].width).toBe('110px');
|
|
48
|
-
expect(el.columns[2].hideCardLabel).toBe(true);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('does not append an Actions column when config.grid.hideActionsColumn is true', async () => {
|
|
52
|
-
const el = await createGrid({ grid: { columns: sampleColumns, hideActionsColumn: true } });
|
|
53
|
-
|
|
54
|
-
expect(el.columns.length).toBe(2);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('does not append an Actions column when actions are globally disabled', async () => {
|
|
58
|
-
const el = await createGrid({
|
|
59
|
-
grid: { columns: sampleColumns },
|
|
60
|
-
customization: { disableListActions: true },
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
expect(el.columns.length).toBe(2);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('honors actionsColumnHeader, actionsColumnWidth and actionsColumnAlign overrides', async () => {
|
|
67
|
-
const el = await createGrid({
|
|
68
|
-
grid: {
|
|
69
|
-
columns: sampleColumns,
|
|
70
|
-
actionsColumnHeader: 'Ops',
|
|
71
|
-
actionsColumnWidth: '150px',
|
|
72
|
-
actionsColumnAlign: 'center',
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
const actionsColumn = el.columns[el.columns.length - 1];
|
|
77
|
-
expect(actionsColumn.header).toBe('Ops');
|
|
78
|
-
expect(actionsColumn.width).toBe('150px');
|
|
79
|
-
expect(actionsColumn.align).toBe('center');
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('falls back to config.labels.actionsHeader when grid.actionsColumnHeader is not set', async () => {
|
|
83
|
-
const el = await createGrid({
|
|
84
|
-
grid: { columns: sampleColumns },
|
|
85
|
-
labels: { actionsHeader: 'Manage' },
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const actionsColumn = el.columns[el.columns.length - 1];
|
|
89
|
-
expect(actionsColumn.header).toBe('Manage');
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('renders dile-crud-item-actions in the Actions column wired with .item and .config', async () => {
|
|
93
|
-
const el = await createGrid({ grid: { columns: sampleColumns } });
|
|
94
|
-
|
|
95
|
-
const grid = innerGrid(el);
|
|
96
|
-
const actionsElements = grid.shadowRoot.querySelectorAll('dile-crud-item-actions');
|
|
97
|
-
expect(actionsElements.length).toBe(sampleItems.length);
|
|
98
|
-
expect(actionsElements[0].item).toEqual(sampleItems[0]);
|
|
99
|
-
expect(actionsElements[0].config).toBe(el.config);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('derives selectable from !config.customization.hideCheckboxSelection by default', async () => {
|
|
103
|
-
const elHidden = await createGrid({ grid: { columns: sampleColumns }, customization: { hideCheckboxSelection: true } });
|
|
104
|
-
expect(innerGrid(elHidden).selectable).toBe(false);
|
|
105
|
-
|
|
106
|
-
const elShown = await createGrid({ grid: { columns: sampleColumns }, customization: { hideCheckboxSelection: false } });
|
|
107
|
-
expect(innerGrid(elShown).selectable).toBe(true);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('lets config.grid.selectable override the customization.hideCheckboxSelection default', async () => {
|
|
111
|
-
const elForcedOff = await createGrid({
|
|
112
|
-
grid: { columns: sampleColumns, selectable: false },
|
|
113
|
-
customization: { hideCheckboxSelection: false },
|
|
114
|
-
});
|
|
115
|
-
expect(innerGrid(elForcedOff).selectable).toBe(false);
|
|
116
|
-
|
|
117
|
-
const elForcedOn = await createGrid({
|
|
118
|
-
grid: { columns: sampleColumns, selectable: true },
|
|
119
|
-
customization: { hideCheckboxSelection: true },
|
|
120
|
-
});
|
|
121
|
-
expect(innerGrid(elForcedOn).selectable).toBe(true);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('forwards stickyFirstColumn, striped, responsiveMode and emptyMessage with sensible defaults', async () => {
|
|
125
|
-
const elDefaults = await createGrid({ grid: { columns: sampleColumns } });
|
|
126
|
-
const gridDefaults = innerGrid(elDefaults);
|
|
127
|
-
expect(gridDefaults.stickyFirstColumn).toBe(true);
|
|
128
|
-
expect(gridDefaults.striped).toBe(true);
|
|
129
|
-
expect(gridDefaults.responsiveMode).toBe('auto');
|
|
130
|
-
expect(gridDefaults.emptyMessage).toBe('No data available');
|
|
131
|
-
|
|
132
|
-
const elOverrides = await createGrid({
|
|
133
|
-
grid: {
|
|
134
|
-
columns: sampleColumns,
|
|
135
|
-
stickyFirstColumn: false,
|
|
136
|
-
striped: false,
|
|
137
|
-
responsiveMode: 'cards',
|
|
138
|
-
emptyMessage: 'Nothing here',
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
const gridOverrides = innerGrid(elOverrides);
|
|
142
|
-
expect(gridOverrides.stickyFirstColumn).toBe(false);
|
|
143
|
-
expect(gridOverrides.striped).toBe(false);
|
|
144
|
-
expect(gridOverrides.responsiveMode).toBe('cards');
|
|
145
|
-
expect(gridOverrides.emptyMessage).toBe('Nothing here');
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('always forces sort-mode to external regardless of config', async () => {
|
|
149
|
-
const el = await createGrid({ grid: { columns: sampleColumns } });
|
|
150
|
-
expect(innerGrid(el).sortMode).toBe('external');
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it('forwards the sort property as sortField/sortDirection so the header keeps its sorted state', async () => {
|
|
154
|
-
const el = await createGrid({ grid: { columns: sampleColumns } }, { sort: { sortField: 'name', sortDirection: 'desc' } });
|
|
155
|
-
expect(innerGrid(el).sortField).toBe('name');
|
|
156
|
-
expect(innerGrid(el).sortDirection).toBe('desc');
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('defaults sortField/sortDirection to empty strings when sort is not set', async () => {
|
|
160
|
-
const el = await createGrid({ grid: { columns: sampleColumns } });
|
|
161
|
-
expect(innerGrid(el).sortField).toBe('');
|
|
162
|
-
expect(innerGrid(el).sortDirection).toBe('');
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('wires computeRowId from config.computeItemId so selection matches custom ids', async () => {
|
|
166
|
-
const el = await createGrid(
|
|
167
|
-
{
|
|
168
|
-
grid: { columns: sampleColumns, selectable: true },
|
|
169
|
-
computeItemId: (item) => `custom-${item.id}`,
|
|
170
|
-
},
|
|
171
|
-
{ selectedIds: ['custom-2'] }
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
const checkboxes = innerGrid(el).shadowRoot.querySelectorAll('dile-checkbox');
|
|
175
|
-
expect(checkboxes[0].checked).toBe(false);
|
|
176
|
-
expect(checkboxes[1].checked).toBe(true);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
it('leaves computeRowId unset when config.computeItemId is not a function', async () => {
|
|
180
|
-
const el = document.createElement('dile-crud-data-grid');
|
|
181
|
-
el.config = { grid: { columns: sampleColumns } };
|
|
182
|
-
el.items = sampleItems;
|
|
183
|
-
document.body.appendChild(el);
|
|
184
|
-
await el.updateComplete;
|
|
185
|
-
|
|
186
|
-
expect(el.computeRowId).toBeNull();
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
it('applies the is-deleted row class to rows whose deleted_at is truthy', async () => {
|
|
190
|
-
const el = await createGrid({ grid: { columns: sampleColumns } });
|
|
191
|
-
|
|
192
|
-
const rows = innerGrid(el).shadowRoot.querySelectorAll('tbody tr');
|
|
193
|
-
expect(rows[0].classList.contains('is-deleted')).toBe(false);
|
|
194
|
-
expect(rows[1].classList.contains('is-deleted')).toBe(true);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
it('does not throw and still appends the Actions column when config is null', async () => {
|
|
198
|
-
const el = document.createElement('dile-crud-data-grid');
|
|
199
|
-
el.items = sampleItems;
|
|
200
|
-
document.body.appendChild(el);
|
|
201
|
-
await el.updateComplete;
|
|
202
|
-
|
|
203
|
-
expect(el.columns.length).toBe(1);
|
|
204
|
-
expect(el.columns[0].header).toBe('Actions');
|
|
205
|
-
expect(innerGrid(el)).toBeTruthy();
|
|
206
|
-
});
|
|
207
|
-
});
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
|
-
import { html } from 'lit';
|
|
3
|
-
import { CrudConfigBuilder } from '../../lib/CrudConfigBuilder.js';
|
|
4
|
-
import { DileCrudItemActions } from './src/DileCrudItemActions.js';
|
|
5
|
-
import './crud-item-actions.js';
|
|
6
|
-
|
|
7
|
-
describe('dile-crud-item-actions', () => {
|
|
8
|
-
afterEach(() => {
|
|
9
|
-
document.body.innerHTML = '';
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const sampleItem = { id: 10, name: 'Sample Item', deleted_at: null };
|
|
13
|
-
const deletedItem = { id: 20, name: 'Deleted Item', deleted_at: '2026-01-01' };
|
|
14
|
-
|
|
15
|
-
it('renders edit and delete buttons by default', async () => {
|
|
16
|
-
const el = document.createElement('dile-crud-item-actions');
|
|
17
|
-
el.item = sampleItem;
|
|
18
|
-
document.body.appendChild(el);
|
|
19
|
-
await el.updateComplete;
|
|
20
|
-
|
|
21
|
-
const editBtn = el.shadowRoot.querySelector('dile-button.edit');
|
|
22
|
-
const deleteBtn = el.shadowRoot.querySelector('dile-button.delete');
|
|
23
|
-
const restoreBtn = el.shadowRoot.querySelector('dile-button.restore');
|
|
24
|
-
|
|
25
|
-
expect(editBtn).toBeTruthy();
|
|
26
|
-
expect(deleteBtn).toBeTruthy();
|
|
27
|
-
expect(restoreBtn).toBeNull();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('renders restore button when item has deleted_at or isDeleted is true', async () => {
|
|
31
|
-
const el = document.createElement('dile-crud-item-actions');
|
|
32
|
-
el.item = deletedItem;
|
|
33
|
-
document.body.appendChild(el);
|
|
34
|
-
await el.updateComplete;
|
|
35
|
-
|
|
36
|
-
const editBtn = el.shadowRoot.querySelector('dile-button.edit');
|
|
37
|
-
const deleteBtn = el.shadowRoot.querySelector('dile-button.delete');
|
|
38
|
-
const restoreBtn = el.shadowRoot.querySelector('dile-button.restore');
|
|
39
|
-
|
|
40
|
-
expect(editBtn).toBeNull();
|
|
41
|
-
expect(deleteBtn).toBeNull();
|
|
42
|
-
expect(restoreBtn).toBeTruthy();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('respects global customization and item-level callbacks from config', async () => {
|
|
46
|
-
const config = new CrudConfigBuilder('https://example.test/api/items', {
|
|
47
|
-
customization: {
|
|
48
|
-
disableEdit: false,
|
|
49
|
-
disableDelete: true,
|
|
50
|
-
},
|
|
51
|
-
isItemEditable: (item) => item.id !== 99,
|
|
52
|
-
computeItemId: (item) => `custom-${item.id}`,
|
|
53
|
-
}).getConfig();
|
|
54
|
-
|
|
55
|
-
const el = document.createElement('dile-crud-item-actions');
|
|
56
|
-
el.item = { id: 99, name: 'Not editable' };
|
|
57
|
-
el.config = config;
|
|
58
|
-
document.body.appendChild(el);
|
|
59
|
-
await el.updateComplete;
|
|
60
|
-
|
|
61
|
-
// Both edit (via isItemEditable returning false) and delete (via disableDelete: true) should be hidden
|
|
62
|
-
expect(el.shadowRoot.querySelector('dile-button.edit')).toBeNull();
|
|
63
|
-
expect(el.shadowRoot.querySelector('dile-button.delete')).toBeNull();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('hides all actions when disableListActions is true in config', async () => {
|
|
67
|
-
const config = new CrudConfigBuilder('https://example.test/api/items', {
|
|
68
|
-
customization: {
|
|
69
|
-
disableListActions: true,
|
|
70
|
-
},
|
|
71
|
-
}).getConfig();
|
|
72
|
-
|
|
73
|
-
expect(DileCrudItemActions.hasActions(config)).toBe(false);
|
|
74
|
-
|
|
75
|
-
const el = document.createElement('dile-crud-item-actions');
|
|
76
|
-
el.item = sampleItem;
|
|
77
|
-
el.config = config;
|
|
78
|
-
document.body.appendChild(el);
|
|
79
|
-
await el.updateComplete;
|
|
80
|
-
|
|
81
|
-
expect(el.shadowRoot.querySelector('dile-button.edit')).toBeNull();
|
|
82
|
-
expect(el.shadowRoot.querySelector('dile-button.delete')).toBeNull();
|
|
83
|
-
expect(el.shadowRoot.querySelector('dile-button.restore')).toBeNull();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('DileCrudItemActions.hasActions returns false if edit, delete and restore are all disabled', () => {
|
|
87
|
-
const config = new CrudConfigBuilder('https://example.test/api/items', {
|
|
88
|
-
customization: {
|
|
89
|
-
disableEdit: true,
|
|
90
|
-
disableDelete: true,
|
|
91
|
-
disableRestore: true,
|
|
92
|
-
},
|
|
93
|
-
}).getConfig();
|
|
94
|
-
|
|
95
|
-
expect(DileCrudItemActions.hasActions(config)).toBe(false);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('dispatches crud-item-edit with computed itemId from config', async () => {
|
|
99
|
-
const config = new CrudConfigBuilder('https://example.test/api/items', {
|
|
100
|
-
computeItemId: (item) => `computed-${item.id}`,
|
|
101
|
-
}).getConfig();
|
|
102
|
-
|
|
103
|
-
const el = document.createElement('dile-crud-item-actions');
|
|
104
|
-
el.item = sampleItem;
|
|
105
|
-
el.config = config;
|
|
106
|
-
document.body.appendChild(el);
|
|
107
|
-
await el.updateComplete;
|
|
108
|
-
|
|
109
|
-
let emittedDetail = null;
|
|
110
|
-
el.addEventListener('crud-item-edit', (e) => {
|
|
111
|
-
emittedDetail = e.detail;
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
const editBtn = el.shadowRoot.querySelector('dile-button.edit');
|
|
115
|
-
editBtn.click();
|
|
116
|
-
|
|
117
|
-
expect(emittedDetail).toEqual({
|
|
118
|
-
item: sampleItem,
|
|
119
|
-
itemId: 'computed-10',
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
});
|