Skip to content

Commit

Permalink
fix(wizards/fcda): remove incorrect iedName from FCDA (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobVogelsang authored Dec 17, 2021
1 parent 8a5d569 commit eae9f6e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/wizards/fcda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function newFCDA(parent: Element, path: string[]): Element | undefined {
const ln = parent.ownerDocument.querySelector(selector(lnTag, lnId));
if (!ln) return;

const iedName = ln.closest('IED')?.getAttribute('name');
const ldInst = ln.closest('LDevice')?.getAttribute('inst');
const prefix = ln.getAttribute('prefix') ?? '';
const lnClass = ln.getAttribute('lnClass');
Expand Down Expand Up @@ -56,10 +55,9 @@ function newFCDA(parent: Element, path: string[]): Element | undefined {
if (tagName === 'BDA') daName = daName + '.' + name;
}

if (!iedName || !ldInst || !lnClass || !doName || !daName || !fc) return;
if (!ldInst || !lnClass || !doName || !daName || !fc) return;

return createElement(parent.ownerDocument, 'FCDA', {
iedName,
ldInst,
prefix,
lnClass,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ describe('FCDA editing wizarding integration', () => {
it('adds a new FCDA on primary action', async () => {
expect(
doc.querySelector(
'DataSet > FCDA[iedName="IED1"][ldInst="CircuitBreaker_CB1"]' +
'DataSet > FCDA[ldInst="CircuitBreaker_CB1"]' +
'[prefix=""][lnClass="LLN0"][lnInst=""][doName="Beh"][daName="stVal"][fc="ST"]'
)
).to.not.exist;
await primaryAction.click();
expect(
doc.querySelector(
'DataSet > FCDA[iedName="IED1"][ldInst="CircuitBreaker_CB1"]' +
'DataSet > FCDA[ldInst="CircuitBreaker_CB1"]' +
'[prefix=""][lnClass="LLN0"][lnInst=""][doName="Beh"][daName="stVal"][fc="ST"]'
)
).to.exist;
Expand All @@ -79,15 +79,15 @@ describe('FCDA editing wizarding integration', () => {
it('adds a new FCDA on primary action', async () => {
expect(
doc.querySelector(
'DataSet > FCDA[iedName="IED1"][ldInst="Meas"]' +
'DataSet > FCDA[ldInst="Meas"]' +
'[prefix="My"][lnClass="MMXU"][lnInst="1"]' +
'[doName="A.phsA"][daName="cVal.mag.i"][fc="MX"]'
)
).to.not.exist;
await primaryAction.click();
expect(
doc.querySelector(
'DataSet > FCDA[iedName="IED1"][ldInst="Meas"]' +
'DataSet > FCDA[ldInst="Meas"]' +
'[prefix="My"][lnClass="MMXU"][lnInst="1"]' +
'[doName="A.phsA"][daName="cVal.mag.i"][fc="MX"]'
)
Expand Down
2 changes: 0 additions & 2 deletions test/unit/wizards/fcda.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ describe('create wizard for FCDA element', () => {
const newElement = <Element>(
actionEvent.args[0][0].detail.action.new.element
);
expect(newElement).to.have.attribute('iedName', 'IED1');
expect(newElement).to.have.attribute('ldInst', 'CircuitBreaker_CB1');
expect(newElement).to.have.attribute('prefix', '');
expect(newElement).to.have.attribute('lnClass', 'LLN0');
Expand Down Expand Up @@ -120,7 +119,6 @@ describe('create wizard for FCDA element', () => {
const newElement = <Element>(
actionEvent.args[0][0].detail.action.new.element
);
expect(newElement).to.have.attribute('iedName', 'IED1');
expect(newElement).to.have.attribute('ldInst', 'Meas');
expect(newElement).to.have.attribute('prefix', 'My');
expect(newElement).to.have.attribute('lnClass', 'MMXU');
Expand Down

0 comments on commit eae9f6e

Please sign in to comment.