Skip to content

Commit

Permalink
test: use close promise support to clean up Ti.UI.View tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed Feb 8, 2021
1 parent 682e64a commit 21553ef
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions tests/Resources/ti.ui.view.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,12 @@ describe('Titanium.UI.View', function () {

before(finish => {
rootWindow = Ti.UI.createWindow({ exitOnClose: false });
rootWindow.addEventListener('open', () => finish());
rootWindow.open();
rootWindow.open().then(() => finish()).catch(e => finish(e));
});

function closeWindow(win, done) {
if (win && !win.closed) {
win.addEventListener('close', function listener () {
win.removeEventListener('close', listener);
win = null;
done();
});
win.close();
win.close().then(() => done()).catch(_e => done());
} else {
win = null;
done();
Expand Down

0 comments on commit 21553ef

Please sign in to comment.