-
-
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.
- Loading branch information
1 parent
14e9a68
commit 28f90c0
Showing
2 changed files
with
99 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2020 by Axway, Inc. 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" */ | ||
'use strict'; | ||
|
||
const should = require('./utilities/assertions'); | ||
|
||
describe('Titanium.UI.Shortcut', () => { | ||
|
||
it('Ti.UI.Shortcut', () => { | ||
should(Ti.UI.Shortcut).not.be.undefined(); | ||
}); | ||
|
||
it('createShortcut', () => { | ||
should(Ti.UI.createShortcutItem).not.be.undefined(); | ||
should(Ti.UI.createShortcut).be.a.Function(); | ||
|
||
// Create shortcut. | ||
const shortcut = Ti.UI.createShortcut(); | ||
should(shortcut).be.a.Object(); | ||
|
||
// Verify `apiName`. | ||
should(shortcut).have.readOnlyProperty('apiName').which.is.a.String(); | ||
should(shortcut.apiName).be.eql('Ti.UI.Shortcut'); | ||
|
||
// ONLY compatible with Android 7.1+, end test early. | ||
if (Ti.Platform.osname === 'Android') { | ||
const version = Ti.Platform.version.split('.'); | ||
if (parseInt(`${version[0]}${version[1]}`) < 71) { | ||
return; | ||
} | ||
} | ||
|
||
// Verify `add()`. | ||
should(shortcut.add).not.be.undefined(); | ||
should(shortcut.add).be.a.Function(); | ||
|
||
// Verify `remove()`. | ||
should(shortcut.remove).not.be.undefined(); | ||
should(shortcut.remove).be.a.Function(); | ||
|
||
// Verify `removeAll()`. | ||
should(shortcut.removeAll).not.be.undefined(); | ||
should(shortcut.removeAll).be.a.Function(); | ||
}); | ||
}); |
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) 2020 by Axway, Inc. 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" */ | ||
'use strict'; | ||
|
||
const should = require('./utilities/assertions'); | ||
|
||
describe('Titanium.UI.ShortcutItem', () => { | ||
|
||
it('Ti.UI.ShortcutItem', () => { | ||
should(Ti.UI.ShortcutItem).not.be.undefined(); | ||
}); | ||
|
||
it('createShortcutItem', () => { | ||
should(Ti.UI.createShortcutItem).not.be.undefined(); | ||
should(Ti.UI.createShortcutItem).be.a.Function(); | ||
|
||
// Create shortcut item. | ||
const item = Ti.UI.createShortcutItem({ | ||
id: 'test_shortcut', | ||
title: 'Test Shortcut', | ||
description: 'Test shortcut description', | ||
data: { test_data: 'data' } | ||
}); | ||
should(item).be.a.Object(); | ||
|
||
// Verify `apiName`. | ||
should(item).have.readOnlyProperty('apiName').which.is.a.String(); | ||
should(item.apiName).be.eql('Ti.UI.ShortcutItem'); | ||
|
||
// Verify `id`. | ||
should(item.id).be.eql('test_shortcut'); | ||
|
||
// Verify `title`. | ||
should(item.title).be.eql('Test Shortcut'); | ||
|
||
// Verify `description`. | ||
should(item.description).be.eql('Test shortcut description'); | ||
|
||
// Verify `data`. | ||
should(item.data).be.a.Object(); | ||
}); | ||
}); |