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'; 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');