forked from ca-d/open-scd-core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
open-scd.plugging.spec.ts
59 lines (52 loc) · 2.21 KB
/
open-scd.plugging.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { expect, fixture } from '@open-wc/testing';
import { html } from 'lit';
import type { OpenSCD } from './open-scd.js';
import './open-scd.js';
describe('Plugging Element', () => {
let editor: OpenSCD;
beforeEach(async () => {
editor = <OpenSCD>await fixture(html`<open-scd></open-scd>`);
});
it('loads menu plugins', () => {
editor.plugins = {
menu: [
{
name: 'Test Menu Plugin',
translations: { de: 'Test Menu Erweiterung' },
src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20async%20run%28%29%20%7B%0D%0A%20%20%20%20return%20true%3B%0D%0A%20%20%7D%0D%0A%7D',
icon: 'margin',
active: true,
requireDoc: false,
},
{
name: 'Test Menu Plugin 2',
src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20async%20run%28%29%20%7B%0D%0A%20%20%20%20return%20true%3B%0D%0A%20%20%7D%0D%0A%7D',
icon: 'margin',
active: true,
requireDoc: false,
},
],
};
expect(editor).property('plugins').property('menu').to.have.lengthOf(2);
});
it('loads editor plugins', () => {
editor.plugins = {
editor: [
{
name: 'Test Editor Plugin',
translations: { de: 'Test Editor Erweiterung' },
src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestEditorPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20constructor%20%28%29%20%7B%20super%28%29%3B%20this.innerHTML%20%3D%20%60%3Cp%3ETest%20Editor%20Plugin%3C%2Fp%3E%60%3B%20%7D%0D%0A%7D',
icon: 'coronavirus',
active: true,
},
{
name: 'Test Editor Plugin 2',
src: 'data:text/javascript;charset=utf-8,export%20default%20class%20TestEditorPlugin%20extends%20HTMLElement%20%7B%0D%0A%20%20constructor%20%28%29%20%7B%20super%28%29%3B%20this.innerHTML%20%3D%20%60%3Cp%3ETest%20Editor%20Plugin%3C%2Fp%3E%60%3B%20%7D%0D%0A%7D',
icon: 'coronavirus',
active: true,
},
],
};
expect(editor).property('plugins').property('editor').to.have.lengthOf(2);
});
});