diff --git a/CHANGELOG.md b/CHANGELOG.md index c3634cef8..0b4487b74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [0.33.0](https://github.com/openscd/open-scd/compare/v0.32.0...v0.33.0) (2023-06-22) + + +### Features + +* **openscd:** Move progress indicator beneath plugin tabs ([#1181](https://github.com/openscd/open-scd/issues/1181)) ([a7a7081](https://github.com/openscd/open-scd/commits/a7a7081a32ee14998d0ead75ffb89ba2726631f8)), closes [#1178](https://github.com/openscd/open-scd/issues/1178) + + +### Bug Fixes + +* **editing:** use editCount property for change propagation ([#1233](https://github.com/openscd/open-scd/issues/1233)) ([548f63b](https://github.com/openscd/open-scd/commits/548f63b5b35dac6772230004e6ca7859cf3337b8)) +* escaped symbols in regex patterns ([#1266](https://github.com/openscd/open-scd/issues/1266)) ([de2dd0d](https://github.com/openscd/open-scd/commits/de2dd0dc2351c8feb6a70da62e43640334df571b)) +* goose subscription reflects state incorrectly ([#1261](https://github.com/openscd/open-scd/issues/1261)) ([4440bff](https://github.com/openscd/open-scd/commits/4440bff63c0ebe816a9fdc25f8af6da1ca6645f4)) + ## [0.31.0](https://github.com/openscd/open-scd/compare/v0.30.0...v0.31.0) (2023-05-02) diff --git a/manifest.json b/manifest.json index bd5aa32ce..d2ca32cb1 100644 --- a/manifest.json +++ b/manifest.json @@ -40,5 +40,5 @@ "purpose": "maskable" } ], - "version": "0.31.0" + "version": "0.33.0" } diff --git a/package-lock.json b/package-lock.json index d7dd2cb86..a2e68721e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,14 @@ { "name": "open-scd", - "version": "0.31.0", + "version": "0.33.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "open-scd", - "version": "0.31.0", + "version": "0.33.0", "license": "Apache-2.0", "dependencies": { - "@material/mwc-circular-progress-four-color": "0.22.1", "@material/mwc-dialog": "0.22.1", "@material/mwc-drawer": "0.22.1", "@material/mwc-fab": "0.22.1", @@ -2344,19 +2343,6 @@ "tslib": "^2.1.0" } }, - "node_modules/@material/circular-progress": { - "version": "12.0.0-canary.22d29cbb4.0", - "resolved": "https://registry.npmjs.org/@material/circular-progress/-/circular-progress-12.0.0-canary.22d29cbb4.0.tgz", - "integrity": "sha512-B3Vlg+HMsPibemXAnvXJxcfTFOKpuH79ItaMd/VrqnxLfdI9NWObiDVbMbYMNw9GiUc3TF53K25mxKcqFCUOnQ==", - "dependencies": { - "@material/animation": "12.0.0-canary.22d29cbb4.0", - "@material/base": "12.0.0-canary.22d29cbb4.0", - "@material/feature-targeting": "12.0.0-canary.22d29cbb4.0", - "@material/progress-indicator": "12.0.0-canary.22d29cbb4.0", - "@material/theme": "12.0.0-canary.22d29cbb4.0", - "tslib": "^2.1.0" - } - }, "node_modules/@material/density": { "version": "12.0.0-canary.22d29cbb4.0", "resolved": "https://registry.npmjs.org/@material/density/-/density-12.0.0-canary.22d29cbb4.0.tgz", @@ -2588,32 +2574,6 @@ "tslib": "^2.0.1" } }, - "node_modules/@material/mwc-circular-progress": { - "version": "0.22.1", - "resolved": "https://registry.npmjs.org/@material/mwc-circular-progress/-/mwc-circular-progress-0.22.1.tgz", - "integrity": "sha512-stGOBIBDgvx/nMoL5QBOA2axAx/VXUiTkTWsFNa7aTkG/CZX94A9KvdcWlcbkdbNguX1LPdw3otKB/Vurmbviw==", - "dependencies": { - "@material/circular-progress": "=12.0.0-canary.22d29cbb4.0", - "@material/mwc-base": "^0.22.1", - "@material/theme": "=12.0.0-canary.22d29cbb4.0", - "lit-element": "^2.5.1", - "lit-html": "^1.4.1", - "tslib": "^2.0.1" - } - }, - "node_modules/@material/mwc-circular-progress-four-color": { - "version": "0.22.1", - "resolved": "https://registry.npmjs.org/@material/mwc-circular-progress-four-color/-/mwc-circular-progress-four-color-0.22.1.tgz", - "integrity": "sha512-2KEANn/lI78fVP0EdJDmIN8ZfLjQxEgyE7MwLrNJz0S1HG/eZjZd4qTcfHifKDIWjR/NsnbAlc836HAJDkAaNg==", - "dependencies": { - "@material/circular-progress": "=12.0.0-canary.22d29cbb4.0", - "@material/mwc-base": "^0.22.1", - "@material/mwc-circular-progress": "^0.22.1", - "@material/theme": "=12.0.0-canary.22d29cbb4.0", - "lit-element": "^2.5.1", - "tslib": "^2.0.1" - } - }, "node_modules/@material/mwc-dialog": { "version": "0.22.1", "resolved": "https://registry.npmjs.org/@material/mwc-dialog/-/mwc-dialog-0.22.1.tgz", @@ -19839,19 +19799,6 @@ "tslib": "^2.1.0" } }, - "@material/circular-progress": { - "version": "12.0.0-canary.22d29cbb4.0", - "resolved": "https://registry.npmjs.org/@material/circular-progress/-/circular-progress-12.0.0-canary.22d29cbb4.0.tgz", - "integrity": "sha512-B3Vlg+HMsPibemXAnvXJxcfTFOKpuH79ItaMd/VrqnxLfdI9NWObiDVbMbYMNw9GiUc3TF53K25mxKcqFCUOnQ==", - "requires": { - "@material/animation": "12.0.0-canary.22d29cbb4.0", - "@material/base": "12.0.0-canary.22d29cbb4.0", - "@material/feature-targeting": "12.0.0-canary.22d29cbb4.0", - "@material/progress-indicator": "12.0.0-canary.22d29cbb4.0", - "@material/theme": "12.0.0-canary.22d29cbb4.0", - "tslib": "^2.1.0" - } - }, "@material/density": { "version": "12.0.0-canary.22d29cbb4.0", "resolved": "https://registry.npmjs.org/@material/density/-/density-12.0.0-canary.22d29cbb4.0.tgz", @@ -20083,32 +20030,6 @@ "tslib": "^2.0.1" } }, - "@material/mwc-circular-progress": { - "version": "0.22.1", - "resolved": "https://registry.npmjs.org/@material/mwc-circular-progress/-/mwc-circular-progress-0.22.1.tgz", - "integrity": "sha512-stGOBIBDgvx/nMoL5QBOA2axAx/VXUiTkTWsFNa7aTkG/CZX94A9KvdcWlcbkdbNguX1LPdw3otKB/Vurmbviw==", - "requires": { - "@material/circular-progress": "=12.0.0-canary.22d29cbb4.0", - "@material/mwc-base": "^0.22.1", - "@material/theme": "=12.0.0-canary.22d29cbb4.0", - "lit-element": "^2.5.1", - "lit-html": "^1.4.1", - "tslib": "^2.0.1" - } - }, - "@material/mwc-circular-progress-four-color": { - "version": "0.22.1", - "resolved": "https://registry.npmjs.org/@material/mwc-circular-progress-four-color/-/mwc-circular-progress-four-color-0.22.1.tgz", - "integrity": "sha512-2KEANn/lI78fVP0EdJDmIN8ZfLjQxEgyE7MwLrNJz0S1HG/eZjZd4qTcfHifKDIWjR/NsnbAlc836HAJDkAaNg==", - "requires": { - "@material/circular-progress": "=12.0.0-canary.22d29cbb4.0", - "@material/mwc-base": "^0.22.1", - "@material/mwc-circular-progress": "^0.22.1", - "@material/theme": "=12.0.0-canary.22d29cbb4.0", - "lit-element": "^2.5.1", - "tslib": "^2.0.1" - } - }, "@material/mwc-dialog": { "version": "0.22.1", "resolved": "https://registry.npmjs.org/@material/mwc-dialog/-/mwc-dialog-0.22.1.tgz", diff --git a/package.json b/package.json index b562271ae..9238aa93e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "open-scd", - "version": "0.31.0", + "version": "0.33.0", "repository": "https://github.com/openscd/open-scd.git", "description": "A bottom-up substation configuration designer for projects described using SCL `IEC 61850-6` Edition 2 or greater.", "keywords": [ @@ -17,7 +17,6 @@ "module": "open-scd.js", "type": "module", "dependencies": { - "@material/mwc-circular-progress-four-color": "0.22.1", "@material/mwc-dialog": "0.22.1", "@material/mwc-drawer": "0.22.1", "@material/mwc-fab": "0.22.1", diff --git a/src/Editing.ts b/src/Editing.ts index 929d10be5..736773378 100644 --- a/src/Editing.ts +++ b/src/Editing.ts @@ -424,16 +424,6 @@ export function Editing(Base: TBase) { if (!this.doc) return; - const newDoc = document.implementation.createDocument( - this.doc.lookupNamespaceURI(''), - this.doc.documentElement.tagName, - this.doc.doctype - ); - - // change the document object reference to enable reactive updates - newDoc.documentElement.replaceWith(this.doc.documentElement); - this.doc = newDoc; - await this.updateComplete; this.dispatchEvent(newValidateEvent()); } diff --git a/src/Hosting.ts b/src/Hosting.ts index 4c50dc2b0..6bf19bb74 100644 --- a/src/Hosting.ts +++ b/src/Hosting.ts @@ -295,7 +295,7 @@ export function Hosting< wrapFocus @action=${(ae: CustomEvent) => { //FIXME: dirty hack to be fixed in open-scd-core - // if clause not neccassary when oscd... compenents in open-scd not list + // if clause not necessary when oscd... components in open-scd not list if (ae.target instanceof List) (( this.menu.filter( diff --git a/src/Logging.ts b/src/Logging.ts index d88a197cd..ca955343e 100644 --- a/src/Logging.ts +++ b/src/Logging.ts @@ -63,7 +63,7 @@ function getPluginName(src: string): string { * A mixin adding a `history` property to any `LitElement`, in which * incoming [[`LogEvent`]]s are logged. * - * For [[`EditorAction`]] entries, also sets `currentAction` to the index of + * For [[`EditorAction`]] entries, also sets `editCount` to the index of * the committed action, allowing the user to go to `previousAction` with * `undo()` if `canUndo` and to go to `nextAction` with `redo()` if `canRedo`. * @@ -79,7 +79,7 @@ export function Logging(Base: TBase) { history: LogEntry[] = []; /** Index of the last [[`EditorAction`]] applied. */ @property({ type: Number }) - currentAction = -1; + editCount = -1; @property() diagnoses = new Map(); @internalProperty() @@ -93,7 +93,7 @@ export function Logging(Base: TBase) { @query('#issue') issueUI!: Snackbar; get canUndo(): boolean { - return this.currentAction >= 0; + return this.editCount >= 0; } get canRedo(): boolean { return this.nextAction >= 0; @@ -102,15 +102,15 @@ export function Logging(Base: TBase) { get previousAction(): number { if (!this.canUndo) return -1; return this.history - .slice(0, this.currentAction) + .slice(0, this.editCount) .map(entry => (entry.kind == 'action' ? true : false)) .lastIndexOf(true); } get nextAction(): number { let index = this.history - .slice(this.currentAction + 1) + .slice(this.editCount + 1) .findIndex(entry => entry.kind == 'action'); - if (index >= 0) index += this.currentAction + 1; + if (index >= 0) index += this.editCount + 1; return index; } @@ -129,10 +129,10 @@ export function Logging(Base: TBase) { if (!this.canUndo) return false; this.dispatchEvent( newActionEvent( - invert((this.history[this.currentAction]).action) + invert((this.history[this.editCount]).action) ) ); - this.currentAction = this.previousAction; + this.editCount = this.previousAction; return true; } redo(): boolean { @@ -140,14 +140,14 @@ export function Logging(Base: TBase) { this.dispatchEvent( newActionEvent((this.history[this.nextAction]).action) ); - this.currentAction = this.nextAction; + this.editCount = this.nextAction; return true; } private onLog(le: LogEvent): void { if (le.detail.kind === 'reset') { this.history = []; - this.currentAction = -1; + this.editCount = -1; return; } @@ -160,7 +160,7 @@ export function Logging(Base: TBase) { if (entry.action.derived) return; entry.action.derived = true; if (this.nextAction !== -1) this.history.splice(this.nextAction); - this.currentAction = this.history.length; + this.editCount = this.history.length; } this.history.push(entry); @@ -210,7 +210,7 @@ export function Logging(Base: TBase) { class="${entry.kind}" graphic="icon" ?twoline=${!!entry.message} - ?activated=${this.currentAction == history.length - index - 1} + ?activated=${this.editCount == history.length - index - 1} > diff --git a/src/Plugging.ts b/src/Plugging.ts index 8ef0461b4..54fdee0af 100644 --- a/src/Plugging.ts +++ b/src/Plugging.ts @@ -25,7 +25,7 @@ import { ifImplemented, Mixin } from './foundation.js'; import { EditingElement } from './Editing.js'; import { officialPlugins } from '../public/js/plugins.js'; import { Nsdoc } from './foundation/nsdoc.js'; - +import { LoggingElement } from './Logging.js'; const pluginTags = new Map(); /** * Hashes `uri` using cyrb64 analogous to @@ -176,9 +176,9 @@ const loadedPlugins = new Set(); /** Mixin that manages Plugins in `localStorage` */ export type PluggingElement = Mixin; -export function Plugging EditingElement>( - Base: TBase -) { +export function Plugging< + TBase extends new (...args: any[]) => EditingElement & LoggingElement +>(Base: TBase) { class PluggingElement extends Base { // DIRTY HACK: will refactored with open-scd-core nsdoc!: Nsdoc; @@ -289,6 +289,7 @@ export function Plugging EditingElement>( content: staticTagHtml`<${tag} .doc=${this.doc} .docName=${this.docName} + .editCount=${this.editCount} .docId=${this.docId} .pluginId=${plugin.src} .nsdoc=${this.nsdoc} diff --git a/src/Waiting.ts b/src/Waiting.ts index 45a73c28c..912dd0c39 100644 --- a/src/Waiting.ts +++ b/src/Waiting.ts @@ -1,6 +1,6 @@ import { html, property, TemplateResult } from 'lit-element'; -import '@material/mwc-circular-progress-four-color'; +import '@material/mwc-linear-progress'; import { LitElementConstructor, @@ -41,10 +41,10 @@ export function Waiting(Base: TBase) { render(): TemplateResult { return html`${ifImplemented(super.render())} - `; + >`; } } diff --git a/src/compas/Compasing.ts b/src/compas/Compasing.ts index 1b4dd3863..b4a83c1f7 100644 --- a/src/compas/Compasing.ts +++ b/src/compas/Compasing.ts @@ -1,4 +1,4 @@ -import { html, query, state, TemplateResult } from 'lit-element'; +import { html, query, state, property, TemplateResult } from 'lit-element'; import { Mixin } from '../foundation.js'; import { EditingElement } from '../Editing.js'; @@ -49,6 +49,9 @@ export function Compasing EditingElement>( @state() private expiredSessionMessage: number = 15 * 60 * 1000; + @property({ type: Number }) + editCount = -1; + @query('compas-session-expiring-dialog') private expiringDialogElement!: CompasSessionExpiringDialogElement; @@ -145,6 +148,7 @@ export function Compasing EditingElement>( diff --git a/src/editors/Cleanup.ts b/src/editors/Cleanup.ts index 2a28ccff6..629651184 100644 --- a/src/editors/Cleanup.ts +++ b/src/editors/Cleanup.ts @@ -13,13 +13,15 @@ export default class Cleanup extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property() doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; render(): TemplateResult { return html`
- - - + + +
`; } diff --git a/src/editors/Communication.ts b/src/editors/Communication.ts index e7bb1f020..876f2f654 100644 --- a/src/editors/Communication.ts +++ b/src/editors/Communication.ts @@ -17,6 +17,8 @@ export default class CommunicationPlugin extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property() doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; /** * Creates the Communication Element and returns the created Element @@ -37,7 +39,8 @@ export default class CommunicationPlugin extends LitElement { /** Opens a [[`WizardDialog`]] for creating a new `SubNetwork` element. */ private openCreateSubNetworkWizard(): void { - const parent =this.doc.querySelector(':root > Communication') || + const parent = + this.doc.querySelector(':root > Communication') || this.createCommunication(); this.dispatchEvent(newWizardEvent(createSubNetworkWizard(parent!))); @@ -68,6 +71,7 @@ export default class CommunicationPlugin extends LitElement { .map( subnetwork => html`` diff --git a/src/editors/GooseSubscriberDataBinding.ts b/src/editors/GooseSubscriberDataBinding.ts index 4f42f386f..10b29be7d 100644 --- a/src/editors/GooseSubscriberDataBinding.ts +++ b/src/editors/GooseSubscriberDataBinding.ts @@ -9,6 +9,8 @@ import './subscription/later-binding/ext-ref-ln-binding-list.js'; export default class GooseSubscribeDataBindingPlugin extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @property() nsdoc!: Nsdoc; @@ -19,12 +21,14 @@ export default class GooseSubscribeDataBindingPlugin extends LitElement { class="column" controlTag="GSEControl" .includeLaterBinding="${false}" + .editCount=${this.editCount} .doc="${this.doc}" > diff --git a/src/editors/GooseSubscriberLaterBinding.ts b/src/editors/GooseSubscriberLaterBinding.ts index c50a5312e..c77bc1f75 100644 --- a/src/editors/GooseSubscriberLaterBinding.ts +++ b/src/editors/GooseSubscriberLaterBinding.ts @@ -7,6 +7,8 @@ import './subscription/later-binding/ext-ref-later-binding-list.js'; export default class GooseSubscribeLaterBindingPlugin extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; render(): TemplateResult { return html`
@@ -15,13 +17,13 @@ export default class GooseSubscribeLaterBindingPlugin extends LitElement { class="column" controlTag="GSEControl" .includeLaterBinding="${true}" - .doc="${this.doc}" + .editCount=${this.editCount} .doc="${this.doc}" >
diff --git a/src/editors/GooseSubscriberMessageBinding.ts b/src/editors/GooseSubscriberMessageBinding.ts index 76d96e908..31128d220 100644 --- a/src/editors/GooseSubscriberMessageBinding.ts +++ b/src/editors/GooseSubscriberMessageBinding.ts @@ -25,6 +25,8 @@ export default class GooseSubscriberMessageBindingPlugin extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property() doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @query('#goosePublisherView') goosePublisherView!: RadioListItem; @@ -75,14 +77,20 @@ export default class GooseSubscriberMessageBindingPlugin extends LitElement {
${view == View.PUBLISHER - ? html`` + ? html`` : html``}
diff --git a/src/editors/IED.ts b/src/editors/IED.ts index 3bdd5e8db..2f239e9b9 100644 --- a/src/editors/IED.ts +++ b/src/editors/IED.ts @@ -32,6 +32,8 @@ export default class IedPlugin extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property() doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; /** All the nsdoc files that are being uploaded via the settings. */ @property() @@ -175,6 +177,7 @@ export default class IedPlugin extends LitElement { -
- - this.listDiv.dispatchEvent(newViewEvent(View.VALUES))} - > - - - this.listDiv.dispatchEvent(newViewEvent(View.NETWORK))} - > - -
- ${selectedViewProtocol104Plugin == View.VALUES - ? html `` - : html `` - } -
+ return html`
+
+ + + this.listDiv.dispatchEvent(newViewEvent(View.VALUES))} + > + + + + this.listDiv.dispatchEvent(newViewEvent(View.NETWORK))} + > + +
+ ${selectedViewProtocol104Plugin == View.VALUES + ? html`` + : html``}
-
`; +
+ `; } static styles = css` @@ -93,5 +101,5 @@ export default class Communication104Plugin extends LitElement { section { padding: 8px 12px 16px; } - `; + `; } diff --git a/src/editors/Publisher.ts b/src/editors/Publisher.ts index 552cea2c4..656dbc25a 100644 --- a/src/editors/Publisher.ts +++ b/src/editors/Publisher.ts @@ -21,6 +21,8 @@ export default class PublisherPlugin extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @state() private publisherType: 'Report' | 'GOOSE' | 'SampledValue' | 'DataSet' = @@ -55,24 +57,28 @@ export default class PublisherPlugin extends LitElement { > diff --git a/src/editors/SMVSubscriberLaterBinding.ts b/src/editors/SMVSubscriberLaterBinding.ts index 5c6f9ad34..f8d5be3c0 100644 --- a/src/editors/SMVSubscriberLaterBinding.ts +++ b/src/editors/SMVSubscriberLaterBinding.ts @@ -7,6 +7,8 @@ import './subscription/later-binding/ext-ref-later-binding-list.js'; export default class SMVSubscribeLaterBindingPlugin extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; render(): TemplateResult { return html`
@@ -15,13 +17,13 @@ export default class SMVSubscribeLaterBindingPlugin extends LitElement { class="column" controlTag="SampledValueControl" .includeLaterBinding="${true}" - .doc="${this.doc}" + .editCount=${this.editCount} .doc="${this.doc}" >
diff --git a/src/editors/SMVSubscriberMessageBinding.ts b/src/editors/SMVSubscriberMessageBinding.ts index e135804ae..f5ec0856c 100644 --- a/src/editors/SMVSubscriberMessageBinding.ts +++ b/src/editors/SMVSubscriberMessageBinding.ts @@ -23,6 +23,8 @@ export default class SMVSubscriberMessageBindingPlugin extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property() doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @query('#smvPublisherView') smvPublisherView!: RadioListItem; @@ -73,13 +75,22 @@ export default class SMVSubscriberMessageBindingPlugin extends LitElement {
${view == View.PUBLISHER - ? html`` + ? html`` : html``} - +
`; } diff --git a/src/editors/Substation.ts b/src/editors/Substation.ts index c23ca9f1c..297fd562a 100644 --- a/src/editors/Substation.ts +++ b/src/editors/Substation.ts @@ -12,6 +12,8 @@ export default class SubstationPlugin extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property() doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; /** Opens a [[`WizardDialog`]] for creating a new `Substation` element. */ openCreateSubstationWizard(): void { @@ -20,7 +22,10 @@ export default class SubstationPlugin extends LitElement { } render(): TemplateResult { - return html` + return html` ${!this.doc?.querySelector( ':root > Substation, :root > Line, :root > Process' ) diff --git a/src/editors/Templates.ts b/src/editors/Templates.ts index 92d89767a..d0a2ea7f2 100644 --- a/src/editors/Templates.ts +++ b/src/editors/Templates.ts @@ -53,6 +53,8 @@ export default class TemplatesPlugin extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; async openCreateLNodeTypeWizard(): Promise { this.createDataTypeTemplates(); diff --git a/src/editors/communication/subnetwork-editor.ts b/src/editors/communication/subnetwork-editor.ts index 8ba1a0076..57f35ae4c 100644 --- a/src/editors/communication/subnetwork-editor.ts +++ b/src/editors/communication/subnetwork-editor.ts @@ -26,6 +26,8 @@ import { wizards } from '../../wizards/wizard-library.js'; export class SubNetworkEditor extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; /** SCL element SubNetwork */ @property({ attribute: false }) element!: Element; @@ -85,6 +87,7 @@ export class SubNetworkEditor extends LitElement { ).map( smv => html`` @@ -99,6 +102,7 @@ export class SubNetworkEditor extends LitElement { ).map( gse => html`` diff --git a/src/editors/ied/access-point-container.ts b/src/editors/ied/access-point-container.ts index 6951600e9..f306fba96 100644 --- a/src/editors/ied/access-point-container.ts +++ b/src/editors/ied/access-point-container.ts @@ -9,7 +9,6 @@ import { } from 'lit-element'; import { nothing } from 'lit-html'; import { translate } from 'lit-translate'; -import { wizards } from '../../wizards/wizard-library.js'; import { getDescriptionAttribute, @@ -85,6 +84,7 @@ export class AccessPointContainer extends Container { ${Array.from(this.element.querySelectorAll(':scope > Server')).map( server => html` ${lnElements.map( ln => html` html` html` html` AccessPoint')).map( ap => html` html` html` html` { return html` - + `; })}`; diff --git a/src/editors/protocol104/subnetwork-container.ts b/src/editors/protocol104/subnetwork-container.ts index 08144bb3a..32d422d9b 100644 --- a/src/editors/protocol104/subnetwork-container.ts +++ b/src/editors/protocol104/subnetwork-container.ts @@ -52,6 +52,7 @@ export class SubNetwork104Container extends Base104Container { class="${connectedAP.parentElement !== this.element ? 'disabled' : ''}" + .editCount=${this.editCount} .doc="${this.doc}" .element=${connectedAP} >` diff --git a/src/editors/protocol104/values-container.ts b/src/editors/protocol104/values-container.ts index 68433d690..346deaee1 100644 --- a/src/editors/protocol104/values-container.ts +++ b/src/editors/protocol104/values-container.ts @@ -56,6 +56,7 @@ export class Values104Container extends Base104Container { return html` ${ieds.map(iedElement => { return html``; diff --git a/src/editors/publisher/gse-control-editor.ts b/src/editors/publisher/gse-control-editor.ts index ec5264a2e..19f71a450 100644 --- a/src/editors/publisher/gse-control-editor.ts +++ b/src/editors/publisher/gse-control-editor.ts @@ -29,6 +29,8 @@ export class GseControlEditor extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @state() selectedGseControl?: Element; @@ -81,6 +83,7 @@ export class GseControlEditor extends LitElement { .element=${this.selectedDataSet!} > diff --git a/src/editors/publisher/report-control-editor.ts b/src/editors/publisher/report-control-editor.ts index 4d8e0e2ca..3aa580a75 100644 --- a/src/editors/publisher/report-control-editor.ts +++ b/src/editors/publisher/report-control-editor.ts @@ -29,6 +29,8 @@ export class ReportControlEditor extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @state() selectedReportControl?: Element; @@ -83,10 +85,12 @@ export class ReportControlEditor extends LitElement { if (this.selectedReportControl !== undefined) return html`
diff --git a/src/editors/publisher/sampled-value-control-editor.ts b/src/editors/publisher/sampled-value-control-editor.ts index 5cc332bd3..ae68c94d9 100644 --- a/src/editors/publisher/sampled-value-control-editor.ts +++ b/src/editors/publisher/sampled-value-control-editor.ts @@ -29,6 +29,8 @@ export class SampledValueControlEditor extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({type: Number}) + editCount = -1; @state() selectedSampledValueControl?: Element; @@ -88,6 +90,7 @@ export class SampledValueControlEditor extends LitElement { .element=${this.selectedDataSet!} > diff --git a/src/editors/subscription/fcda-binding-list.ts b/src/editors/subscription/fcda-binding-list.ts index 6187044ae..3ec10122c 100644 --- a/src/editors/subscription/fcda-binding-list.ts +++ b/src/editors/subscription/fcda-binding-list.ts @@ -54,6 +54,8 @@ type iconLookup = Record; export class FcdaBindingList extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @property() controlTag!: controlTag; @property() diff --git a/src/editors/subscription/goose/goose-list.ts b/src/editors/subscription/goose/goose-list.ts index cb296193a..422274216 100644 --- a/src/editors/subscription/goose/goose-list.ts +++ b/src/editors/subscription/goose/goose-list.ts @@ -37,6 +37,8 @@ addEventListener('open-doc', onOpenDocResetSelectedGooseMsg); export class GooseList extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; private onSelect(gseControl: Element): void { if (gseControl == selectedGseControl) return; @@ -103,6 +105,7 @@ export class GooseList extends LitElement { noninteractive graphic="icon" value="${Array.from(ied.querySelectorAll('GSEControl')) + .filter(cb => cb.hasAttribute('datSet')) .map(element => { const id = identity(element) as string; return typeof id === 'string' ? id : ''; @@ -117,7 +120,9 @@ export class GooseList extends LitElement { ied.querySelectorAll( ':scope > AccessPoint > Server > LDevice > LN0 > GSEControl' ) - ).map(control => this.renderGoose(control))} + ) + .filter(cb => cb.hasAttribute('datSet')) + .map(control => this.renderGoose(control))} ` )} diff --git a/src/editors/subscription/goose/subscriber-list.ts b/src/editors/subscription/goose/subscriber-list.ts index 877f1cd8c..7600fb1d1 100644 --- a/src/editors/subscription/goose/subscriber-list.ts +++ b/src/editors/subscription/goose/subscriber-list.ts @@ -54,6 +54,8 @@ let view: View = View.PUBLISHER; export class SubscriberList extends SubscriberListContainer { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; /** Current selected GOOSE message (when in GOOSE Publisher view) */ currentSelectedGseControl: Element | undefined; @@ -90,47 +92,49 @@ export class SubscriberList extends SubscriberListContainer { `LN0 > Inputs, LN > Inputs` ); - this.doc.querySelectorAll('GSEControl').forEach(control => { - const ied = control.closest('IED')!; + Array.from(this.doc.querySelectorAll('GSEControl')) + .filter(cb => cb.hasAttribute('datSet')) + .forEach(control => { + const ied = control.closest('IED')!; - if ( - ied.getAttribute('name') == - this.currentSelectedIed?.getAttribute('name') - ) - return; - - /** If no Inputs is available, it's automatically available. */ - if (subscribedInputs.length == 0) { - this.availableElements.push({ element: control }); - return; - } + if ( + ied.getAttribute('name') == + this.currentSelectedIed?.getAttribute('name') + ) + return; - let numberOfLinkedExtRefs = 0; - const dataSet = ied.querySelector( - `DataSet[name="${control.getAttribute('datSet')}"]` - ); + /** If no Inputs is available, it's automatically available. */ + if (subscribedInputs.length == 0) { + this.availableElements.push({ element: control }); + return; + } + + let numberOfLinkedExtRefs = 0; + const dataSet = ied.querySelector( + `DataSet[name="${control.getAttribute('datSet')}"]` + ); - if (!dataSet) return; + if (!dataSet) return; - dataSet!.querySelectorAll('FCDA').forEach(fcda => { - subscribedInputs.forEach(inputs => { - if (getExtRef(inputs, fcda, this.currentSelectedGseControl)) { - numberOfLinkedExtRefs++; - } + dataSet!.querySelectorAll('FCDA').forEach(fcda => { + subscribedInputs.forEach(inputs => { + if (getExtRef(inputs, fcda, control)) { + numberOfLinkedExtRefs++; + } + }); }); - }); - if (numberOfLinkedExtRefs == 0) { - this.availableElements.push({ element: control }); - return; - } + if (numberOfLinkedExtRefs == 0) { + this.availableElements.push({ element: control }); + return; + } - if (numberOfLinkedExtRefs >= dataSet!.querySelectorAll('FCDA').length) { - this.subscribedElements.push({ element: control }); - } else { - this.availableElements.push({ element: control, partial: true }); - } - }); + if (numberOfLinkedExtRefs >= dataSet!.querySelectorAll('FCDA').length) { + this.subscribedElements.push({ element: control }); + } else { + this.availableElements.push({ element: control, partial: true }); + } + }); this.requestUpdate(); } diff --git a/src/editors/subscription/ied-list.ts b/src/editors/subscription/ied-list.ts index fd8b48400..b5fbb6ce5 100644 --- a/src/editors/subscription/ied-list.ts +++ b/src/editors/subscription/ied-list.ts @@ -26,6 +26,8 @@ addEventListener('open-doc', onOpenDocResetSelectedGooseMsg); export class IedList extends LitElement { @property() doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @property({ type: String }) serviceType?: 'goose' | 'smv'; @@ -46,7 +48,9 @@ export class IedList extends LitElement { render(): TemplateResult { return html`
-

${translate(`subscription.${this.serviceType}.subscriber.iedListTitle`)}

+

+ ${translate(`subscription.${this.serviceType}.subscriber.iedListTitle`)} +

${getOrderedIeds(this.doc).map( ied => diff --git a/src/editors/subscription/later-binding/ext-ref-later-binding-list.ts b/src/editors/subscription/later-binding/ext-ref-later-binding-list.ts index 14d936bd6..3b3c0a2ba 100644 --- a/src/editors/subscription/later-binding/ext-ref-later-binding-list.ts +++ b/src/editors/subscription/later-binding/ext-ref-later-binding-list.ts @@ -47,6 +47,8 @@ import { export class ExtRefLaterBindingList extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @property() controlTag!: 'SampledValueControl' | 'GSEControl'; diff --git a/src/editors/subscription/later-binding/ext-ref-ln-binding-list.ts b/src/editors/subscription/later-binding/ext-ref-ln-binding-list.ts index a156b4dc8..c7b1ca825 100644 --- a/src/editors/subscription/later-binding/ext-ref-ln-binding-list.ts +++ b/src/editors/subscription/later-binding/ext-ref-ln-binding-list.ts @@ -12,7 +12,6 @@ import { get, translate } from 'lit-translate'; import { ComplexAction, - Create, createElement, Delete, identity, @@ -44,6 +43,8 @@ import { emptyInputsDeleteActions } from '../../../foundation/ied.js'; export class ExtRefLnBindingList extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @property() nsdoc!: Nsdoc; @property() diff --git a/src/editors/subscription/sampledvalues/smv-list.ts b/src/editors/subscription/sampledvalues/smv-list.ts index fd244e3c2..8da41fc03 100644 --- a/src/editors/subscription/sampledvalues/smv-list.ts +++ b/src/editors/subscription/sampledvalues/smv-list.ts @@ -37,6 +37,8 @@ addEventListener('open-doc', onOpenDocResetSelectedSmvMsg); export class SmvPublisherList extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; private onSelect(smvControl: Element) { const ln = smvControl.parentElement; @@ -99,6 +101,7 @@ export class SmvPublisherList extends LitElement { noninteractive graphic="icon" value="${Array.from(ied.querySelectorAll('SampledValueControl')) + .filter(cb => cb.hasAttribute('datSet')) .map(element => { const id = identity(element) as string; return typeof id === 'string' ? id : ''; @@ -113,7 +116,9 @@ export class SmvPublisherList extends LitElement { ied.querySelectorAll( ':scope > AccessPoint > Server > LDevice > LN0 > SampledValueControl' ) - ).map(control => this.renderSmv(control))} + ) + .filter(cb => cb.hasAttribute('datSet')) + .map(control => this.renderSmv(control))} ` )} diff --git a/src/editors/subscription/sampledvalues/subscriber-list.ts b/src/editors/subscription/sampledvalues/subscriber-list.ts index 28ec6da6e..2ebe04875 100644 --- a/src/editors/subscription/sampledvalues/subscriber-list.ts +++ b/src/editors/subscription/sampledvalues/subscriber-list.ts @@ -54,6 +54,8 @@ let view: View = View.PUBLISHER; export class SubscriberList extends SubscriberListContainer { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; /** Current selected Sampled Values element (when in GOOSE Publisher view) */ currentSelectedSmvControl: Element | undefined; @@ -90,47 +92,49 @@ export class SubscriberList extends SubscriberListContainer { `LN0 > Inputs, LN > Inputs` ); - this.doc.querySelectorAll('SampledValueControl').forEach(control => { - const ied = control.closest('IED')!; + Array.from(this.doc.querySelectorAll('SampledValueControl')) + .filter(cb => cb.hasAttribute('datSet')) + .forEach(control => { + const ied = control.closest('IED')!; - if ( - ied.getAttribute('name') == - this.currentSelectedIed?.getAttribute('name') - ) - return; - - /** If no Inputs is available, it's automatically available. */ - if (subscribedInputs.length == 0) { - this.availableElements.push({ element: control }); - return; - } + if ( + ied.getAttribute('name') == + this.currentSelectedIed?.getAttribute('name') + ) + return; - let numberOfLinkedExtRefs = 0; - const dataSet = ied.querySelector( - `DataSet[name="${control.getAttribute('datSet')}"]` - ); + /** If no Inputs is available, it's automatically available. */ + if (subscribedInputs.length == 0) { + this.availableElements.push({ element: control }); + return; + } - if (!dataSet) return; + let numberOfLinkedExtRefs = 0; + const dataSet = ied.querySelector( + `DataSet[name="${control.getAttribute('datSet')}"]` + ); + + if (!dataSet) return; - dataSet!.querySelectorAll('FCDA').forEach(fcda => { - subscribedInputs.forEach(inputs => { - if (getExtRef(inputs, fcda, this.currentSelectedSmvControl)) { - numberOfLinkedExtRefs++; - } + dataSet!.querySelectorAll('FCDA').forEach(fcda => { + subscribedInputs.forEach(inputs => { + if (getExtRef(inputs, fcda, this.currentSelectedSmvControl)) { + numberOfLinkedExtRefs++; + } + }); }); - }); - if (numberOfLinkedExtRefs == 0) { - this.availableElements.push({ element: control }); - return; - } + if (numberOfLinkedExtRefs == 0) { + this.availableElements.push({ element: control }); + return; + } - if (numberOfLinkedExtRefs >= dataSet!.querySelectorAll('FCDA').length) { - this.subscribedElements.push({ element: control }); - } else { - this.availableElements.push({ element: control, partial: true }); - } - }); + if (numberOfLinkedExtRefs >= dataSet!.querySelectorAll('FCDA').length) { + this.subscribedElements.push({ element: control }); + } else { + this.availableElements.push({ element: control, partial: true }); + } + }); this.requestUpdate(); } diff --git a/src/editors/substation/bay-editor.ts b/src/editors/substation/bay-editor.ts index 15817c6d9..e44f2b217 100644 --- a/src/editors/substation/bay-editor.ts +++ b/src/editors/substation/bay-editor.ts @@ -54,6 +54,8 @@ export class BayEditor extends LitElement { /** The document being edited as provided to editor by [[`Zeroline`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({type: Number}) + editCount = -1; @property({ attribute: false }) element!: Element; @property({ type: Boolean }) @@ -132,6 +134,7 @@ export class BayEditor extends LitElement { ${lNodes.map( lNode => html`` @@ -147,6 +150,7 @@ export class BayEditor extends LitElement { return html` ${functions.map( fUnction => html` ${ieds.map( ied => - html`` + html`` )}
` : html``; @@ -239,6 +247,7 @@ export class BayEditor extends LitElement { ).map( pwt => html` html` html`` @@ -119,6 +122,7 @@ export class ConductingEquipmentEditor extends LitElement { return html` ${eqFunctions.map( eqFunction => html` html`` diff --git a/src/editors/substation/eq-function-editor.ts b/src/editors/substation/eq-function-editor.ts index 83687201b..57ed5d1fe 100644 --- a/src/editors/substation/eq-function-editor.ts +++ b/src/editors/substation/eq-function-editor.ts @@ -45,6 +45,8 @@ export class EqFunctionEditor extends LitElement { /** The document being edited as provided to editor by [[`Zeroline`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; /** The edited `EqFunction` element */ @property({ attribute: false }) element!: Element; @@ -99,6 +101,7 @@ export class EqFunctionEditor extends LitElement { ${lNodes.map( lNode => html`` @@ -115,6 +118,7 @@ export class EqFunctionEditor extends LitElement { return html` ${eqSubFunctions.map( eqSubFunction => html` html`` @@ -112,6 +115,7 @@ export class EqSubFunctionEditor extends LitElement { return html` ${eqSubFunctions.map( eqSubFunction => html`` diff --git a/src/editors/substation/foundation.ts b/src/editors/substation/foundation.ts index d0f65baec..116c6ad56 100644 --- a/src/editors/substation/foundation.ts +++ b/src/editors/substation/foundation.ts @@ -556,6 +556,7 @@ export function getIcon(condEq: Element): TemplateResult { } /** * Creates a general-equipment template literal. + * FIXME(ca-d): this cannot update since it is not a LitElement instance method. * @param doc - Project xml document. * @param element - scl general-equipment element. * @param showfunctions - Whether rendered as action pane (true). @@ -564,7 +565,7 @@ export function getIcon(condEq: Element): TemplateResult { export function renderGeneralEquipment( doc: XMLDocument, element: Element, - showfunctions: Boolean + showfunctions: boolean ): TemplateResult { const generalEquipment = getChildElementsByTagName( element, diff --git a/src/editors/substation/function-editor.ts b/src/editors/substation/function-editor.ts index 66a8c942a..abe4da81c 100644 --- a/src/editors/substation/function-editor.ts +++ b/src/editors/substation/function-editor.ts @@ -24,7 +24,6 @@ import { emptyWizard, wizards } from '../../wizards/wizard-library.js'; import { Menu } from '@material/mwc-menu'; import { ListItem } from '@material/mwc-list/mwc-list-item'; import { IconButton } from '@material/mwc-icon-button'; -import { classMap } from 'lit-html/directives/class-map.js'; import { renderGeneralEquipment } from './foundation.js'; function childTags(element: Element | null | undefined): SCLTag[] { @@ -41,6 +40,8 @@ export class FunctionEditor extends LitElement { /** The document being edited as provided to editor by [[`Zeroline`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({type: Number}) + editCount = -1; /** The edited `Function` element */ @property({ attribute: false }) element!: Element; @@ -95,7 +96,7 @@ export class FunctionEditor extends LitElement { ${lNodes.map( lNode => html`` )} @@ -108,7 +109,7 @@ export class FunctionEditor extends LitElement { return html` ${subfunctions.map( subFunction => html`` diff --git a/src/editors/substation/general-equipment-editor.ts b/src/editors/substation/general-equipment-editor.ts index 3812d84ad..cf6e951f8 100644 --- a/src/editors/substation/general-equipment-editor.ts +++ b/src/editors/substation/general-equipment-editor.ts @@ -44,6 +44,8 @@ function childTags(element: Element | null | undefined): SCLTag[] { export class GeneralEquipmentEditor extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @property({ attribute: false }) element!: Element; @@ -100,6 +102,7 @@ export class GeneralEquipmentEditor extends LitElement { ${lNodes.map( lNode => html`` @@ -115,6 +118,7 @@ export class GeneralEquipmentEditor extends LitElement { ? html`${eFunctions.map( eFunction => html` ` diff --git a/src/editors/substation/line-editor.ts b/src/editors/substation/line-editor.ts index b70a24061..1c16fe6ed 100644 --- a/src/editors/substation/line-editor.ts +++ b/src/editors/substation/line-editor.ts @@ -47,6 +47,8 @@ export class LineEditor extends LitElement { /** The document being edited as provided to editor by [[`Zeroline`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; /** SCL element Line */ @property({ attribute: false }) element!: Element; @@ -84,6 +86,7 @@ export class LineEditor extends LitElement { return html` ${ConductingEquipments.map( ConductingEquipment => html` html` html` html`` diff --git a/src/editors/substation/powertransformer-editor.ts b/src/editors/substation/powertransformer-editor.ts index 73e397513..a23f0c153 100644 --- a/src/editors/substation/powertransformer-editor.ts +++ b/src/editors/substation/powertransformer-editor.ts @@ -50,6 +50,8 @@ export class PowerTransformerEditor extends LitElement { /** The document being edited as provided to editor by [[`Zeroline`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; /** SCL element PowerTransformer */ @property({ attribute: false }) element!: Element; @@ -108,6 +110,7 @@ export class PowerTransformerEditor extends LitElement { ${lNodes.map( lNode => html`` @@ -123,6 +126,7 @@ export class PowerTransformerEditor extends LitElement { return html` ${eqFunctions.map( eqFunction => html` html`` @@ -229,6 +234,7 @@ export class PowerTransformerEditor extends LitElement { ${transformerWindings.map( transformerWindings => html` html` html` html` html` html` html` html`` diff --git a/src/editors/substation/sub-equipment-editor.ts b/src/editors/substation/sub-equipment-editor.ts index ce1fac03d..1a2f2f4ca 100644 --- a/src/editors/substation/sub-equipment-editor.ts +++ b/src/editors/substation/sub-equipment-editor.ts @@ -44,6 +44,8 @@ export class SubEquipmentEditor extends LitElement { /** The document being edited as provided to editor by [[`Zeroline`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; /** SCL element SubEquipment */ @property({ attribute: false }) element!: Element; @@ -115,6 +117,7 @@ export class SubEquipmentEditor extends LitElement { ${lNodes.map( lNode => html`` @@ -129,6 +132,7 @@ export class SubEquipmentEditor extends LitElement { ? html` ${eqFunctions.map( eqFunction => html`` diff --git a/src/editors/substation/sub-function-editor.ts b/src/editors/substation/sub-function-editor.ts index 5e43e133c..9d08b1591 100644 --- a/src/editors/substation/sub-function-editor.ts +++ b/src/editors/substation/sub-function-editor.ts @@ -28,7 +28,6 @@ import { tags, } from '../../foundation.js'; import { emptyWizard, wizards } from '../../wizards/wizard-library.js'; -import { classMap } from 'lit-html/directives/class-map.js'; import { renderGeneralEquipment } from './foundation.js'; function childTags(element: Element | null | undefined): SCLTag[] { @@ -45,6 +44,8 @@ export class SubFunctionEditor extends LitElement { /** The document being edited as provided to editor by [[`Zeroline`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; /** The edited `SubFunction` element */ @property({ attribute: false }) element!: Element; @@ -99,6 +100,7 @@ export class SubFunctionEditor extends LitElement { ${lNodes.map( lNode => html`` @@ -112,6 +114,7 @@ export class SubFunctionEditor extends LitElement { return html` ${subfunctions.map( subFunction => html` html`` @@ -148,6 +151,7 @@ export class SubstationEditor extends LitElement { return html` ${functions.map( fUnction => html` ${ieds.map( ied => - html`` + html`` )} ` : html``; @@ -183,6 +191,7 @@ export class SubstationEditor extends LitElement { ${pwts.map( pwt => html` html` html`` @@ -113,6 +116,7 @@ export class TapChangerEditor extends LitElement { return html` ${eqFunctions.map( eqFunction => html` html`` diff --git a/src/editors/substation/transformer-winding-editor.ts b/src/editors/substation/transformer-winding-editor.ts index f00e4d02a..29d8b1edd 100644 --- a/src/editors/substation/transformer-winding-editor.ts +++ b/src/editors/substation/transformer-winding-editor.ts @@ -47,6 +47,8 @@ export class TransformerWindingEditor extends LitElement { /** The document being edited as provided to editor by [[`Zeroline`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({type: Number}) + editCount = -1; /** SCL element TransformerWinding */ @property({ attribute: false }) element!: Element; @@ -111,7 +113,7 @@ export class TransformerWindingEditor extends LitElement { ${lNodes.map( lNode => html`` )} @@ -126,7 +128,7 @@ export class TransformerWindingEditor extends LitElement { ? html` ${eqFunctions.map( eqFunction => html`` @@ -141,7 +143,7 @@ export class TransformerWindingEditor extends LitElement { ? html` ${tapChangers.map( tapChanger => html`` diff --git a/src/editors/substation/voltage-level-editor.ts b/src/editors/substation/voltage-level-editor.ts index 8c96a1e4b..744e80ccc 100644 --- a/src/editors/substation/voltage-level-editor.ts +++ b/src/editors/substation/voltage-level-editor.ts @@ -55,6 +55,8 @@ export class VoltageLevelEditor extends LitElement { /** The document being edited as provided to editor by [[`Zeroline`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @property({ attribute: false }) element!: Element; @property({ type: Boolean }) @@ -143,6 +145,7 @@ export class VoltageLevelEditor extends LitElement { ${lNodes.map( lNode => html`` @@ -158,6 +161,7 @@ export class VoltageLevelEditor extends LitElement { return html` ${functions.map( fUnction => html` ${ieds.map( ied => - html`` + html`` )} ` : html``; @@ -193,6 +201,7 @@ export class VoltageLevelEditor extends LitElement { ${pwts.map( pwt => html` ${Array.from(this.element?.querySelectorAll(selectors.Bay) ?? []).map( bay => html` ${ieds.map( ied => - html`` + html`` )} ` : html``; @@ -140,6 +146,7 @@ export class ZerolinePane extends LitElement { .map( substation => html` html` html` `, diff --git a/src/menu/CompasSave.ts b/src/menu/CompasSave.ts index c9a59fa7d..779dc4d33 100644 --- a/src/menu/CompasSave.ts +++ b/src/menu/CompasSave.ts @@ -25,6 +25,8 @@ export default class CompasSaveMenuPlugin extends LitElement { docName!: string; @property() docId?: string; + @property({ type: Number }) + editCount = -1; @query('mwc-dialog#compas-save-dlg') dialog!: Dialog; @@ -49,6 +51,7 @@ export default class CompasSaveMenuPlugin extends LitElement { .doc="${this.doc}" .docName="${this.docName}" .docId="${this.docId}" + .editCount=${this.editCount} @doc-saved=${() => { this.dialog.close(); }} diff --git a/src/menu/CompasSaveAs.ts b/src/menu/CompasSaveAs.ts index f5555e5b5..d02b23b27 100644 --- a/src/menu/CompasSaveAs.ts +++ b/src/menu/CompasSaveAs.ts @@ -23,6 +23,8 @@ export default class CompasSaveAsMenuPlugin extends LitElement { doc!: XMLDocument; @property() docName!: string; + @property({ type: Number }) + editCount = -1; @query('mwc-dialog#compas-save-as-dlg') dialog!: Dialog; @@ -46,6 +48,7 @@ export default class CompasSaveAsMenuPlugin extends LitElement { { this.dialog.close(); }} diff --git a/src/menu/CompasSaveAsVersion.ts b/src/menu/CompasSaveAsVersion.ts index 7e656d5b1..46c51e31d 100644 --- a/src/menu/CompasSaveAsVersion.ts +++ b/src/menu/CompasSaveAsVersion.ts @@ -33,6 +33,8 @@ export default class CompasSaveAsVersionMenuPlugin extends LitElement { doc!: XMLDocument; @property() docName!: string; + @property({ type: Number }) + editCount = -1; @state() private saveToDoc?: XMLDocument; @@ -110,6 +112,7 @@ export default class CompasSaveAsVersionMenuPlugin extends LitElement { .docName="${this.saveToDocName}" .docId="${this.saveToDocId}" .allowLocalFile="${false}" + .editCount=${this.editCount} @doc-saved=${() => { this.dialog.close(); }} diff --git a/src/menu/ExportCommunication.ts b/src/menu/ExportCommunication.ts index 9b11abc65..acb49fc45 100644 --- a/src/menu/ExportCommunication.ts +++ b/src/menu/ExportCommunication.ts @@ -49,6 +49,8 @@ export function saveXmlBlob( export default class ExportCommunication extends LitElement { /** The document being edited as provided to plugins by [[`OpenSCD`]]. */ @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @property({ attribute: false }) docName!: string; /** Entry point for this plug-in */ diff --git a/src/menu/ImportIEDs.ts b/src/menu/ImportIEDs.ts index c6e93f553..a1bb1edcc 100644 --- a/src/menu/ImportIEDs.ts +++ b/src/menu/ImportIEDs.ts @@ -377,6 +377,8 @@ function resetSelection(dialog: Dialog): void { export default class ImportingIedPlugin extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @state() importDoc?: XMLDocument; diff --git a/src/menu/SclHistory.ts b/src/menu/SclHistory.ts index b47f30a75..6797b9f54 100644 --- a/src/menu/SclHistory.ts +++ b/src/menu/SclHistory.ts @@ -17,6 +17,8 @@ import { Dialog } from '@material/mwc-dialog'; export default class SclHistoryPlugin extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @query('#historyLog') historyLog!: Dialog; diff --git a/src/menu/VirtualTemplateIED.ts b/src/menu/VirtualTemplateIED.ts index 8fa50e46a..a45a11491 100644 --- a/src/menu/VirtualTemplateIED.ts +++ b/src/menu/VirtualTemplateIED.ts @@ -109,6 +109,8 @@ function groupLNodesToFunctions( export default class VirtualTemplateIED extends LitElement { @property({ attribute: false }) doc!: XMLDocument; + @property({ type: Number }) + editCount = -1; @state() get isValidManufacturer(): boolean { const manufacturer = this.dialog?.querySelector( diff --git a/src/open-scd.ts b/src/open-scd.ts index 0c587bc32..c65c3e7aa 100644 --- a/src/open-scd.ts +++ b/src/open-scd.ts @@ -25,7 +25,7 @@ import { Compasing } from './compas/Compasing.js'; * Open Substation Configuration Designer. */ @customElement('open-scd') export class OpenSCD extends Compasing( - Hosting(Setting(Wizarding(Waiting(Plugging(Editing(Logging(LitElement))))))) + Waiting(Hosting(Setting(Wizarding(Plugging(Editing(Logging(LitElement))))))) ) { private currentSrc = ''; /** The current file's URL. `blob:` URLs are *revoked after parsing*! */ @@ -120,15 +120,21 @@ export class OpenSCD extends Compasing( margin-top: 16px; } - mwc-circular-progress-four-color { + mwc-linear-progress { position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - z-index: 99; + --mdc-theme-primary: var(--mdc-theme-secondary); + left: 0px; + top: 112px; + width: 100%; pointer-events: none; } + @media (max-width: 599px) { + mwc-linear-progress { + top: 104px; + } + } + tt { font-family: 'Roboto Mono', monospace; font-weight: 300; diff --git a/src/themes.ts b/src/themes.ts index 74b812711..845d6ecb5 100644 --- a/src/themes.ts +++ b/src/themes.ts @@ -37,11 +37,6 @@ export function getTheme(theme: Settings['theme']): TemplateResult { --mdc-dialog-heading-ink-color: var(--base00); - --mdc-circular-progress-bar-color-1: var(--mdc-theme-primary); - --mdc-circular-progress-bar-color-2: var(--mdc-theme-on-background); - --mdc-circular-progress-bar-color-3: var(--mdc-theme-secondary); - --mdc-circular-progress-bar-color-4: var(--mdc-theme-on-background); - --mdc-icon-font: 'Material Icons Outlined'; } diff --git a/test/integration/__snapshots__/open-scd.test.snap.js b/test/integration/__snapshots__/open-scd.test.snap.js index bba7c8e76..7f0f5cdfa 100644 --- a/test/integration/__snapshots__/open-scd.test.snap.js +++ b/test/integration/__snapshots__/open-scd.test.snap.js @@ -1511,13 +1511,6 @@ snapshots["open-scd looks like its snapshot"] = > - - + + `; /* end snapshot open-scd looks like its snapshot */ diff --git a/test/integration/editors/GooseSubscriberDataBinding.test.ts b/test/integration/editors/GooseSubscriberDataBinding.test.ts index 77430a706..eae5c221d 100644 --- a/test/integration/editors/GooseSubscriberDataBinding.test.ts +++ b/test/integration/editors/GooseSubscriberDataBinding.test.ts @@ -1,6 +1,7 @@ import { expect, fixture, html } from '@open-wc/testing'; import { Wizarding } from '../../../src/Wizarding.js'; import { Editing } from '../../../src/Editing.js'; +import { Logging } from '../../../src/Logging.js'; import { initializeNsdoc } from '../../../src/foundation/nsdoc.js'; import GooseSubscriberDataBinding from '../../../src/editors/GooseSubscriberDataBinding.js'; @@ -15,7 +16,7 @@ import { describe('GOOSE Subscribe Data Binding Plugin', async () => { customElements.define( 'goose-subscriber-data-binding-plugin', - Wizarding(Editing(GooseSubscriberDataBinding)) + Wizarding(Editing(Logging(GooseSubscriberDataBinding))) ); let element: GooseSubscriberDataBinding; @@ -45,8 +46,9 @@ describe('GOOSE Subscribe Data Binding Plugin', async () => { 'GOOSE_Publisher>>QB2_Disconnector>GOOSE1', 'GOOSE_Publisher>>QB2_Disconnector>GOOSE1sDataSet>QB1_Disconnector/ CSWI 1.Pos q (ST)' ); - await element.requestUpdate(); - await extRefListElement.requestUpdate(); + await element.updateComplete; + await extRefListElement.updateComplete; + await fcdaListElement.updateComplete; expect(extRefListElement['getSubscribedLNElements']().length).to.be.equal( 0 @@ -64,12 +66,16 @@ describe('GOOSE Subscribe Data Binding Plugin', async () => { 'mwc-list-item[value="GOOSE_Subscriber2>>Earth_Switch> XSWI 1"]' ) )).click(); - await element.requestUpdate(); + await element.updateComplete; + await extRefListElement.updateComplete; + await fcdaListElement.updateComplete; expect(extRefListElement['getSubscribedLNElements']().length).to.be.equal( 1 ); - expect(getSelectedSubItemValue(fcdaListElement)).to.have.text('1'); + expect(getSelectedSubItemValue(fcdaListElement)).to.exist.and.have.text( + '1' + ); expect(extRefListElement['getAvailableLNElements']().length).to.be.equal(7); expect( element.doc.querySelectorAll( @@ -87,8 +93,8 @@ describe('GOOSE Subscribe Data Binding Plugin', async () => { 'GOOSE_Publisher>>QB2_Disconnector>GOOSE2', 'GOOSE_Publisher>>QB2_Disconnector>GOOSE2sDataSet>QB2_Disconnector/ CSWI 1.Pos q (ST)' ); - await element.requestUpdate(); - await extRefListElement.requestUpdate(); + await element.updateComplete; + await extRefListElement.updateComplete; expect(extRefListElement['getSubscribedLNElements']().length).to.be.equal( 1 @@ -107,7 +113,7 @@ describe('GOOSE Subscribe Data Binding Plugin', async () => { 'mwc-list-item[value="GOOSE_Subscriber2>>Earth_Switch"]' ) )).click(); - await element.requestUpdate(); + await element.updateComplete; expect(extRefListElement['getSubscribedLNElements']().length).to.be.equal( 0 @@ -137,30 +143,30 @@ describe('GOOSE Subscribe Data Binding Plugin', async () => { 'GOOSE_Publisher>>QB2_Disconnector>GOOSE2', 'GOOSE_Publisher>>QB2_Disconnector>GOOSE2sDataSet>QB2_Disconnector/ CSWI 1.Pos q (ST)' ); - await element.requestUpdate(); - await extRefListElement.requestUpdate(); + await element.updateComplete; + await extRefListElement.updateComplete; (( extRefListElement.shadowRoot!.querySelector( 'mwc-list-item[value="GOOSE_Subscriber2>>Earth_Switch"]' ) )).click(); - await element.requestUpdate(); + await element.updateComplete; selectFCDAItem( fcdaListElement, 'GOOSE_Publisher>>QB2_Disconnector>GOOSE2', 'GOOSE_Publisher>>QB2_Disconnector>GOOSE2sDataSet>QB2_Disconnector/ CSWI 1.Pos stVal (ST)' ); - await element.requestUpdate(); - await extRefListElement.requestUpdate(); + await element.updateComplete; + await extRefListElement.updateComplete; (( extRefListElement.shadowRoot!.querySelector( 'mwc-list-item[value="GOOSE_Subscriber2>>Earth_Switch"]' ) )).click(); - await element.requestUpdate(); + await element.updateComplete; expect( element.doc.querySelectorAll( diff --git a/test/integration/editors/GooseSubscriberLaterBinding.test.ts b/test/integration/editors/GooseSubscriberLaterBinding.test.ts index c95134aa1..ac3961d19 100644 --- a/test/integration/editors/GooseSubscriberLaterBinding.test.ts +++ b/test/integration/editors/GooseSubscriberLaterBinding.test.ts @@ -1,6 +1,7 @@ import { expect, fixture, html } from '@open-wc/testing'; import { Wizarding } from '../../../src/Wizarding.js'; import { Editing } from '../../../src/Editing.js'; +import { Logging } from '../../../src/Logging.js'; import GooseSubscriberLaterBinding from '../../../src/editors/GooseSubscriberLaterBinding.js'; import { @@ -14,7 +15,7 @@ import { ExtRefLaterBindingList } from '../../../src/editors/subscription/later- describe('GOOSE Subscribe Later Binding Plugin', () => { customElements.define( 'goose-subscriber-later-binding-plugin', - Wizarding(Editing(GooseSubscriberLaterBinding)) + Wizarding(Editing(Logging(GooseSubscriberLaterBinding))) ); let element: GooseSubscriberLaterBinding; diff --git a/test/integration/editors/GooseSubscriberMessageBinding.test.ts b/test/integration/editors/GooseSubscriberMessageBinding.test.ts index 353e8849e..c3c7e15ae 100644 --- a/test/integration/editors/GooseSubscriberMessageBinding.test.ts +++ b/test/integration/editors/GooseSubscriberMessageBinding.test.ts @@ -6,12 +6,13 @@ import { ListItem } from '@material/mwc-list/mwc-list-item.js'; import { Editing } from '../../../src/Editing.js'; import { Wizarding } from '../../../src/Wizarding.js'; +import { Logging } from '../../../src/Logging.js'; import GooseSubscriberMessageBindingPlugin from '../../../src/editors/GooseSubscriberMessageBinding.js'; describe('GOOSE subscriber plugin', () => { customElements.define( 'subscription-plugin', - Wizarding(Editing(GooseSubscriberMessageBindingPlugin)) + Wizarding(Editing(Logging(GooseSubscriberMessageBindingPlugin))) ); let element: GooseSubscriberMessageBindingPlugin; let doc: XMLDocument; @@ -50,14 +51,15 @@ describe('GOOSE subscriber plugin', () => { }); describe('with a selected GOOSE message', () => { - const nthGSEControl = 2; + const nthGSEControl = 1; let fCDAs: Element[]; let gseControlBlock: Element; let goose: HTMLElement; beforeEach(async () => { - gseControlBlock = doc.querySelectorAll('GSEControl')[nthGSEControl]; + gseControlBlock = + doc.querySelectorAll('GSEControl[datSet]')[nthGSEControl]; fCDAs = Array.from( gseControlBlock.parentElement?.querySelectorAll( `DataSet[name="${gseControlBlock.getAttribute('datSet')}"] > FCDA` diff --git a/test/integration/editors/SMVSubscriberDataBinding.test.ts b/test/integration/editors/SMVSubscriberDataBinding.test.ts index afe357844..3e8d80d48 100644 --- a/test/integration/editors/SMVSubscriberDataBinding.test.ts +++ b/test/integration/editors/SMVSubscriberDataBinding.test.ts @@ -11,11 +11,11 @@ import { getSelectedSubItemValue, selectFCDAItem, } from './test-support.js'; - +import { Logging } from '../../../src/Logging.js'; describe('SMV Subscribe Data Binding Plugin', async () => { customElements.define( 'smv-subscriber-data-binding-plugin', - Wizarding(Editing(SMVSubscriberDataBinding)) + Wizarding(Editing(Logging(SMVSubscriberDataBinding))) ); let element: SMVSubscriberDataBinding; diff --git a/test/integration/editors/SMVSubscriberLaterBinding.test.ts b/test/integration/editors/SMVSubscriberLaterBinding.test.ts index 9bfc6b9e3..2f69700d2 100644 --- a/test/integration/editors/SMVSubscriberLaterBinding.test.ts +++ b/test/integration/editors/SMVSubscriberLaterBinding.test.ts @@ -2,6 +2,7 @@ import { expect, fixture, html } from '@open-wc/testing'; import { Wizarding } from '../../../src/Wizarding.js'; import { Editing } from '../../../src/Editing.js'; +import { Logging } from '../../../src/Logging.js'; import SMVSubscribeLaterBindingPlugin from '../../../src/editors/SMVSubscriberLaterBinding.js'; import { @@ -15,7 +16,7 @@ import { ExtRefLaterBindingList } from '../../../src/editors/subscription/later- describe('SMV Subscribe Later Binding plugin', () => { customElements.define( 'smv-subscribe-later-binding-plugin', - Wizarding(Editing(SMVSubscribeLaterBindingPlugin)) + Wizarding(Editing(Logging(SMVSubscribeLaterBindingPlugin))) ); let element: SMVSubscribeLaterBindingPlugin; let doc: XMLDocument; diff --git a/test/integration/editors/SMVSubscriberMessageBinding.test.ts b/test/integration/editors/SMVSubscriberMessageBinding.test.ts index e2f7b0931..5d16b5465 100644 --- a/test/integration/editors/SMVSubscriberMessageBinding.test.ts +++ b/test/integration/editors/SMVSubscriberMessageBinding.test.ts @@ -4,13 +4,14 @@ import '../../mock-wizard.js'; import SMVSubscriberMessageBindingPlugin from '../../../src/editors/SMVSubscriberMessageBinding.js'; import { Editing } from '../../../src/Editing.js'; +import { Logging } from '../../../src/Logging.js'; import { Wizarding } from '../../../src/Wizarding.js'; import { ListItem } from '@material/mwc-list/mwc-list-item.js'; describe('Sampled Values Plugin', () => { customElements.define( 'smv-plugin', - Wizarding(Editing(SMVSubscriberMessageBindingPlugin)) + Wizarding(Editing(Logging(SMVSubscriberMessageBindingPlugin))) ); let element: SMVSubscriberMessageBindingPlugin; let doc: XMLDocument; diff --git a/test/integration/editors/__snapshots__/GooseSubscriberMessageBinding.test.snap.js b/test/integration/editors/__snapshots__/GooseSubscriberMessageBinding.test.snap.js index e1306fe71..2d3c512d9 100644 --- a/test/integration/editors/__snapshots__/GooseSubscriberMessageBinding.test.snap.js +++ b/test/integration/editors/__snapshots__/GooseSubscriberMessageBinding.test.snap.js @@ -27,6 +27,162 @@ snapshots["GOOSE subscriber plugin in Publisher view per default the plugin itse + + + + + + + + + + + + + [log.placeholder] + + + info + + + + + + + + + [close] + + + + + + + [diag.placeholder] + + + info + + + + + [close] + + + + + + + + + [log.snackbar.show] + + + + + + + [log.snackbar.show] + + + + + + + [log.snackbar.show] + + + + `; @@ -43,7 +199,7 @@ snapshots["GOOSE subscriber plugin in Publisher view per default the right hand graphic="icon" noninteractive="" tabindex="-1" - value="IED1>>CircuitBreaker_CB1>GCB IED1>>CircuitBreaker_CB1>GCB2" + value="IED1>>CircuitBreaker_CB1>GCB" > IED1 @@ -77,26 +233,6 @@ snapshots["GOOSE subscriber plugin in Publisher view per default the right hand > - - - - - GCB2 - - - IED4 @@ -194,26 +330,6 @@ snapshots["GOOSE subscriber plugin in Publisher view per default the right hand > - - - - - GCB2 - - - `; @@ -547,7 +663,7 @@ snapshots["GOOSE subscriber plugin in Publisher view with a selected GOOSE messa aria-selected="false" graphic="avatar" mwc-list-item="" - tabindex="-1" + tabindex="0" > IED1 @@ -615,7 +731,7 @@ snapshots["GOOSE subscriber plugin in Publisher view with a selected GOOSE messa graphic="avatar" hasmeta="" mwc-list-item="" - tabindex="-1" + tabindex="0" > IED1 @@ -732,6 +848,162 @@ snapshots["GOOSE subscriber plugin in Subscriber view per default the plugin its + + + + + + + + + + + + + [log.placeholder] + + + info + + + + + + + + + [close] + + + + + + + [diag.placeholder] + + + info + + + + + [close] + + + + + + + + + [log.snackbar.show] + + + + + + + [log.snackbar.show] + + + + + + + [log.snackbar.show] + + + + `; @@ -856,7 +1128,7 @@ snapshots["GOOSE subscriber plugin in Subscriber view with a selected IED the le aria-disabled="false" noninteractive="" tabindex="-1" - value="IED1>>CircuitBreaker_CB1>GCB" + value="" > [subscription.subscriber.partiallySubscribed] @@ -870,21 +1142,18 @@ snapshots["GOOSE subscriber plugin in Subscriber view with a selected IED the le - GCB (IED1) + [subscription.none] - - add - [subscription.subscriber.availableToSubscribe] @@ -895,6 +1164,19 @@ snapshots["GOOSE subscriber plugin in Subscriber view with a selected IED the le role="separator" > + + + GCB (IED1) + + + add + + @@ -1193,8 +1474,10 @@ snapshots["GOOSE subscriber plugin in Subscriber view with a selected IED for pa diff --git a/test/integration/editors/__snapshots__/SMVSubscriberMessageBinding.test.snap.js b/test/integration/editors/__snapshots__/SMVSubscriberMessageBinding.test.snap.js index 69ab0b7e5..57786c37a 100644 --- a/test/integration/editors/__snapshots__/SMVSubscriberMessageBinding.test.snap.js +++ b/test/integration/editors/__snapshots__/SMVSubscriberMessageBinding.test.snap.js @@ -27,6 +27,162 @@ snapshots["Sampled Values Plugin in Publisher view initially the plugin looks li + + + + + + + + + + + + + [log.placeholder] + + + info + + + + + + + + + [close] + + + + + + + [diag.placeholder] + + + info + + + + + [close] + + + + + + + + + [log.snackbar.show] + + + + + + + [log.snackbar.show] + + + + + + + [log.snackbar.show] + + + + `; @@ -333,8 +489,10 @@ snapshots["Sampled Values Plugin in Publisher view when selecting a Sampled Valu IED2 @@ -360,6 +518,7 @@ snapshots["Sampled Values Plugin in Publisher view when selecting a Sampled Valu [subscription.none] @@ -430,8 +591,10 @@ snapshots["Sampled Values Plugin in Publisher view when selecting a Sampled Valu > [subscription.none] @@ -454,6 +617,7 @@ snapshots["Sampled Values Plugin in Publisher view when selecting a Sampled Valu IED2 @@ -560,9 +726,12 @@ snapshots["Sampled Values Plugin in Publisher view when selecting a Sampled Valu IED4 @@ -593,8 +762,10 @@ snapshots["Sampled Values Plugin in Publisher view when selecting a Sampled Valu > [subscription.none] @@ -663,6 +834,162 @@ snapshots["Sampled Values Plugin in Subscriber view initially the plugin looks l + + + + + + + + + + + + + [log.placeholder] + + + info + + + + + + + + + [close] + + + + + + + [diag.placeholder] + + + info + + + + + [close] + + + + + + + + + [log.snackbar.show] + + + + + + + [log.snackbar.show] + + + + + + + [log.snackbar.show] + + + + `; @@ -871,7 +1198,7 @@ snapshots["Sampled Values Plugin in Subscriber view when selecting an IED and su aria-disabled="false" graphic="avatar" mwc-list-item="" - tabindex="-1" + tabindex="0" > MSVCB01 (IED3) @@ -926,7 +1253,7 @@ snapshots["Sampled Values Plugin in Subscriber view when selecting an IED and su graphic="avatar" mwc-list-item="" selected="" - tabindex="0" + tabindex="-1" > MSVCB02 (IED4) @@ -964,8 +1291,10 @@ snapshots["Sampled Values Plugin in Subscriber view when selecting an IED and un > [subscription.none] @@ -1026,8 +1355,10 @@ snapshots["Sampled Values Plugin in Subscriber view when selecting an IED and un MSVCB02 (IED4) @@ -1065,8 +1396,11 @@ snapshots["Sampled Values Plugin in Subscriber view when selecting an IED and su > MSVCB02 (IED4) @@ -1091,8 +1425,10 @@ snapshots["Sampled Values Plugin in Subscriber view when selecting an IED and su > [subscription.none] diff --git a/test/integration/editors/substation/__snapshots__/voltage-level-editor-wizarding.test.snap.js b/test/integration/editors/substation/__snapshots__/voltage-level-editor-wizarding.test.snap.js index a82401ea4..155b014d4 100644 --- a/test/integration/editors/substation/__snapshots__/voltage-level-editor-wizarding.test.snap.js +++ b/test/integration/editors/substation/__snapshots__/voltage-level-editor-wizarding.test.snap.js @@ -27,7 +27,6 @@ snapshots["voltage-level-editor wizarding integration looks like the latest snap helper="[voltagelevel.wizard.nomFreqHelper]" label="nomFreq" nullable="" - pattern="[+]?[0-9]+(([.][0-9]*)?|([.][0-9]+))" required="" suffix="Hz" validationmessage="[textfield.nonempty]" @@ -49,7 +48,6 @@ snapshots["voltage-level-editor wizarding integration looks like the latest snap helper="[voltagelevel.wizard.voltageHelper]" label="Voltage" nullable="" - pattern="[+-]?[0-9]+(([.][0-9]*)?|([.][0-9]+))" required="" unit="V" validationmessage="[textfield.nonempty]" diff --git a/test/integration/editors/substation/voltage-level-editor-wizarding.test.ts b/test/integration/editors/substation/voltage-level-editor-wizarding.test.ts index 8e492f219..a98779412 100644 --- a/test/integration/editors/substation/voltage-level-editor-wizarding.test.ts +++ b/test/integration/editors/substation/voltage-level-editor-wizarding.test.ts @@ -6,6 +6,7 @@ import { MockWizard } from '../../../mock-wizard.js'; import '../../../../src/editors/substation/voltage-level-editor.js'; import { regexString, regExp, inverseRegExp } from '../../../foundation.js'; +import { patterns } from '../../../../src/foundation.js'; describe('voltage-level-editor wizarding integration', () => { let doc: XMLDocument; @@ -33,7 +34,28 @@ describe('voltage-level-editor wizarding integration', () => { await parent.updateComplete; }); it('looks like the latest snapshot', async () => { - await expect(parent.wizardUI.dialog).to.equalSnapshot(); + await expect(parent.wizardUI.dialog).to.equalSnapshot({ + ignoreAttributes: [ + { tags: ['wizard-textfield'], attributes: ['pattern'] }, + ], + }); + }); + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + expect( + parent.wizardUI.dialog!.querySelectorAll('wizard-textfield[pattern]') + .length + ).to.equal(2); + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')![0] + .getAttribute('pattern') + ).to.equal(patterns.unsigned); + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')![1] + .getAttribute('pattern') + ).to.equal(patterns.decimal); }); describe('the first input element', () => { it('edits the attribute name', async () => { diff --git a/test/integration/editors/templates/__snapshots__/datype-wizarding.test.snap.js b/test/integration/editors/templates/__snapshots__/datype-wizarding.test.snap.js index 03479c096..69e2fb7c3 100644 --- a/test/integration/editors/templates/__snapshots__/datype-wizarding.test.snap.js +++ b/test/integration/editors/templates/__snapshots__/datype-wizarding.test.snap.js @@ -583,7 +583,6 @@ snapshots["DAType wizards defines a createDATypeWizard looks like the latest sna label="id" maxlength="255" minlength="1" - pattern="([:_A-Za-z]|[À-Ö]|[Ø-ö]|[ø-˿]|[Ͱ-ͽ]|[Ϳ-῿]|[‌-‍]|[⁰-↏]|[Ⰰ-⿯]|[、-퟿]|[豈-﷏]|[ﷰ-�]|[.0-9-]|·|[̀-ͯ]|[‿-⁀])+" required="" > @@ -592,7 +591,6 @@ snapshots["DAType wizards defines a createDATypeWizard looks like the latest sna helper="[scl.desc]" label="desc" nullable="" - pattern="([ -~]|[…]|[ -퟿]|[-�])*" > @@ -666,7 +664,6 @@ snapshots["DAType wizards defines a dATypeWizard looks like the latest snapshot" label="id" maxlength="127" minlength="1" - pattern="([:_A-Za-z]|[À-Ö]|[Ø-ö]|[ø-˿]|[Ͱ-ͽ]|[Ϳ-῿]|[‌-‍]|[⁰-↏]|[Ⰰ-⿯]|[、-퟿]|[豈-﷏]|[ﷰ-�]|[.0-9-]|·|[̀-ͯ]|[‿-⁀])+" required="" > @@ -675,7 +672,6 @@ snapshots["DAType wizards defines a dATypeWizard looks like the latest snapshot" helper="[scl.desc]" label="desc" nullable="" - pattern="([ -~]|[…]|[ -퟿]|[-�])*" > diff --git a/test/integration/editors/templates/__snapshots__/enumtype-wizarding.test.snap.js b/test/integration/editors/templates/__snapshots__/enumtype-wizarding.test.snap.js index 487c91dc0..acc499b92 100644 --- a/test/integration/editors/templates/__snapshots__/enumtype-wizarding.test.snap.js +++ b/test/integration/editors/templates/__snapshots__/enumtype-wizarding.test.snap.js @@ -1335,7 +1335,6 @@ snapshots["EnumType wizards defines a createEnumTypeWizard looks like the latest label="id" maxlength="127" minlength="1" - pattern="([:_A-Za-z]|[À-Ö]|[Ø-ö]|[ø-˿]|[Ͱ-ͽ]|[Ϳ-῿]|[‌-‍]|[⁰-↏]|[Ⰰ-⿯]|[、-퟿]|[豈-﷏]|[ﷰ-�]|[.0-9-]|·|[̀-ͯ]|[‿-⁀])+" required="" > @@ -1344,7 +1343,6 @@ snapshots["EnumType wizards defines a createEnumTypeWizard looks like the latest helper="[scl.desc]" label="desc" nullable="" - pattern="([ -~]|[…]|[ -퟿]|[-�])*" > @@ -1418,7 +1416,6 @@ snapshots["EnumType wizards defines an eNumTypeEditWizard looks like the latest label="id" maxlength="127" minlength="1" - pattern="([:_A-Za-z]|[À-Ö]|[Ø-ö]|[ø-˿]|[Ͱ-ͽ]|[Ϳ-῿]|[‌-‍]|[⁰-↏]|[Ⰰ-⿯]|[、-퟿]|[豈-﷏]|[ﷰ-�]|[.0-9-]|·|[̀-ͯ]|[‿-⁀])+" required="" > @@ -1427,7 +1424,6 @@ snapshots["EnumType wizards defines an eNumTypeEditWizard looks like the latest helper="[scl.desc]" label="desc" nullable="" - pattern="([ -~]|[…]|[ -퟿]|[-�])*" > diff --git a/test/integration/editors/templates/__snapshots__/lnodetype-wizard.test.snap.js b/test/integration/editors/templates/__snapshots__/lnodetype-wizard.test.snap.js index b681c20c0..17a711b4d 100644 --- a/test/integration/editors/templates/__snapshots__/lnodetype-wizard.test.snap.js +++ b/test/integration/editors/templates/__snapshots__/lnodetype-wizard.test.snap.js @@ -53,7 +53,6 @@ snapshots["LNodeType wizards defines a lNodeTypeHelperWizard looks like the late label="id" maxlength="127" minlength="1" - pattern="([:_A-Za-z]|[À-Ö]|[Ø-ö]|[ø-˿]|[Ͱ-ͽ]|[Ϳ-῿]|[‌-‍]|[⁰-↏]|[Ⰰ-⿯]|[、-퟿]|[豈-﷏]|[ﷰ-�]|[.0-9-]|·|[̀-ͯ]|[‿-⁀])+" required="" > @@ -62,13 +61,11 @@ snapshots["LNodeType wizards defines a lNodeTypeHelperWizard looks like the late helper="[scl.desc]" label="desc" nullable="" - pattern="([ -~]|[…]|[ -퟿]|[-�])*" > @@ -4319,7 +4316,6 @@ snapshots["LNodeType wizards defines a createLNodeTypeWizard looks like the late label="id" maxlength="127" minlength="1" - pattern="([:_A-Za-z]|[À-Ö]|[Ø-ö]|[ø-˿]|[Ͱ-ͽ]|[Ϳ-῿]|[‌-‍]|[⁰-↏]|[Ⰰ-⿯]|[、-퟿]|[豈-﷏]|[ﷰ-�]|[.0-9-]|·|[̀-ͯ]|[‿-⁀])+" required="" > @@ -4328,7 +4324,6 @@ snapshots["LNodeType wizards defines a createLNodeTypeWizard looks like the late helper="[scl.desc]" label="desc" nullable="" - pattern="([ -~]|[…]|[ -퟿]|[-�])*" > diff --git a/test/integration/editors/templates/datype-wizarding.test.ts b/test/integration/editors/templates/datype-wizarding.test.ts index 4b829d0fa..83a81f154 100644 --- a/test/integration/editors/templates/datype-wizarding.test.ts +++ b/test/integration/editors/templates/datype-wizarding.test.ts @@ -9,6 +9,7 @@ import { Select } from '@material/mwc-select'; import { FilteredList } from '../../../../src/filtered-list.js'; import { WizardTextField } from '../../../../src/wizard-textfield.js'; import TemplatesPlugin from '../../../../src/editors/Templates.js'; +import { patterns } from '../../../../src/foundation.js'; describe('DAType wizards', () => { if (customElements.get('templates-editor') === undefined) @@ -64,7 +65,38 @@ describe('DAType wizards', () => { }); it('looks like the latest snapshot', async () => { - await expect(parent.wizardUI.dialog).to.equalSnapshot(); + await expect(parent.wizardUI.dialog).to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + const pattern = + '([:_A-Za-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]' + + '|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]' + + '|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[.0-9\\-]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])+'; + expect( + parent.wizardUI.dialog!.querySelectorAll('wizard-textfield[pattern]')! + .length + ).to.equal(2); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[0] + .getAttribute('pattern') + ).to.equal(pattern); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); }); it('allows to add empty DATypes to the project', async () => { @@ -140,7 +172,38 @@ describe('DAType wizards', () => { }); it('looks like the latest snapshot', async () => { - await expect(parent.wizardUI.dialog).to.equalSnapshot(); + await expect(parent.wizardUI.dialog).to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + const pattern = + '([:_A-Za-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]' + + '|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]' + + '|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[.0-9\\-]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])+'; + expect( + parent.wizardUI.dialog!.querySelectorAll('wizard-textfield[pattern]')! + .length + ).to.equal(2); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[0] + .getAttribute('pattern') + ).to.equal(pattern); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); }); it('edits DAType attributes id', async () => { expect(doc.querySelector('DAType[id="Dummy.LLN0.Mod.SBOw"]')).to.exist; diff --git a/test/integration/editors/templates/enumtype-wizarding.test.ts b/test/integration/editors/templates/enumtype-wizarding.test.ts index 340e7ab33..24db4625e 100644 --- a/test/integration/editors/templates/enumtype-wizarding.test.ts +++ b/test/integration/editors/templates/enumtype-wizarding.test.ts @@ -9,6 +9,7 @@ import { Select } from '@material/mwc-select'; import { FilteredList } from '../../../../src/filtered-list.js'; import TemplatesPlugin from '../../../../src/editors/Templates.js'; import { WizardTextField } from '../../../../src/wizard-textfield.js'; +import { patterns } from '../../../../src/foundation.js'; describe('EnumType wizards', () => { if (customElements.get('templates-editor') === undefined) @@ -64,7 +65,38 @@ describe('EnumType wizards', () => { }); it('looks like the latest snapshot', async () => { - await expect(parent.wizardUI.dialog).to.equalSnapshot(); + await expect(parent.wizardUI.dialog).to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + const pattern = + '([:_A-Za-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]' + + '|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]' + + '|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[.0-9\\-]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])+'; + expect( + parent.wizardUI.dialog!.querySelectorAll('wizard-textfield[pattern]')! + .length + ).to.equal(2); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[0] + .getAttribute('pattern') + ).to.equal(pattern); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); }); it('allows to add empty EnumType to the project', async () => { @@ -127,7 +159,38 @@ describe('EnumType wizards', () => { }); it('looks like the latest snapshot', async () => { - await expect(parent.wizardUI.dialog).to.equalSnapshot(); + await expect(parent.wizardUI.dialog).to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + const pattern = + '([:_A-Za-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]' + + '|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]' + + '|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[.0-9\\-]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])+'; + expect( + parent.wizardUI.dialog!.querySelectorAll('wizard-textfield[pattern]')! + .length + ).to.equal(2); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[0] + .getAttribute('pattern') + ).to.equal(pattern); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); }); it('edits EnumType attributes id', async () => { diff --git a/test/integration/editors/templates/lnodetype-wizard.test.ts b/test/integration/editors/templates/lnodetype-wizard.test.ts index 5af51cb7c..187ba82ee 100644 --- a/test/integration/editors/templates/lnodetype-wizard.test.ts +++ b/test/integration/editors/templates/lnodetype-wizard.test.ts @@ -10,6 +10,7 @@ import { FilteredList } from '../../../../src/filtered-list.js'; import TemplatesPlugin from '../../../../src/editors/Templates.js'; import { WizardTextField } from '../../../../src/wizard-textfield.js'; import { WizardCheckbox } from '../../../../src/wizard-checkbox.js'; +import { patterns } from '../../../../src/foundation.js'; describe('LNodeType wizards', () => { if (customElements.get('templates-editor') === undefined) @@ -63,8 +64,46 @@ describe('LNodeType wizards', () => { }); it('looks like the latest snapshot', async () => { - await expect(parent.wizardUI.dialog).to.equalSnapshot(); + await expect(parent.wizardUI.dialog).to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + const pattern = + '([:_A-Za-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]' + + '|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]' + + '|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[.0-9\\-]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])+'; + expect( + parent.wizardUI.dialog!.querySelectorAll('wizard-textfield[pattern]')! + .length + ).to.equal(3); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[0] + .getAttribute('pattern') + ).to.equal(pattern); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[2] + .getAttribute('pattern') + ).to.equal(patterns.lnClass); }); + it('edits LNodeType attributes id', async () => { expect(doc.querySelector('LNodeType[id="Dummy.CSWI"]')).to.exist; idField.value = 'changedLNodeType'; @@ -121,7 +160,38 @@ describe('LNodeType wizards', () => { }); it('looks like the latest snapshot', async () => { - await expect(parent.wizardUI.dialog).to.equalSnapshot(); + await expect(parent.wizardUI.dialog).to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + const pattern = + '([:_A-Za-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]' + + '|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]' + + '|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[.0-9\\-]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])+'; + expect( + parent.wizardUI.dialog!.querySelectorAll('wizard-textfield[pattern]')! + .length + ).to.equal(2); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[0] + .getAttribute('pattern') + ).to.equal(pattern); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); }); it('uses -7-4 and -7-420 namespace for lnClass suggestion', () => diff --git a/test/integration/open-scd.test.ts b/test/integration/open-scd.test.ts index 3589dde8b..0135a0f75 100644 --- a/test/integration/open-scd.test.ts +++ b/test/integration/open-scd.test.ts @@ -62,7 +62,7 @@ describe('open-scd', () => { it('renders a progress indicator on `waiting`', async () => { const progressBar = element.shadowRoot!.querySelector( - 'mwc-circular-progress-four-color[indeterminate]' + 'mwc-linear-progress[indeterminate]' ); expect(progressBar).property('closed').to.be.true; element.waiting = true; diff --git a/test/unit/Logging.test.ts b/test/unit/Logging.test.ts index b611d7bbe..a5722af23 100644 --- a/test/unit/Logging.test.ts +++ b/test/unit/Logging.test.ts @@ -44,8 +44,8 @@ describe('LoggingElement', () => { it('has no previous action', () => expect(element).to.have.property('previousAction', -1)); - it('has no current action', () => - expect(element).to.have.property('currentAction', -1)); + it('has no edit count', () => + expect(element).to.have.property('editCount', -1)); it('has no next action', () => expect(element).to.have.property('nextAction', -1)); @@ -118,8 +118,8 @@ describe('LoggingElement', () => { it('has no previous action', () => expect(element).to.have.property('previousAction', -1)); - it('has a current action', () => - expect(element).to.have.property('currentAction', 0)); + it('has an edit count', () => + expect(element).to.have.property('editCount', 0)); it('has no next action', () => expect(element).to.have.property('nextAction', -1)); @@ -138,7 +138,7 @@ describe('LoggingElement', () => { it('can reset its history', () => { element.dispatchEvent(newLogEvent({ kind: 'reset' })); expect(element).property('history').to.be.empty; - expect(element).to.have.property('currentAction', -1); + expect(element).to.have.property('editCount', -1); }); it('renders a log message for the action', () => @@ -163,8 +163,8 @@ describe('LoggingElement', () => { it('has a previous action', () => expect(element).to.have.property('previousAction', 0)); - it('has a current action', () => - expect(element).to.have.property('currentAction', 2)); + it('has an edit count', () => + expect(element).to.have.property('editCount', 2)); it('has no next action', () => expect(element).to.have.property('nextAction', -1)); @@ -173,8 +173,8 @@ describe('LoggingElement', () => { it('has no previous action', () => expect(element).to.have.property('previousAction', -1)); - it('has a current action', () => - expect(element).to.have.property('currentAction', 0)); + it('has an edit count', () => + expect(element).to.have.property('editCount', 0)); it('has a next action', () => expect(element).to.have.property('nextAction', 2)); @@ -189,7 +189,7 @@ describe('LoggingElement', () => { }) ); expect(element).property('history').to.have.lengthOf(3); - expect(element).to.have.property('currentAction', 2); + expect(element).to.have.property('editCount', 2); expect(element).to.have.property('nextAction', -1); }); @@ -205,8 +205,8 @@ describe('LoggingElement', () => { it('has a previous action', () => expect(element).to.have.property('previousAction', 0)); - it('has a current action', () => - expect(element).to.have.property('currentAction', 2)); + it('has an edit count', () => + expect(element).to.have.property('editCount', 2)); it('has no next action', () => expect(element).to.have.property('nextAction', -1)); diff --git a/test/unit/Plugging.test.ts b/test/unit/Plugging.test.ts index c3dadee45..3bdc035b5 100644 --- a/test/unit/Plugging.test.ts +++ b/test/unit/Plugging.test.ts @@ -9,7 +9,10 @@ describe('PluggingElement', () => { let element: MockPlugger; let doc: XMLDocument; - afterEach(() => localStorage.clear()); + afterEach(async () => { + await new Promise(resolve => setTimeout(resolve, 50)); // await animation + localStorage.clear(); + }); beforeEach(async () => { doc = await fetch('/test/testfiles/valid2007B4.scd') .then(response => response.text()) @@ -161,6 +164,7 @@ describe('PluggingElement', () => { await name.updateComplete; primaryAction.click(); await element.updateComplete; + expect( element.menuEntries[element.menuEntries.length - 1] ).to.have.property('requireDoc'); diff --git a/test/unit/editors/protocol104/wizards/__snapshots__/address.test.snap.js b/test/unit/editors/protocol104/wizards/__snapshots__/address.test.snap.js index ded0020ce..fac74b0ac 100644 --- a/test/unit/editors/protocol104/wizards/__snapshots__/address.test.snap.js +++ b/test/unit/editors/protocol104/wizards/__snapshots__/address.test.snap.js @@ -715,7 +715,6 @@ snapshots["Wizards for 104 Address Element edit 104 Address with scale fields lo helper="[protocol104.wizard.scaleMultiplierHelper]" label="scaleMultiplier" nullable="" - pattern="[+-]?[0-9]+(([.][0-9]*)?|([.][0-9]+))" > diff --git a/test/unit/editors/protocol104/wizards/__snapshots__/subnetwork.test.snap.js b/test/unit/editors/protocol104/wizards/__snapshots__/subnetwork.test.snap.js index 980854242..1d1850184 100644 --- a/test/unit/editors/protocol104/wizards/__snapshots__/subnetwork.test.snap.js +++ b/test/unit/editors/protocol104/wizards/__snapshots__/subnetwork.test.snap.js @@ -27,14 +27,12 @@ snapshots["SubNetwork 104 wizard include an create wizard that looks like the la helper="[subnetwork.wizard.typeHelper]" label="type" nullable="" - pattern="([ -~]|[…]|[ -퟿]|[-�])*" > { }); it('looks like the latest snapshot', async () => { - await expect(element.wizardUI.dialog).dom.to.equalSnapshot(); + await expect(element.wizardUI.dialog).dom.to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + const decimal_pattern = '[+\\-]?[0-9]+(([.][0-9]*)?|([.][0-9]+))'; + + expect( + element.wizardUI.dialog!.querySelectorAll('wizard-textfield[pattern]')! + .length + ).to.equal(2); + + expect( + element.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[0] + .getAttribute('pattern') + ).to.equal(decimal_pattern); + + expect( + element.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(decimal_pattern); }); }); diff --git a/test/unit/editors/protocol104/wizards/subnetwork.test.ts b/test/unit/editors/protocol104/wizards/subnetwork.test.ts index c53d9bb57..6d4ba8473 100644 --- a/test/unit/editors/protocol104/wizards/subnetwork.test.ts +++ b/test/unit/editors/protocol104/wizards/subnetwork.test.ts @@ -9,6 +9,7 @@ import { isCreate, WizardInputElement, Create, + patterns, } from '../../../../../src/foundation.js'; import { createSubNetworkWizard } from '../../../../../src/editors/protocol104/wizards/subnetwork.js'; @@ -50,7 +51,34 @@ describe('SubNetwork 104 wizard', () => { }); it('looks like the latest snapshot', async () => { - await expect(element.wizardUI.dialog).dom.to.equalSnapshot(); + await expect(element.wizardUI.dialog).dom.to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + expect( + element.wizardUI.dialog!.querySelectorAll('wizard-textfield[pattern]')! + .length + ).to.equal(2); + + expect( + element.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[0] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); + + expect( + element.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.decimal); }); it('does not allow creating SubNetwork with empty name attribute', async () => { diff --git a/test/unit/editors/subscription/goose/__snapshots__/goose-list.test.snap.js b/test/unit/editors/subscription/goose/__snapshots__/goose-list.test.snap.js index 7f6c7711c..fa38a5bdb 100644 --- a/test/unit/editors/subscription/goose/__snapshots__/goose-list.test.snap.js +++ b/test/unit/editors/subscription/goose/__snapshots__/goose-list.test.snap.js @@ -12,7 +12,7 @@ snapshots["goose-list looks like the latest snapshot with a document loaded"] = graphic="icon" noninteractive="" tabindex="-1" - value="IED1>>CircuitBreaker_CB1>GCB IED1>>CircuitBreaker_CB1>GCB2" + value="IED1>>CircuitBreaker_CB1>GCB" > IED1 @@ -46,26 +46,6 @@ snapshots["goose-list looks like the latest snapshot with a document loaded"] = > - - - - - GCB2 - - - { }); it('looks like the latest snapshot', async () => { - await expect(element.wizardUI.dialog).dom.to.equalSnapshot(); + await expect(element.wizardUI.dialog).dom.to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + expect( + element.wizardUI.dialog!.querySelectorAll( + 'wizard-textfield[pattern]' + )!.length + ).to.equal(2); + + expect( + element.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[0] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); + + expect( + element.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.decimal); }); it('does not edit any attributes with unchanged wizard inputs', async () => { @@ -190,7 +219,35 @@ describe('Wizards for SCL element SubNetwork', () => { }); it('looks like the latest snapshot', async () => { - await expect(element.wizardUI.dialog).dom.to.equalSnapshot(); + await expect(element.wizardUI.dialog).dom.to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + expect( + element.wizardUI.dialog!.querySelectorAll( + 'wizard-textfield[pattern]' + )!.length + ).to.equal(2); + + expect( + element.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[0] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); + + expect( + element.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.decimal); }); it('triggers an editor action to create a complete BitRate element', async () => { @@ -278,7 +335,34 @@ describe('Wizards for SCL element SubNetwork', () => { }); it('looks like the latest snapshot', async () => { - await expect(element.wizardUI.dialog).dom.to.equalSnapshot(); + await expect(element.wizardUI.dialog).dom.to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + //work around, because the escapes get removed in snapshot + it('should have correct pattern', async () => { + expect( + element.wizardUI.dialog!.querySelectorAll('wizard-textfield[pattern]')! + .length + ).to.equal(2); + + expect( + element.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[0] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); + + expect( + element.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.decimal); }); it('does not allow creating SubNetwork with empty name attribute', async () => {