Skip to content

Commit da6b939

Browse files
author
Dennis Labordus
committed
Added some updateComplete calls to make the tests more stable
Signed-off-by: Dennis Labordus <[email protected]>
1 parent 76c57fb commit da6b939

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

src/Logging.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,21 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
148148
};
149149
}
150150

151-
private async onLoadHistoryFromDoc(event: OpenDocEvent) {
152-
if (event.detail && event.detail.doc) {
153-
const doc = event.detail.doc;
154-
Array.from(
155-
doc.querySelectorAll(':root > Header > History > Hitem')
156-
).forEach(historyItem => {
157-
this.history.push(
158-
this.createSclHistoryEntry(
159-
historyItem.getAttribute('who'),
160-
historyItem.getAttribute('what'),
161-
historyItem.getAttribute('why'),
162-
historyItem.getAttribute('when')
163-
)
164-
);
165-
});
166-
}
151+
private onLoadHistoryFromDoc(event: OpenDocEvent) {
152+
const doc = event.detail.doc;
153+
154+
Array.from(
155+
doc.querySelectorAll(':root > Header > History > Hitem')
156+
).forEach(historyItem => {
157+
this.history.push(
158+
this.createSclHistoryEntry(
159+
historyItem.getAttribute('who'),
160+
historyItem.getAttribute('what'),
161+
historyItem.getAttribute('why'),
162+
historyItem.getAttribute('when')
163+
)
164+
);
165+
});
167166
}
168167

169168
private onIssue(de: IssueEvent): void {

src/compas/CompasSession.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export class CompasSessionExpiredDialogElement extends LitElement {
139139
translateUnsafeHTML('compas.session.explainExpiredWithProject',
140140
{expiredSessionMessage: expiredSessionMessage}) }
141141
</div>
142-
${(this.doc != null) ?
142+
${(this.doc !== null) ?
143143
html `<mwc-button slot="primaryAction"
144144
@click=${() => this.save()}
145145
?disabled=${this.doc == null}>
@@ -221,7 +221,7 @@ export async function retrieveUserInfo(): Promise<void> {
221221
await CompasUserInfoService().getCompasUserInfo()
222222
.then(response => {
223223
const name = response.querySelectorAll("Name").item(0)?.textContent;
224-
if (name != null) {
224+
if (name !== null) {
225225
dispatchEventOnOpenScd(newUserInfoEvent(name));
226226
}
227227

test/integration/validators/ValidateTemplates.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ describe('ValidateTemplates OpenSCD integration test ', () => {
4545
}).timeout(1000);
4646
it('pushes issues to the diagnostics pane that look like the latest snapshot', async () => {
4747
await parent.requestUpdate();
48+
await parent.updateComplete;
4849
await expect(parent.diagnosticUI).to.equalSnapshot();
4950
});
5051
});
@@ -80,6 +81,7 @@ describe('ValidateTemplates OpenSCD integration test ', () => {
8081
}).timeout(1000);
8182
it('pushes a specific issue to the diagnostics pane that look like the latest snapshot', async () => {
8283
await parent.requestUpdate();
84+
await parent.updateComplete;
8385
await expect(parent.diagnosticUI).to.equalSnapshot();
8486
});
8587
});

test/unit/menu/UpdateDescriptionSEL.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ describe('Update method for desc attributes in SEL IEDs', () => {
2222
parent = await fixture(html`
2323
<open-scd><update-description-sel></update-description-sel></open-scd>
2424
`);
25+
await parent.requestUpdate();
26+
await parent.updateComplete;
2527

2628
element = <UpdateDescriptionSel>(
2729
parent.querySelector('update-description-sel')!
2830
);
2931
await element.requestUpdate();
32+
await element.updateComplete;
3033

3134
editorAction = spy();
3235
window.addEventListener('editor-action', editorAction);
@@ -56,6 +59,7 @@ describe('Update method for desc attributes in SEL IEDs', () => {
5659

5760
element.processSignalList(signalList);
5861
await parent.requestUpdate();
62+
await parent.updateComplete;
5963
});
6064

6165
it('cannot find any desc fields to update', async () => {
@@ -82,6 +86,7 @@ describe('Update method for desc attributes in SEL IEDs', () => {
8286

8387
element.processSignalList(signalList);
8488
await parent.requestUpdate();
89+
await parent.updateComplete;
8590
});
8691

8792
it('creates filtered list with all proposed desc attribute updates', async () => {
@@ -113,6 +118,7 @@ describe('Update method for desc attributes in SEL IEDs', () => {
113118

114119
element.processSignalList(signalList);
115120
await parent.requestUpdate();
121+
await parent.updateComplete;
116122
});
117123

118124
it('creates filtered list with all proposed desc attribute updates', async () => {
@@ -124,6 +130,7 @@ describe('Update method for desc attributes in SEL IEDs', () => {
124130
?.querySelector<HTMLElement>('mwc-button[slot="primaryAction"]')!
125131
.click();
126132

133+
await parent.requestUpdate();
127134
await parent.updateComplete;
128135
expect(editorAction).to.have.been.calledOnce;
129136
expect(editorAction.args[0][0].detail.action).to.not.satisfy(isSimple);

0 commit comments

Comments
 (0)