Skip to content

Commit

Permalink
[api tests] wait for references peek to be opened before testing close
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
  • Loading branch information
akosyakov committed Apr 23, 2020
1 parent 598116b commit d8f8f42
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions examples/api-tests/src/typescript.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

// @ts-check
describe('TypeScript', function () {
this.timeout(45000);
this.timeout(30000);

const { assert } = chai;

Expand Down Expand Up @@ -247,7 +247,12 @@ module.exports = (port, host, argv) => Promise.resolve()
assert.isTrue(contextKeyService.match('listFocus'));
}

async function closePeek() {
/**
* @param {MonacoEditor} editor
*/
async function closePeek(editor) {
await assertPeekOpened(editor);

keybindings.dispatchKeyDown('Escape');
await waitForAnimation(() => !contextKeyService.match('listFocus'));
assert.isTrue(contextKeyService.match('editorTextFocus'));
Expand Down Expand Up @@ -362,7 +367,7 @@ module.exports = (port, host, argv) => Promise.resolve()
// @ts-ignore
assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'container');

await closePeek();
await closePeek(activeEditor);
});

it(`from ${from} to another editor`, async function () {
Expand All @@ -388,7 +393,7 @@ module.exports = (port, host, argv) => Promise.resolve()
// @ts-ignore
assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'Container');

await closePeek();
await closePeek(activeEditor);
});

it(`from ${from} to an editor preview`, async function () {
Expand All @@ -412,7 +417,7 @@ module.exports = (port, host, argv) => Promise.resolve()
// @ts-ignore
assert.equal(activeEditor.getControl().getModel().getWordAtPosition({ lineNumber, column }).word, 'Container');

await closePeek();
await closePeek(activeEditor);
});
}
});
Expand Down Expand Up @@ -678,7 +683,7 @@ SPAN {
if (link) {
link.dispatchEvent(new MouseEvent('mouseup', { bubbles: true }));
await assertPeekOpened(editor);
await closePeek();
await closePeek(editor);
} else {
assert.isDefined(link);
}
Expand Down

0 comments on commit d8f8f42

Please sign in to comment.