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(open-scd): fix createNewProject for Edition 2 #188

Merged
merged 1 commit into from
Apr 28, 2021
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
2 changes: 1 addition & 1 deletion src/open-scd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class OpenSCD extends Setting(
<mwc-radio-list-item left value="2003"
>Edition 1 (Schema 1.7)</mwc-radio-list-item
>
<mwc-radio-list-item left value="2007B1"
<mwc-radio-list-item left value="2007B"
>Edition 2 (Schema 3.1)</mwc-radio-list-item
>
<mwc-radio-list-item left selected value="2007B4"
Expand Down
62 changes: 61 additions & 1 deletion test/integration/open-scd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('open-scd', () => {
expect(element.wizardUI.dialog).to.exist;
});

it('creates an empty project on wizard primary button click', async () => {
it('creates an empty Edition 2.1 project on wizard primary button click', async () => {
(<HTMLElement>(
element.shadowRoot!.querySelector('div > mwc-icon-button:nth-child(1)')
)).click();
Expand Down Expand Up @@ -69,6 +69,66 @@ describe('open-scd', () => {
);
});

it('creates an empty Edition 2 project on wizard primary button click', async () => {
(<HTMLElement>(
element.shadowRoot!.querySelector('div > mwc-icon-button:nth-child(1)')
)).click();
await element.updateComplete;
(<HTMLElement>(
element.wizardUI.dialog!.querySelector('mwc-radio-list-item:nth-child(2)')
)).click();
await element.updateComplete;
(<HTMLElement>(
element.wizardUI.shadowRoot!.querySelector(
'mwc-button[slot="primaryAction"]'
)
)).click();
expect(element.doc?.querySelector('Header')).to.exist;
expect(element.doc?.querySelector('Header')?.getAttribute('id')).to.equal(
element.docName.slice(0, -4)
);
expect(element.doc?.querySelector('SCL')?.getAttribute('xmlns')).to.equal(
'http://www.iec.ch/61850/2003/SCL'
);
expect(element.doc?.querySelector('SCL')?.getAttribute('version')).to.equal(
'2007'
);
expect(
element.doc?.querySelector('SCL')?.getAttribute('revision')
).to.equal('B');
expect(element.doc?.querySelector('SCL')?.getAttribute('release')).to.be
.null;
});

it('creates an empty Edition 1 project on wizard primary button click', async () => {
(<HTMLElement>(
element.shadowRoot!.querySelector('div > mwc-icon-button:nth-child(1)')
)).click();
await element.updateComplete;
(<HTMLElement>(
element.wizardUI.dialog!.querySelector('mwc-radio-list-item:nth-child(1)')
)).click();
await element.updateComplete;
(<HTMLElement>(
element.wizardUI.shadowRoot!.querySelector(
'mwc-button[slot="primaryAction"]'
)
)).click();
expect(element.doc?.querySelector('Header')).to.exist;
expect(element.doc?.querySelector('Header')?.getAttribute('id')).to.equal(
element.docName.slice(0, -4)
);
expect(element.doc?.querySelector('SCL')?.getAttribute('xmlns')).to.equal(
'http://www.iec.ch/61850/2003/SCL'
);
expect(element.doc?.querySelector('SCL')?.getAttribute('version')).to.be
.null;
expect(element.doc?.querySelector('SCL')?.getAttribute('revision')).to.be
.null;
expect(element.doc?.querySelector('SCL')?.getAttribute('release')).to.be
.null;
});

it('opens the menu on navigation icon click', async () => {
const menu = element.shadowRoot!.querySelector('mwc-drawer')!;
expect(menu).property('open').to.be.false;
Expand Down