Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wizards/fcda): make sure lnInst is non empty string #512

Merged
merged 2 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/wizards/fcda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]'
JakobVogelsang marked this conversation as resolved.
Show resolved Hide resolved
)
).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;
});
Expand Down
2 changes: 1 addition & 1 deletion test/unit/wizards/fcda.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down