From 8c620eb97fb34a0a01e2ac21cefbb87950e5a6b4 Mon Sep 17 00:00:00 2001 From: danyill Date: Mon, 26 Jun 2023 20:57:54 +1200 Subject: [PATCH 1/4] fix(editors/subscription): Increase timeout for failing subscriber/fcda-binding-list test, closes #1257 (#1274) --- test/unit/editors/subscription/fcda-binding-list.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/editors/subscription/fcda-binding-list.test.ts b/test/unit/editors/subscription/fcda-binding-list.test.ts index 33ecc45e3..594821b6f 100644 --- a/test/unit/editors/subscription/fcda-binding-list.test.ts +++ b/test/unit/editors/subscription/fcda-binding-list.test.ts @@ -174,7 +174,7 @@ describe('fcda-binding-list', () => { (( element.actionsMenu!.querySelector('.filter-subscribed') ))!.click(); - await new Promise(resolve => setTimeout(resolve, 200)); // await animation + await new Promise(resolve => setTimeout(resolve, 300)); // await animation await element.updateComplete; element.actionsMenuIcon.click(); @@ -182,7 +182,7 @@ describe('fcda-binding-list', () => { (( element.actionsMenu!.querySelector('.filter-not-subscribed') ))!.click(); - await new Promise(resolve => setTimeout(resolve, 200)); // await animation + await new Promise(resolve => setTimeout(resolve, 300)); // await animation await element.updateComplete; const fcdaList = element.shadowRoot?.querySelector('filtered-list'); From baa9bdcd73bb6db9ab2956dfd58344bc8859262d Mon Sep 17 00:00:00 2001 From: danyill Date: Mon, 26 Jun 2023 22:47:15 +1200 Subject: [PATCH 2/4] fix(wizards/doTypes): Adjust regular expressions for v flag in template editor (#1273) fix(wizards/foundation): Escape limit regexes, closes #1271 --- src/wizards/foundation/limits.ts | 4 +- .../dotype-wizarding.test.snap.js | 10 -- .../templates/dotype-wizarding.test.ts | 137 +++++++++++++++++- 3 files changed, 135 insertions(+), 16 deletions(-) diff --git a/src/wizards/foundation/limits.ts b/src/wizards/foundation/limits.ts index 8096b637a..b7e66518c 100644 --- a/src/wizards/foundation/limits.ts +++ b/src/wizards/foundation/limits.ts @@ -3,7 +3,7 @@ const nameStartChar = '|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]' + '|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]'; const nameChar = - nameStartChar + '|[.0-9-]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040]'; + nameStartChar + '|[.0-9\\-]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040]'; const name = nameStartChar + '(' + nameChar + ')*'; const nmToken = '(' + nameChar + ')+'; @@ -17,7 +17,7 @@ export const patterns = { nmToken, names: name + '( ' + name + ')*', nmTokens: nmToken + '( ' + nmToken + ')*', - decimal: '[+-]?[0-9]+(([.][0-9]*)?|([.][0-9]+))', + decimal: '[+\\-]?[0-9]+(([.][0-9]*)?|([.][0-9]+))', unsigned: '[+]?[0-9]+(([.][0-9]*)?|([.][0-9]+))', alphanumericFirstUpperCase: '[A-Z][0-9,A-Z,a-z]*', asciName: '[A-Za-z][0-9,A-Z,a-z_]*', diff --git a/test/integration/editors/templates/__snapshots__/dotype-wizarding.test.snap.js b/test/integration/editors/templates/__snapshots__/dotype-wizarding.test.snap.js index c87158ebc..d05a9d404 100644 --- a/test/integration/editors/templates/__snapshots__/dotype-wizarding.test.snap.js +++ b/test/integration/editors/templates/__snapshots__/dotype-wizarding.test.snap.js @@ -679,7 +679,6 @@ snapshots["DOType wizards defines a createDOTypeWizard looks like the latest sna label="id" maxlength="127" minlength="1" - pattern="([:_A-Za-z]|[À-Ö]|[Ø-ö]|[ø-˿]|[Ͱ-ͽ]|[Ϳ-῿]|[‌-‍]|[⁰-↏]|[Ⰰ-⿯]|[、-퟿]|[豈-﷏]|[ﷰ-�]|[.0-9-]|·|[̀-ͯ]|[‿-⁀])+" required="" > @@ -688,13 +687,11 @@ snapshots["DOType wizards defines a createDOTypeWizard looks like the latest sna helper="[scl.desc]" label="desc" nullable="" - pattern="([ -~]|[…]|[ -퟿]|[-�])*" > @@ -783,7 +780,6 @@ snapshots["DOType wizards defines a dOTypeWizard looks like the latest snapshot" label="id" maxlength="127" minlength="1" - pattern="([:_A-Za-z]|[À-Ö]|[Ø-ö]|[ø-˿]|[Ͱ-ͽ]|[Ϳ-῿]|[‌-‍]|[⁰-↏]|[Ⰰ-⿯]|[、-퟿]|[豈-﷏]|[ﷰ-�]|[.0-9-]|·|[̀-ͯ]|[‿-⁀])+" required="" > @@ -792,13 +788,11 @@ snapshots["DOType wizards defines a dOTypeWizard looks like the latest snapshot" helper="[scl.desc]" label="desc" nullable="" - pattern="([ -~]|[…]|[ -퟿]|[-�])*" > @@ -1068,7 +1062,6 @@ snapshots["DOType wizards defines a sDOWizard to edit an existing SDO looks like dialoginitialfocus="" helper="[scl.name]" label="name" - pattern="[a-z][0-9A-Za-z]*" required="" > > @@ -1078,7 +1071,6 @@ snapshots["DOType wizards defines a sDOWizard to edit an existing SDO looks like helper="[scl.desc]" label="desc" nullable="" - pattern="([ -~]|[…]|[ -퟿]|[-�])*" > > @@ -1266,7 +1257,6 @@ snapshots["DOType wizards defines a sDOWizard to create a new SDO element looks helper="[scl.desc]" label="desc" nullable="" - pattern="([ -~]|[…]|[ -퟿]|[-�])*" > { if (customElements.get('templates-editor') === undefined) customElements.define('templates-editor', TemplatesPlugin); @@ -69,7 +71,41 @@ describe('DOType wizards', () => { }); it('looks like the latest snapshot', async () => { - await expect(parent.wizardUI.dialog).to.equalSnapshot(); + // prettier does not support escaping in regexes of the /v flag + await expect(parent.wizardUI.dialog).dom.to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + // work around, because the escapes get removed in snapshot by prettier + it('should have correct pattern', async () => { + 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(patterns.nmToken); + + 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.cdc); }); it('allows to add empty DOTypes to the project', async () => { @@ -171,7 +207,41 @@ describe('DOType wizards', () => { }); it('looks like the latest snapshot', async () => { - await expect(parent.wizardUI.dialog).to.equalSnapshot(); + // prettier does not support escaping in regexes of the /v flag + await expect(parent.wizardUI.dialog).dom.to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + // work around, because the escapes get removed in snapshot by prettier + it('should have correct pattern', async () => { + 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(patterns.nmToken); + + 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.normalizedString); }); it('edits DOType attributes id', async () => { @@ -242,8 +312,37 @@ describe('DOType wizards', () => { }); it('looks like the latest snapshot', async () => { - await expect(parent.wizardUI.dialog).to.equalSnapshot(); + // prettier does not support escaping in regexes of the /v flag + await expect(parent.wizardUI.dialog).dom.to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); + }); + + // work around, because the escapes get removed in snapshot by prettier + 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.tRestrName1stL); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); }); + it('edits SDO attributes name', async () => { expect(doc.querySelector('DOType[id="Dummy.WYE"] > SDO[name="phsA"]')).to .exist; @@ -330,8 +429,37 @@ describe('DOType wizards', () => { }); it('looks like the latest snapshot', async () => { - await expect(parent.wizardUI.dialog).to.equalSnapshot(); + // prettier does not support escaping in regexes of the /v flag + await expect(parent.wizardUI.dialog).dom.to.equalSnapshot({ + ignoreAttributes: [ + { + tags: ['wizard-textfield'], + attributes: ['pattern'], + }, + ], + }); }); + + // work around, because the escapes get removed in snapshot by prettier + 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.tRestrName1stL); + + expect( + parent.wizardUI + .dialog!.querySelectorAll('wizard-textfield[pattern]')[1] + .getAttribute('pattern') + ).to.equal(patterns.normalizedString); + }); + it('creates a new SDO element', async () => { expect( doc.querySelector( @@ -349,6 +477,7 @@ describe('DOType wizards', () => { ) ).to.exist; }); + it('creates yet another new SDO element', async () => { const name = 'newSDOElement2'; const desc = 'newSDOdesc'; From ebde77000373780dccfa6f345126732667be1c43 Mon Sep 17 00:00:00 2001 From: danyill Date: Thu, 29 Jun 2023 07:28:45 +1200 Subject: [PATCH 3/4] fix(open-scd): Make linear progress bar Github stylez, closes #1269 (#1276) fix(open-scd): Make linear progress bar Github stylez, closes #1269 --- src/open-scd.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/open-scd.ts b/src/open-scd.ts index 6c2f7900b..3afa2c861 100644 --- a/src/open-scd.ts +++ b/src/open-scd.ts @@ -121,17 +121,13 @@ export class OpenSCD extends Waiting( mwc-linear-progress { position: fixed; - --mdc-theme-primary: var(--mdc-theme-secondary); + --mdc-linear-progress-buffer-color: var(--primary); + --mdc-theme-primary: var(--secondary); left: 0px; - top: 112px; + top: 0px; width: 100%; pointer-events: none; - } - - @media (max-width: 599px) { - mwc-linear-progress { - top: 104px; - } + z-index: 1000; } tt { From 1df6842002891223cf7a58821494731c01be73a5 Mon Sep 17 00:00:00 2001 From: danyill Date: Sun, 2 Jul 2023 06:46:51 +1200 Subject: [PATCH 4/4] fix(editors/IED): Allow IEDs to be updated after edit count change (closes #1272) (#1275) Co-authored-by: cad --- src/editors/IED.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/editors/IED.ts b/src/editors/IED.ts index 2f239e9b9..196587751 100644 --- a/src/editors/IED.ts +++ b/src/editors/IED.ts @@ -96,7 +96,11 @@ export default class IedPlugin extends LitElement { super.updated(_changedProperties); // When the document is updated, we reset the selected IED. - if (_changedProperties.has('doc') || _changedProperties.has('nsdoc')) { + if ( + _changedProperties.has('doc') || + _changedProperties.has('editCount') || + _changedProperties.has('nsdoc') + ) { this.selectedIEDs = []; this.selectedLNClasses = [];