Skip to content

Commit

Permalink
chore: Fix tests using mock-wizard-editor
Browse files Browse the repository at this point in the history
  • Loading branch information
clepski committed Jul 24, 2024
1 parent 4dc71db commit 7fa8335
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/compas-open-scd/src/compas/CompasUploadVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { newLogEvent } from '@openscd/core/foundation/deprecated/history.js';
import { newPendingStateEvent } from '@openscd/core/foundation/deprecated/waiter.js';

import '@openscd/open-scd/src/wizard-textfield.js';;
import '@openscd/open-scd/src/wizard-textfield.js';

import { CompasExistsIn } from './CompasExistsIn.js';
import { CompasSclDataService } from '../compas-services/CompasSclDataService.js';
Expand Down
7 changes: 4 additions & 3 deletions packages/compas-open-scd/test/unit/compas-wizards/scl.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { expect, fixture, html } from '@open-wc/testing';

import '@openscd/open-scd/test/mock-wizard.js';
import '@openscd/open-scd/test/mock-wizard-editor.js';
import {MockWizardEditor} from "@openscd/open-scd/test/mock-wizard-editor.js";
import { newWizardEvent } from '@openscd/open-scd/src/foundation.js';

import {WizardTextField} from "@openscd/open-scd/src/wizard-textfield.js";
import {
Expand Down Expand Up @@ -35,9 +36,9 @@ describe('Wizards for SCL element (CoMPAS)', () => {
let inputs: WizardInputElement[];

async function createWizard(scl: Element): Promise<void> {
element = await fixture(html` <mock-wizard></mock-wizard>`);
element = await fixture(html` <mock-wizard-editor></mock-wizard-editor>`);
wizard = editCompasSCLWizard(scl);
element.workflow.push(() => wizard);
element.dispatchEvent(newWizardEvent(wizard));
await element.requestUpdate();
inputs = Array.from(element.wizardUI.inputs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {expect, fixture, fixtureSync, html, waitUntil} from '@open-wc/testing';
import sinon from "sinon";

import {MockWizardEditor} from "@openscd/open-scd/test/mock-wizard-editor.js";
import '@openscd/open-scd/test/mock-wizard.js';
import '@openscd/open-scd/test/mock-wizard-editor.js';
import { newWizardEvent } from '@openscd/open-scd/src/foundation.js';

import {addVersionToCompasWizard, CompasUploadVersionElement} from "../../../src/compas/CompasUploadVersion.js";
import {CompasExistsInElement} from "../../../src/compas/CompasExistsIn.js";
Expand Down Expand Up @@ -73,8 +74,9 @@ describe('compas-upload-version', () => {
let wizardElement: MockWizardEditor;

beforeEach(async () => {
wizardElement = await fixture(html `<mock-wizard></mock-wizard>`);
wizardElement.workflow.push(() => addVersionToCompasWizard({docId: docId, docName: docName}));
wizardElement = await fixture(html `<mock-wizard-editor></mock-wizard-editor>`);
const wizard = addVersionToCompasWizard({docId: docId, docName: docName});
wizardElement.dispatchEvent(newWizardEvent(wizard));
await wizardElement.requestUpdate();

element = wizardElement.wizardUI.dialog!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {MockWizardEditor} from "@openscd/open-scd/test/mock-wizard-editor.js";
import {fetchDoc} from "@openscd/plugins/test/unit/wizards/test-support.js";
import {initializeNsdoc, Nsdoc} from "@openscd/open-scd/src/foundation/nsdoc.js"

import '@openscd/open-scd/test/mock-wizard.js';
import '@openscd/open-scd/test/mock-wizard-editor.js';
import { newWizardEvent } from '@openscd/open-scd/src/foundation.js';

import {
LocamationIEDListElement,
Expand All @@ -27,9 +28,9 @@ describe('Wizards for Locamation Plugin to select the IED/Logical Device - ', ()
beforeEach(async () => {
doc = await fetchDoc('/test/testfiles/locamation/LCMTN_VMU_MMS.scd');

element = await fixture(html`<mock-wizard></mock-wizard>`);
element = await fixture(html`<mock-wizard-editor></mock-wizard-editor>`);
const wizard = locamationIEDListWizard(doc, nsdoc);
element.workflow.push(() => wizard);
element.dispatchEvent(newWizardEvent(wizard));
await element.requestUpdate();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {WizardTextField} from "@openscd/open-scd/src/wizard-textfield.js";
import {WizardAction} from "@openscd/open-scd/src/foundation.js";
import {ComplexAction, isSimple, isReplace, Replace} from "@openscd/core/foundation/deprecated/editor.js";

import "open-scd/test/mock-wizard.js";
import "@openscd/open-scd/test/mock-wizard-editor.js";
import { newWizardEvent } from '@openscd/open-scd/src/foundation.js';

import {LocamationVMUEditElement, locamationLNEditWizard} from "../../../src/locamation/LocamationLNEdit.js";

Expand All @@ -29,9 +30,9 @@ describe('Wizards for Locamation Plugin to edit the selected Logical Node - ', (
beforeEach(async () => {
logicalNode = doc.querySelector('LN[prefix="I01A"][lnClass="TCTR"]')!

element = await fixture(html`<mock-wizard></mock-wizard>`);
element = await fixture(html`<mock-wizard-editor></mock-wizard-editor>`);
const wizard = locamationLNEditWizard(logicalNode, nsdoc);
element.workflow.push(() => wizard);
element.dispatchEvent(newWizardEvent(wizard));
await element.requestUpdate();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {MockWizardEditor} from "@openscd/open-scd/test/mock-wizard-editor.js";
import {fetchDoc} from "@openscd/plugins/test/unit/wizards/test-support.js";
import {initializeNsdoc, Nsdoc} from "@openscd/open-scd/src/foundation/nsdoc.js";

import "open-scd/test/mock-wizard.js";
import "@openscd/open-scd/test/mock-wizard-editor.js";
import { newWizardEvent } from '@openscd/open-scd/src/foundation.js';

import {LocamationLNodeListElement, locamationLNListWizard} from "../../../src/locamation/LocamationLNList.js";

Expand All @@ -26,9 +27,9 @@ describe('Wizards for Locamation Plugin to select the Logical Node - ', () => {
beforeEach(async () => {
lDevice = doc.querySelector('LDevice[inst="MU01"]')!

element = await fixture(html`<mock-wizard></mock-wizard>`);
element = await fixture(html`<mock-wizard-editor></mock-wizard-editor>`);
const wizard = locamationLNListWizard(lDevice, nsdoc);
element.workflow.push(() => wizard);
element.dispatchEvent(newWizardEvent(wizard));
await element.requestUpdate();
});

Expand Down

0 comments on commit 7fa8335

Please sign in to comment.