Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 1553 LN LN0 wizards read only attributes #1568

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/plugins/src/wizards/ln.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function renderLNWizard(
html`<wizard-textfield
label="lnType"
.maybeValue=${lnType}
readonly
required
helper="${get('ln.wizard.lnTypeHelper')}"
></wizard-textfield>`,
Expand All @@ -37,18 +38,21 @@ export function renderLNWizard(
html`<wizard-textfield
label="prefix"
nullable
readonly
.maybeValue=${prefix}
helper="${get('ln.wizard.prefixHelper')}"
></wizard-textfield>`,
html`<wizard-textfield
label="lnClass"
readonly
required
.maybeValue=${lnClass}
helper="${get('ln.wizard.lnClassHelper')}"
></wizard-textfield>`,
html`<wizard-textfield
label="inst"
.maybeValue=${inst}
readonly
helper="${get('ln.wizard.instHelper')}"
></wizard-textfield>`,
];
Expand Down
3 changes: 3 additions & 0 deletions packages/plugins/src/wizards/ln0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function renderLN0Wizard(
html`<wizard-textfield
label="lnType"
.maybeValue=${lnType}
readonly
required
helper="${get('ln0.wizard.lnTypeHelper')}"
></wizard-textfield>`,
Expand All @@ -35,13 +36,15 @@ export function renderLN0Wizard(
></wizard-textfield>`,
html`<wizard-textfield
label="lnClass"
readonly
required
.maybeValue=${lnClass}
helper="${get('ln0.wizard.lnClassHelper')}"
></wizard-textfield>`,
html`<wizard-textfield
label="inst"
.maybeValue=${inst}
readonly
helper="${get('ln0.wizard.instHelper')}"
></wizard-textfield>`,
];
Expand Down
12 changes: 6 additions & 6 deletions packages/plugins/test/unit/wizards/ln.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ describe('ln wizards', () => {
lnClass: 'LN-class',
inst: '1',
};
const requiredFields = [
const readonlyFields = [
'lnType',
'prefix',
'lnClass',
'inst'
];

const ln = <Element>(
Expand Down Expand Up @@ -56,15 +58,13 @@ describe('ln wizards', () => {
});
});

requiredFields.forEach((field) => {
it(`is a required field ${field}`, async () => {
readonlyFields.forEach((field) => {
it(`is a readonly field ${field}`, async () => {
const input = (<WizardInputElement[]>inputs).find(
(textField) => textField.label === field
) as WizardTextField;

await setWizardTextFieldValue(input!, '');

expect(input.checkValidity()).to.be.false;
expect(input.readOnly).to.be.true;
});
});
});
11 changes: 5 additions & 6 deletions packages/plugins/test/unit/wizards/ln0.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ describe('ln0 wizards', () => {
lnClass: 'LN0-class',
inst: '1',
};
const requiredFields = [
const readonlyFields = [
'lnType',
'lnClass',
'inst'
];

const ln = <Element>(
Expand Down Expand Up @@ -55,15 +56,13 @@ describe('ln0 wizards', () => {
});
});

requiredFields.forEach((field) => {
it(`is a required field ${field}`, async () => {
readonlyFields.forEach((field) => {
it(`is a readonly field ${field}`, async () => {
const input = (<WizardInputElement[]>inputs).find(
(textField) => textField.label === field
) as WizardTextField;

await setWizardTextFieldValue(input!, '');

expect(input.checkValidity()).to.be.false;
expect(input.readOnly).to.be.true;
});
});
});
Loading