Skip to content

Commit 4b2180d

Browse files
committed
test: add unit tests for searchValue prop
1 parent 249d5cc commit 4b2180d

File tree

4 files changed

+62
-15
lines changed

4 files changed

+62
-15
lines changed

editors/dataset/data-set-editor.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,15 @@ describe('DataSet editor component', () => {
5252
'DataSet'
5353
);
5454
});
55+
56+
it('sets searchValue on ActionList when passed as a prop', async () => {
57+
const el = await fixture(
58+
html`<data-set-editor .doc="${doc}" searchValue="IED1"></data-set-editor>`
59+
);
60+
await (el as DataSetEditor).updateComplete;
61+
62+
const actionList = (el as DataSetEditor).selectionList;
63+
expect(actionList).to.exist;
64+
expect(actionList.searchValue).to.equal('IED1');
65+
});
5566
});

editors/gsecontrol/gse-control-editor.spec.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@ function timeout(ms: number) {
2323
});
2424
}
2525

26+
const doc = new DOMParser().parseFromString(gseControlDoc, 'application/xml');
27+
2628
describe('GSEControl editor component', () => {
2729
let editor: GseControlEditor;
2830
let editEvent: SinonSpy;
2931

3032
beforeEach(async () => {
31-
const doc = new DOMParser().parseFromString(
32-
gseControlDoc,
33-
'application/xml'
34-
);
35-
3633
editor = await fixture(
3734
html`<gse-control-editor .doc="${doc}"></gse-control-editor>`
3835
);
@@ -91,4 +88,18 @@ describe('GSEControl editor component', () => {
9188
'datSet2'
9289
);
9390
});
91+
92+
it('sets searchValue on ActionList when passed as a prop', async () => {
93+
const el = await fixture(
94+
html`<gse-control-editor
95+
.doc="${doc}"
96+
searchValue="GSE1"
97+
></gse-control-editor>`
98+
);
99+
await (el as GseControlEditor).updateComplete;
100+
101+
const actionList = (el as GseControlEditor).selectionList;
102+
expect(actionList).to.exist;
103+
expect(actionList.searchValue).to.equal('GSE1');
104+
});
94105
});

editors/report/report-control-editor.spec.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ function timeout(ms: number) {
2424
});
2525
}
2626

27+
const doc = new DOMParser().parseFromString(
28+
reportControlDoc,
29+
'application/xml'
30+
);
31+
2732
describe('ReportControl editor component', () => {
2833
let editor: ReportControlEditor;
2934
let editEvent: SinonSpy;
3035

3136
beforeEach(async () => {
32-
const doc = new DOMParser().parseFromString(
33-
reportControlDoc,
34-
'application/xml'
35-
);
36-
3737
editor = await fixture(
3838
html`<report-control-editor .doc="${doc}"></report-control-editor>`
3939
);
@@ -93,4 +93,18 @@ describe('ReportControl editor component', () => {
9393
'datSet2'
9494
);
9595
});
96+
97+
it('sets searchValue on ActionList when passed as a prop', async () => {
98+
const el = await fixture(
99+
html`<report-control-editor
100+
.doc="${doc}"
101+
searchValue="Report1"
102+
></report-control-editor>`
103+
);
104+
await (el as ReportControlEditor).updateComplete;
105+
106+
const actionList = (el as ReportControlEditor).selectionList;
107+
expect(actionList).to.exist;
108+
expect(actionList.searchValue).to.equal('Report1');
109+
});
96110
});

editors/sampledvalue/sampled-value-control-editor.spec.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,13 @@ function timeout(ms: number) {
2626
});
2727
}
2828

29+
const doc = new DOMParser().parseFromString(smvControlDoc, 'application/xml');
30+
2931
describe('SampledValueControl editor component', () => {
3032
let editor: SampledValueControlEditor;
3133
let editEvent: SinonSpy;
3234

3335
beforeEach(async () => {
34-
const doc = new DOMParser().parseFromString(
35-
smvControlDoc,
36-
'application/xml'
37-
);
38-
3936
editor = await fixture(
4037
html`<sampled-value-control-editor
4138
.doc="${doc}"
@@ -85,4 +82,18 @@ describe('SampledValueControl editor component', () => {
8582
'datSet2'
8683
);
8784
});
85+
86+
it('sets searchValue on ActionList when passed as a prop', async () => {
87+
const el = await fixture(
88+
html`<sampled-value-control-editor
89+
.doc="${doc}"
90+
searchValue="SV1"
91+
></sampled-value-control-editor>`
92+
);
93+
await (el as SampledValueControlEditor).updateComplete;
94+
95+
const actionList = (el as SampledValueControlEditor).selectionList;
96+
expect(actionList).to.exist;
97+
expect(actionList.searchValue).to.equal('SV1');
98+
});
8899
});

0 commit comments

Comments
 (0)