Skip to content

Commit 4811359

Browse files
author
Dennis Labordus
committed
Fixed test.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent bd114fb commit 4811359

File tree

2 files changed

+123
-1
lines changed

2 files changed

+123
-1
lines changed

test/unit/compas/CompasSave.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@ import '../../../src/compas/CompasSave.js';
88

99
describe('compas-save', () => {
1010
let element: CompasSaveElement & CompasExistsInElement;
11+
let doc: Document;
1112
const docName = 'station123.scd';
1213
const docId = '6a45ae97-5605-44f8-b4e6-25305bc6c036';
1314

15+
beforeEach(async () => {
16+
doc = await fetch('/test/testfiles/compas/test-scd.cid')
17+
.then(response => response.text())
18+
.then(str => new DOMParser().parseFromString(str, 'application/xml'));
19+
});
20+
21+
// test-scd.cid
1422
describe('still determining if document exists in CoMPAS', () => {
1523
beforeEach(async () => {
1624
element = fixtureSync(
1725
html`<compas-save
26+
.doc="${doc}"
1827
.docName="${docName}"
1928
.docId="${docId}"
2029
></compas-save>`
@@ -35,7 +44,7 @@ describe('compas-save', () => {
3544
describe('new document in compas', () => {
3645
beforeEach(async () => {
3746
element = fixtureSync(
38-
html`<compas-save .docName="${docName}"></compas-save>`
47+
html`<compas-save .doc="${doc}" .docName="${docName}"></compas-save>`
3948
);
4049

4150
sinon.stub(element, 'checkExistInCompas').callsFake(() => {
@@ -55,6 +64,7 @@ describe('compas-save', () => {
5564
beforeEach(async () => {
5665
element = fixtureSync(
5766
html`<compas-save
67+
.doc="${doc}"
5868
.docName="${docName}"
5969
.docId="${docId}"
6070
></compas-save>`
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/* @web/test-runner snapshot v1 */
2+
export const snapshots = {};
3+
4+
snapshots["compas-save still determining if document exists in CoMPAS looks like the latest snapshot"] =
5+
`<wizard-divider>
6+
</wizard-divider>
7+
<section>
8+
<h3>
9+
[compas.save.localTitle]
10+
</h3>
11+
<mwc-button label="[compas.save.saveFileButton]">
12+
</mwc-button>
13+
</section>
14+
<wizard-divider>
15+
</wizard-divider>
16+
<section>
17+
<h3>
18+
[compas.save.compasTitle]
19+
</h3>
20+
<compas-loading>
21+
</compas-loading>
22+
</section>
23+
<wizard-divider>
24+
</wizard-divider>
25+
<section>
26+
<h3>
27+
[compas.save.labelsTitle]
28+
</h3>
29+
<compas-labels-field>
30+
</compas-labels-field>
31+
</section>
32+
`;
33+
/* end snapshot compas-save still determining if document exists in CoMPAS looks like the latest snapshot */
34+
35+
snapshots["compas-save new document in compas looks like the latest snapshot"] =
36+
`<wizard-divider>
37+
</wizard-divider>
38+
<section>
39+
<h3>
40+
[compas.save.localTitle]
41+
</h3>
42+
<mwc-button label="[compas.save.saveFileButton]">
43+
</mwc-button>
44+
</section>
45+
<wizard-divider>
46+
</wizard-divider>
47+
<section>
48+
<h3>
49+
[compas.save.compasTitle]
50+
</h3>
51+
<div id="content">
52+
<mwc-textfield
53+
dialoginitialfocus=""
54+
id="name"
55+
label="[scl.name]"
56+
required=""
57+
value="station123"
58+
>
59+
</mwc-textfield>
60+
<compas-scltype-select>
61+
</compas-scltype-select>
62+
<compas-comment>
63+
</compas-comment>
64+
</div>
65+
</section>
66+
<wizard-divider>
67+
</wizard-divider>
68+
<section>
69+
<h3>
70+
[compas.save.labelsTitle]
71+
</h3>
72+
<compas-labels-field>
73+
</compas-labels-field>
74+
</section>
75+
`;
76+
/* end snapshot compas-save new document in compas looks like the latest snapshot */
77+
78+
snapshots["compas-save existing document in compas looks like the latest snapshot"] =
79+
`<wizard-divider>
80+
</wizard-divider>
81+
<section>
82+
<h3>
83+
[compas.save.localTitle]
84+
</h3>
85+
<mwc-button label="[compas.save.saveFileButton]">
86+
</mwc-button>
87+
</section>
88+
<wizard-divider>
89+
</wizard-divider>
90+
<section>
91+
<h3>
92+
[compas.save.compasTitle]
93+
</h3>
94+
<div id="content">
95+
<compas-changeset-radiogroup>
96+
</compas-changeset-radiogroup>
97+
<compas-comment>
98+
</compas-comment>
99+
</div>
100+
</section>
101+
<wizard-divider>
102+
</wizard-divider>
103+
<section>
104+
<h3>
105+
[compas.save.labelsTitle]
106+
</h3>
107+
<compas-labels-field>
108+
</compas-labels-field>
109+
</section>
110+
`;
111+
/* end snapshot compas-save existing document in compas looks like the latest snapshot */
112+

0 commit comments

Comments
 (0)