|
| 1 | +import { expect, fixture, html } from '@open-wc/testing'; |
| 2 | + |
| 3 | +import '../../mock-wizard-editor.js'; |
| 4 | +import { MockWizardEditor } from '../../mock-wizard-editor.js'; |
| 5 | + |
| 6 | +import { editConnectedApWizard } from '../../../src/wizards/connectedap.js'; |
| 7 | + |
| 8 | +describe('connectedap wizarding editing integration', () => { |
| 9 | + let doc: XMLDocument; |
| 10 | + let element: MockWizardEditor; |
| 11 | + |
| 12 | + beforeEach(async () => { |
| 13 | + element = await fixture(html`<mock-wizard-editor></mock-wizard-editor>`); |
| 14 | + doc = await fetch('/test/testfiles/valid2003.scd') |
| 15 | + .then(response => response.text()) |
| 16 | + .then(str => new DOMParser().parseFromString(str, 'application/xml')); |
| 17 | + }); |
| 18 | + |
| 19 | + it('does not inherit the VLAN-ID and VLAN-PRIORITY of a child Address element', async () => { |
| 20 | + const parser = new DOMParser(); |
| 21 | + const newGSE = ` |
| 22 | + <GSE ldInst="CircuitBreaker_CB1" cbName="GCB"> |
| 23 | + <Address> |
| 24 | + <P type="MAC-Address">01-0C-CD-01-00-10</P> |
| 25 | + <P type="VLAN-ID">005</P> |
| 26 | + <P type="VLAN-PRIORITY">4</P> |
| 27 | + <P type="APPID">0010</P> |
| 28 | + </Address> |
| 29 | + </GSE> |
| 30 | + `; |
| 31 | + const connectedAP = doc.querySelector('ConnectedAP[iedName="IED1"]')!; |
| 32 | + connectedAP.appendChild( |
| 33 | + parser.parseFromString(newGSE, 'application/xml').documentElement |
| 34 | + ); |
| 35 | + |
| 36 | + const wizard = editConnectedApWizard(connectedAP); |
| 37 | + element.workflow.push(() => wizard); |
| 38 | + await element.requestUpdate(); |
| 39 | + await element.updateComplete; |
| 40 | + |
| 41 | + const vlanId = element.wizardUI.shadowRoot!.querySelector( |
| 42 | + 'wizard-textfield[label="VLAN-ID"]' |
| 43 | + )!; |
| 44 | + const vlanPriority = element.wizardUI.shadowRoot!.querySelector( |
| 45 | + 'wizard-textfield[label="VLAN-PRIORITY"]' |
| 46 | + )!; |
| 47 | + |
| 48 | + expect(vlanId.hasAttribute('disabled')).to.be.true; |
| 49 | + expect(vlanPriority.hasAttribute('disabled')).to.be.true; |
| 50 | + }); |
| 51 | +}); |
0 commit comments