diff --git a/src/wizards/fcda.ts b/src/wizards/fcda.ts index c71ed473f1..2d789f4670 100644 --- a/src/wizards/fcda.ts +++ b/src/wizards/fcda.ts @@ -30,7 +30,10 @@ function newFCDA(parent: Element, path: string[]): Element | undefined { const ldInst = ln.closest('LDevice')?.getAttribute('inst'); const prefix = ln.getAttribute('prefix') ?? ''; const lnClass = ln.getAttribute('lnClass'); - const lnInst = ln.getAttribute('inst') ?? ''; + const lnInst = + (ln.getAttribute('inst') && ln.getAttribute('inst') !== '') + ? ln.getAttribute('inst') + : null; let doName = ''; let daName = ''; diff --git a/test/integration/wizards/fcda-wizarding-editing-integration.test.ts b/test/integration/wizards/fcda-wizarding-editing-integration.test.ts index 63f0fc165a..d7b7161c5b 100644 --- a/test/integration/wizards/fcda-wizarding-editing-integration.test.ts +++ b/test/integration/wizards/fcda-wizarding-editing-integration.test.ts @@ -46,14 +46,14 @@ describe('FCDA editing wizarding integration', () => { expect( doc.querySelector( 'DataSet > FCDA[ldInst="CircuitBreaker_CB1"]' + - '[prefix=""][lnClass="LLN0"][lnInst=""][doName="Beh"][daName="stVal"][fc="ST"]' + '[prefix=""][lnClass="LLN0"]:not(lnInst)[doName="Beh"][daName="stVal"][fc="ST"]' ) ).to.not.exist; await primaryAction.click(); expect( doc.querySelector( 'DataSet > FCDA[ldInst="CircuitBreaker_CB1"]' + - '[prefix=""][lnClass="LLN0"][lnInst=""][doName="Beh"][daName="stVal"][fc="ST"]' + '[prefix=""][lnClass="LLN0"]:not(lnInst)[doName="Beh"][daName="stVal"][fc="ST"]' ) ).to.exist; }); diff --git a/test/unit/wizards/fcda.test.ts b/test/unit/wizards/fcda.test.ts index 82995f0481..6d890971b2 100644 --- a/test/unit/wizards/fcda.test.ts +++ b/test/unit/wizards/fcda.test.ts @@ -81,7 +81,7 @@ describe('create wizard for FCDA element', () => { expect(newElement).to.have.attribute('ldInst', 'CircuitBreaker_CB1'); expect(newElement).to.have.attribute('prefix', ''); expect(newElement).to.have.attribute('lnClass', 'LLN0'); - expect(newElement).to.have.attribute('lnInst', ''); + expect(newElement).to.not.have.attribute('lnInst'); expect(newElement).to.have.attribute('doName', 'Beh'); expect(newElement).to.have.attribute('daName', 'stVal'); expect(newElement).to.have.attribute('fc', 'ST');