-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editor/substation/l-node-editor): add remove button (#771)
* feat(editor/substation/l-node-editor): add remmove button * refactor(editors/substation/l-node-editor): better naming
- Loading branch information
1 parent
5368cf3
commit 7966f0f
Showing
3 changed files
with
84 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
test/integration/editors/substation/l-node-editor-wizarding-editing.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { fixture, html, expect } from '@open-wc/testing'; | ||
|
||
import '../../../mock-wizard-editor.js'; | ||
import { MockWizardEditor } from '../../../mock-wizard-editor.js'; | ||
|
||
import '../../../../src/editors/substation/l-node-editor.js'; | ||
import { LNodeEditor } from '../../../../src/editors/substation/l-node-editor.js'; | ||
|
||
describe('l-node-editor wizarding editing integration', () => { | ||
let doc: XMLDocument; | ||
let parent: MockWizardEditor; | ||
let element: LNodeEditor | null; | ||
|
||
beforeEach(async () => { | ||
doc = await fetch('/test/testfiles/zeroline/functions.scd') | ||
.then(response => response.text()) | ||
.then(str => new DOMParser().parseFromString(str, 'application/xml')); | ||
|
||
parent = <MockWizardEditor>( | ||
await fixture( | ||
html`<mock-wizard-editor | ||
><l-node-editor | ||
.element=${doc.querySelector('Substation > LNode[lnClass="CSWI"]')} | ||
></l-node-editor | ||
></mock-wizard-editor>` | ||
) | ||
); | ||
|
||
element = parent.querySelector('l-node-editor'); | ||
}); | ||
|
||
describe('has a delete icon button that', () => { | ||
let deleteButton: HTMLElement; | ||
|
||
beforeEach(async () => { | ||
deleteButton = <HTMLElement>( | ||
element?.shadowRoot?.querySelector('mwc-fab[icon="delete"]') | ||
); | ||
await parent.updateComplete; | ||
}); | ||
|
||
it('removes the attached LNode element from the document', async () => { | ||
expect(doc.querySelector('Substation > LNode[lnClass="CSWI"]')).to.exist; | ||
|
||
await deleteButton.click(); | ||
|
||
expect(doc.querySelector('Substation > LNode[lnClass="CSWI"]')).to.not | ||
.exist; | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters