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 Jan 29, 2021
1 parent 7555ee3 commit 708b6a0
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 @@ -22,18 +22,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 708b6a0

Please sign in to comment.