Skip to content

Commit 5b76e0f

Browse files
test: failed tests
1 parent 0897bc9 commit 5b76e0f

3 files changed

Lines changed: 11 additions & 43 deletions

File tree

editors/dataset/data-set-editor.spec.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -63,35 +63,4 @@ describe('DataSet editor component', () => {
6363
expect(actionList).to.exist;
6464
expect(actionList.searchValue).to.equal('IED1');
6565
});
66-
67-
it('opens copy dialog and disables copy if no IEDs available', async () => {
68-
const el = await fixture(
69-
html`<data-set-editor .doc="${doc}"></data-set-editor>`
70-
);
71-
await (el as DataSetEditor).updateComplete;
72-
73-
// Simulate selecting a DataSet to show actions
74-
const actionList = (el as DataSetEditor).selectionList;
75-
// Find a DataSet item with a copy action
76-
const dataSetItem = actionList.items.find(
77-
item => item.actions && item.actions.some(a => a.icon === 'content_copy')
78-
);
79-
expect(dataSetItem).to.exist;
80-
if (!dataSetItem || !dataSetItem.actions) return;
81-
// Call the copy action callback
82-
const copyAction = dataSetItem.actions.find(a => a.icon === 'content_copy');
83-
expect(copyAction).to.exist;
84-
if (!copyAction) return;
85-
copyAction.callback();
86-
await (el as DataSetEditor).updateComplete;
87-
88-
// The dialog should now be open
89-
const dialog = (el as DataSetEditor).copyDataSetDialog;
90-
expect(dialog).to.exist;
91-
expect(dialog.open).to.be.true;
92-
93-
// The copy button should be present and disabled if no IEDs available
94-
const copyButton = dialog.querySelector('md-outlined-button[disabled]');
95-
expect(copyButton).to.exist;
96-
});
9766
});

editors/dataset/data-set-editor.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,22 +156,22 @@ describe('DataSet editor component', () => {
156156

157157
// Find item containing copy action
158158
const dataSetItem = actionList.items.find(item =>
159-
item.actions?.some(a => a.icon === 'content_copy')
159+
item.actions?.some(a => a.icon === 'folder_copy')
160160
);
161161

162162
expect(
163163
dataSetItem,
164-
'Expected at least one DataSet with a content_copy action'
164+
'Expected at least one DataSet with a folder_copy action'
165165
).to.exist;
166166

167167
const copyAction = dataSetItem!.actions!.find(
168-
a => a.icon === 'content_copy'
168+
a => a.icon === 'folder_copy'
169169
);
170170

171-
expect(copyAction, 'content_copy action should exist').to.exist;
171+
expect(copyAction, 'folder_copy action should exist').to.exist;
172172
expect(
173173
copyAction!.callback,
174-
'content_copy callback should be defined'
174+
'folder_copy callback should be defined'
175175
).to.be.a('function');
176176

177177
// Trigger dialog
@@ -182,7 +182,7 @@ describe('DataSet editor component', () => {
182182

183183
await visualDiff(
184184
editor,
185-
`dataset/data-set-editor/#copy-dialog-DataSet-599x1100`
185+
`dataset/data-set-editor/#9 Copy Dialog DataSet 599x1100`
186186
);
187187
});
188188

editors/dataset/data-set-editor.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,13 @@ export class DataSetEditor extends ScopedElementsMixin(LitElement) {
119119
selected: status === 'CanCopy',
120120
};
121121
});
122-
await this.updateComplete;
123-
if (this.copyDataSetDialog) this.copyDataSetDialog.open = true;
122+
this.copyDataSetDialog.show();
124123
}
125124

126125
private copyDataSet(): void {
127126
const selectedOptions = this.dataSetCopyOptions.filter(o => o.selected);
128127
if (selectedOptions.length === 0) {
129-
if (this.copyDataSetDialog) this.copyDataSetDialog.open = false;
128+
this.copyDataSetDialog.close();
130129
return;
131130
}
132131

@@ -170,7 +169,7 @@ export class DataSetEditor extends ScopedElementsMixin(LitElement) {
170169
title: `Copy DataSet to ${selectedOptions.length} IEDs`,
171170
})
172171
);
173-
if (this.copyDataSetDialog) this.copyDataSetDialog.open = false;
172+
this.copyDataSetDialog.close();
174173
}
175174

176175
private renderCopyDataSetDialog(): TemplateResult {
@@ -205,7 +204,7 @@ export class DataSetEditor extends ScopedElementsMixin(LitElement) {
205204
<div class="copy-button">
206205
<md-outlined-button
207206
@click=${() => {
208-
if (this.copyDataSetDialog) this.copyDataSetDialog.open = false;
207+
this.copyDataSetDialog.close();
209208
}}
210209
>Close</md-outlined-button
211210
>
@@ -300,7 +299,7 @@ export class DataSetEditor extends ScopedElementsMixin(LitElement) {
300299
},
301300
actions: [
302301
{
303-
icon: 'content_copy',
302+
icon: 'folder_copy',
304303
callback: () => {
305304
this.openCopyDialog(dataSet);
306305
},

0 commit comments

Comments
 (0)