Skip to content

Commit f00092a

Browse files
fix(editors/template): three minor issues (openscd#565)
* fix(public/templates): wrong unit value * fix(edits/template/lnodetype): DO must not have attribute bType * fix(editors/template/dotype): missing namespace def for new DOType
1 parent 10343c6 commit f00092a

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

public/xml/templates.scd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@
789789
</DAType>
790790
<DAType id="OpenSCD_Unit_Hz">
791791
<BDA name="SIUnit" bType="Enum" type="SIUnitKind">
792-
<Val>A</Val>
792+
<Val>Hz</Val>
793793
</BDA>
794794
</DAType>
795795
<DAType id="OpenSCD_ValWithTrans_wo_transInd">

src/editors/templates/dotype-wizards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function addPredefinedDOType(
200200
: null;
201201
const element = values.selected
202202
? <Element>selectedElement!.cloneNode(true)
203-
: parent.ownerDocument.createElement('DOType');
203+
: createElement(parent.ownerDocument, 'DOType', {});
204204

205205
element.setAttribute('id', id);
206206
element.setAttribute('cdc', cdc);

src/editors/templates/lnodetype-wizard.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ function createNewLNodeType(parent: Element, element: Element): WizardActor {
263263
selected.forEach(select => {
264264
const DO = createElement(parent.ownerDocument, 'DO', {
265265
name: select.label,
266-
bType: 'Struct',
267266
type: select.value,
268267
});
269268

test/integration/editors/templates/lnodetype-wizard.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,17 +338,17 @@ describe('LNodeType wizards', () => {
338338

339339
expect(
340340
doc.querySelector(
341-
`LNodeType[id="myGeneralLNodeType"][lnClass="CILO"] > DO[name="Beh"][bType="Struct"][type="${ensId}"]`
341+
`LNodeType[id="myGeneralLNodeType"][lnClass="CILO"] > DO[name="Beh"]:not([bType])[type="${ensId}"]`
342342
)
343343
).to.exist;
344344
expect(
345345
doc.querySelector(
346-
`LNodeType[id="myGeneralLNodeType"][lnClass="CILO"] > DO[name="EnaOpn"][bType="Struct"][type="${spsId}"]`
346+
`LNodeType[id="myGeneralLNodeType"][lnClass="CILO"] > DO[name="EnaOpn"]:not([bType])[type="${spsId}"]`
347347
)
348348
).to.exist;
349349
expect(
350350
doc.querySelector(
351-
`LNodeType[id="myGeneralLNodeType"][lnClass="CILO"] > DO[name="EnaCls"][bType="Struct"][type="${spsId}"]`
351+
`LNodeType[id="myGeneralLNodeType"][lnClass="CILO"] > DO[name="EnaCls"]:not([bType])[type="${spsId}"]`
352352
)
353353
).to.exist;
354354
});

0 commit comments

Comments
 (0)