Skip to content

Commit

Permalink
Merge branch 'main' into issue-1264-communication-params-incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
danyill committed Jul 9, 2023
2 parents cbc33fb + 1df6842 commit fc846aa
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 27 deletions.
6 changes: 5 additions & 1 deletion src/editors/IED.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down
12 changes: 4 additions & 8 deletions src/open-scd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/wizards/foundation/limits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ')+';

Expand All @@ -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_]*',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
>
</wizard-textfield>
Expand All @@ -688,13 +687,11 @@ snapshots["DOType wizards defines a createDOTypeWizard looks like the latest sna
helper="[scl.desc]"
label="desc"
nullable=""
pattern="([ -~]|[…]|[ -퟿]|[-�])*"
>
</wizard-textfield>
<wizard-textfield
helper="[scl.cdc]"
label="cdc"
pattern="(SPS)|(DPS)|(INS)|(ENS)|(ACT)|(ACD)|(SEC)|(BCR)|(HST)|(VSS)|(MV)|(CMV)|(SAV)|(WYE)|(DEL)|(SEQ)|(HMV)|(HWYE)|(HDEL)|(SPC)|(DPC)|(INC)|(ENC)|(BSC)|(ISC)|(APC)|(BAC)|(SPG)|(ING)|(ENG)|(ORG)|(TSG)|(CUG)|(VSG)|(ASG)|(CURVE)|(CSG)|(DPL)|(LPL)|(CSD)|(CST)|(BTS)|(UTS)|(LTS)|(GTS)|(MTS)|(NTS)|(STS)|(CTS)|(OTS)|(VSD)"
required=""
>
</wizard-textfield>
Expand Down Expand Up @@ -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=""
>
</wizard-textfield>
Expand All @@ -792,13 +788,11 @@ snapshots["DOType wizards defines a dOTypeWizard looks like the latest snapshot"
helper="[scl.desc]"
label="desc"
nullable=""
pattern="([ -~]|[…]|[ -퟿]|[-�])*"
>
</wizard-textfield>
<wizard-textfield
helper="[scl.CDC]"
label="CDC"
pattern="([ -~]|[…]|[ -퟿]|[-�])*"
>
</wizard-textfield>
<mwc-list style="margin-top: 0px;">
Expand Down Expand Up @@ -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=""
>
>
Expand All @@ -1078,7 +1071,6 @@ snapshots["DOType wizards defines a sDOWizard to edit an existing SDO looks like
helper="[scl.desc]"
label="desc"
nullable=""
pattern="([ -~]|[…]|[ -퟿]|[-�])*"
>
</wizard-textfield>
<mwc-select
Expand Down Expand Up @@ -1256,7 +1248,6 @@ snapshots["DOType wizards defines a sDOWizard to create a new SDO element looks
dialoginitialfocus=""
helper="[scl.name]"
label="name"
pattern="[a-z][0-9A-Za-z]*"
required=""
>
>
Expand All @@ -1266,7 +1257,6 @@ snapshots["DOType wizards defines a sDOWizard to create a new SDO element looks
helper="[scl.desc]"
label="desc"
nullable=""
pattern="([ -~]|[…]|[ -퟿]|[-�])*"
>
</wizard-textfield>
<mwc-select
Expand Down
137 changes: 133 additions & 4 deletions test/integration/editors/templates/dotype-wizarding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import TemplatesPlugin from '../../../../src/editors/Templates.js';
import { WizardTextField } from '../../../../src/wizard-textfield.js';
import { ListItemBase } from '@material/mwc-list/mwc-list-item-base';

import { patterns } from '../../../../src/wizards/foundation/limits.js';

describe('DOType wizards', () => {
if (customElements.get('templates-editor') === undefined)
customElements.define('templates-editor', TemplatesPlugin);
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand All @@ -349,6 +477,7 @@ describe('DOType wizards', () => {
)
).to.exist;
});

it('creates yet another new SDO element', async () => {
const name = 'newSDOElement2';
const desc = 'newSDOdesc';
Expand Down
4 changes: 2 additions & 2 deletions test/unit/editors/subscription/fcda-binding-list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ describe('fcda-binding-list', () => {
(<ListItem>(
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();
await element.updateComplete;
(<ListItem>(
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');
Expand Down

0 comments on commit fc846aa

Please sign in to comment.