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: refresh on opening of the same document name #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 foundation/plugin-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { targetLocales } from '../locales.js';

export type Plugin = {
name: string;
translations?: Record<typeof targetLocales[number], string>;
translations?: Record<(typeof targetLocales)[number], string>;
src: string;
icon: string;
requireDoc?: boolean;
Expand Down
16 changes: 16 additions & 0 deletions open-scd.editing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
let sclDoc: XMLDocument;

beforeEach(async () => {
editor = <OpenSCD>await fixture(html`<open-scd></open-scd>`);

Check failure on line 195 in open-scd.editing.spec.ts

View workflow job for this annotation

GitHub Actions / test-on-pr-branch

Argument of type 'TemplateResult<ResultType>' is not assignable to parameter of type 'LitHTMLRenderable'.
sclDoc = new DOMParser().parseFromString(
util.sclDocString,
'application/xml'
Expand All @@ -206,6 +206,22 @@
expect(editor.docName).to.equal('test.scd');
});

it('refreshes a document with the same name as one already opened on OpenDocEvent', async () => {
editor.dispatchEvent(newOpenEvent(sclDoc, 'test.scd'));
const firstUpdate = editor.updateComplete;
await firstUpdate;
sclDoc = new DOMParser().parseFromString(
util.sclDocString,
'application/xml'
);
editor.dispatchEvent(newOpenEvent(sclDoc, 'test.scd'));
const secondUpdate = editor.updateComplete;
await secondUpdate;
expect(firstUpdate).to.not.equal(secondUpdate);
expect(editor.doc).to.equal(sclDoc);
expect(editor.docName).to.equal('test.scd');
});

it('inserts an element on Insert', () => {
const parent = sclDoc.documentElement;
const node = sclDoc.createElement('test');
Expand Down
335 changes: 0 additions & 335 deletions open-scd.test.ts

This file was deleted.

Loading
Loading