-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(android): guard access to some toast properties (#12826)
Fixes TIMOB-28448
- Loading branch information
Showing
2 changed files
with
78 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2021-Present by Axway. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
/* eslint-env mocha */ | ||
/* eslint no-unused-expressions: "off" */ | ||
/* eslint promise/no-callback-in-promise: "off" */ | ||
'use strict'; | ||
const should = require('./utilities/assertions'); | ||
|
||
describe('Titanium.UI.Notification', function () { | ||
this.timeout(10000); | ||
|
||
let window; | ||
afterEach(done => { | ||
if (window && !window.closed) { | ||
window.close().then(() => done()).catch(_e => done()); | ||
} else { | ||
window = null; | ||
done(); | ||
} | ||
}); | ||
|
||
describe('methods', () => { | ||
describe('#show()', () => { | ||
it('is a Function', () => { | ||
const notification = Ti.UI.createNotification({ | ||
title: 'Hello world', | ||
duration: Ti.UI.NOTIFICATION_DURATION_SHORT | ||
}); | ||
|
||
should(notification).have.a.property('show').which.is.a.Function(); | ||
}); | ||
|
||
it('does not crash', finish => { | ||
const notification = Ti.UI.createNotification({ | ||
title: 'Hello world', | ||
duration: Ti.UI.NOTIFICATION_DURATION_SHORT | ||
}); | ||
|
||
window = Ti.UI.createWindow(); | ||
window.open().then(notification.show).catch(finish); | ||
}); | ||
}); | ||
}); | ||
}); |