diff --git a/__snapshots__/Templates Plugin.md b/__snapshots__/Templates Plugin.md
index 4c921aa8b5..ba79d5177a 100644
--- a/__snapshots__/Templates Plugin.md
+++ b/__snapshots__/Templates Plugin.md
@@ -29,7 +29,7 @@
- [scl.DAType]
+ [scl.DOType]
-
+
- AnalogueValue_i
+ Dummy.LLN0.Mod
+
+
+ ENC
- 1
+ 14
- ScaledValueConfig
+ Dummy.LLN0.Beh
+
+
+ ENS
- 2
+ 3
+
+
+
+
+ Dummy.LLN0.Health
+
+
+ ENS
+
+
+ 3
+
+
+
+
+ Dummy.LLN0.NamPlt
+
+
+ LPL
+
+
+ 5
+
+
+
+
+ Dummy.LPHD1.PhyNam
+
+
+ DPL
+
+
+ 5
+
+
+
+
+ Dummy.LPHD1.Sim
+
+
+ SPC
+
+
+ 15
+
+
+
+
+ Dummy.XCBR1.Pos
+
+
+ DPC
+
+
+ 5
+
+
+
+
+ Dummy.CSWI.Pos1
+
+
+ DPC
+
+
+ 5
+
+
+
+
+ Dummy.CSWI.Pos2
+
+
+ DPC
+
+
+ 5
+
+
+
+
+ Dummy.XCBR1.OpCnt
+
+
+ INS
+
+
+ 3
+
+
+
+
+ Dummy.XCBR1.NamPlt
+
+
+ LPL
+
+
+ 3
+
+
+
+
+ Dummy.XCBR1.BlkOpn
+
+
+ SPC
+
+
+ 5
+
+ Dummy.SPS
+
+
+ SPS
+
+
+ 3
+
+
+
+
+
+
+ [scl.DAType]
+
+
+
+
diff --git a/src/editors/Templates.ts b/src/editors/Templates.ts
index 22aae47d88..47cb4d19d1 100644
--- a/src/editors/Templates.ts
+++ b/src/editors/Templates.ts
@@ -96,6 +96,36 @@ export default class TemplatesPlugin extends LitElement {
`;
return html`
+
+
+ ${translate('scl.DOType')}
+
+
+
+ ${Array.from(
+ this.doc.querySelectorAll(':root > DataTypeTemplates > DOType') ??
+ []
+ ).map(
+ dotype =>
+ html`${dotype.getAttribute('id')}${dotype.getAttribute(
+ 'cdc'
+ )}${dotype.querySelectorAll('SDO, DA').length}`
+ )}
+
+
${translate('scl.DAType')}
diff --git a/src/translations/de.ts b/src/translations/de.ts
index e1688198ef..f78d6b1623 100644
--- a/src/translations/de.ts
+++ b/src/translations/de.ts
@@ -10,6 +10,7 @@ export const de: Translations = {
EnumVal: 'Enum Wert',
EnumType: 'Enum Typ',
DAType: 'Datenattribut Typ',
+ DOType: 'Datenobjekt Typ',
Report: 'Report',
LN: 'Logischer Knoten',
},
diff --git a/src/translations/en.ts b/src/translations/en.ts
index 221779a54e..55954fc4ef 100644
--- a/src/translations/en.ts
+++ b/src/translations/en.ts
@@ -8,6 +8,7 @@ export const en = {
EnumVal: 'Enum Value',
EnumType: 'Enum Type',
DAType: 'Data Attribute Type',
+ DOType: 'Data Object Type',
Report: 'Report',
LN: 'Logical Node',
},
diff --git a/test/integration/editors/templates/Templates.test.ts b/test/integration/editors/templates/Templates.test.ts
index 133e05c4f9..ab4bb7c293 100644
--- a/test/integration/editors/templates/Templates.test.ts
+++ b/test/integration/editors/templates/Templates.test.ts
@@ -4,8 +4,6 @@ import TemplatesPlugin from '../../../../src/editors/Templates.js';
import { Editing, EditingElement } from '../../../../src/Editing.js';
import { Wizarding, WizardingElement } from '../../../../src/Wizarding.js';
-import { getDocument } from '../../../data.js';
-
describe('Templates Plugin', () => {
customElements.define(
'templates-plugin',
@@ -23,8 +21,12 @@ describe('Templates Plugin', () => {
});
describe('with a doc loaded', () => {
+ let doc: XMLDocument;
beforeEach(async () => {
- element.doc = getDocument();
+ doc = await fetch('/base/test/testfiles/templates/datypes.scd')
+ .then(response => response.text())
+ .then(str => new DOMParser().parseFromString(str, 'application/xml'));
+ element.doc = doc;
await element.updateComplete;
});
it('looks like the latest snapshot', () => {
@@ -33,10 +35,14 @@ describe('Templates Plugin', () => {
});
describe('with a doc loaded missing a datatypetemplates section', () => {
- const doc = getDocument(false);
+ let doc: XMLDocument;
let parent: WizardingElement & EditingElement;
beforeEach(async () => {
+ doc = await fetch('/base/test/testfiles/templates/missingdatatypes.scd')
+ .then(response => response.text())
+ .then(str => new DOMParser().parseFromString(str, 'application/xml'));
+
parent = (
await fixture(
html` {
});
});
describe('with a doc loaded having a datatypetemplates section', () => {
- const doc = getDocument();
+ let doc: XMLDocument;
let parent: WizardingElement & EditingElement;
beforeEach(async () => {
+ doc = await fetch('/base/test/testfiles/templates/datypes.scd')
+ .then(response => response.text())
+ .then(str => new DOMParser().parseFromString(str, 'application/xml'));
parent = (
await fixture(
html` {
((
parent
?.querySelector('templates-plugin')
- ?.shadowRoot?.querySelector('mwc-icon-button[icon="playlist_add"]')
+ ?.shadowRoot?.querySelectorAll(
+ 'mwc-icon-button[icon="playlist_add"]'
+ )[2]
)).click();
await parent.updateComplete;
await new Promise(resolve => setTimeout(resolve, 100)); // await animation
diff --git a/test/integration/editors/templates/datype-wizarding.test.ts b/test/integration/editors/templates/datype-wizarding.test.ts
index d436cc1dd9..5b53b4f971 100644
--- a/test/integration/editors/templates/datype-wizarding.test.ts
+++ b/test/integration/editors/templates/datype-wizarding.test.ts
@@ -24,7 +24,7 @@ describe('DAType wizards', () => {
templates = parent.querySelector('templates-editor')!;
- doc = await fetch('/base/test/testfiles/datypes.scd')
+ doc = await fetch('/base/test/testfiles/templates/datypes.scd')
.then(response => response.text())
.then(str => new DOMParser().parseFromString(str, 'application/xml'));
templates.doc = doc;
@@ -40,9 +40,9 @@ describe('DAType wizards', () => {
let primayAction: HTMLElement;
beforeEach(async () => {
const button = (
- templates?.shadowRoot?.querySelector(
+ templates?.shadowRoot?.querySelectorAll(
'mwc-icon-button[icon="playlist_add"]'
- )
+ )[1]
);
button.click();
await parent.updateComplete;
diff --git a/test/testfiles/datypes.scd b/test/testfiles/templates/datypes.scd
similarity index 100%
rename from test/testfiles/datypes.scd
rename to test/testfiles/templates/datypes.scd
diff --git a/test/testfiles/templates/missingdatatypes.scd b/test/testfiles/templates/missingdatatypes.scd
new file mode 100644
index 0000000000..9df7bef778
--- /dev/null
+++ b/test/testfiles/templates/missingdatatypes.scd
@@ -0,0 +1,20 @@
+
+
+
+
+
+ 110
+
+
+
+
+
+
+
+
+
+