mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
chore(): rename IonicPlatform to Platform
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
import {IonicPlatform, Page, ActionSheet} from 'ionic/ionic';
|
||||
import {Platform, Page, ActionSheet} from 'ionic/ionic';
|
||||
|
||||
@Page({
|
||||
templateUrl: 'actionSheet/actionSheet.html',
|
||||
})
|
||||
export class ActionSheetPage {
|
||||
|
||||
constructor(actionSheet: ActionSheet, platform: IonicPlatform) {
|
||||
constructor(actionSheet: ActionSheet, platform: Platform) {
|
||||
this.actionSheet = actionSheet;
|
||||
console.log('actionSheet', actionSheet);
|
||||
this.platform = platform;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {IonicPlatform, Page} from 'ionic/ionic';
|
||||
import {Page} from 'ionic/ionic';
|
||||
|
||||
@Page({
|
||||
templateUrl: 'buttons/buttons.html',
|
||||
@ -88,4 +88,4 @@ export class ButtonsInComponentsPage {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {IonicPlatform, Page} from 'ionic/ionic';
|
||||
import {Page} from 'ionic/ionic';
|
||||
|
||||
@Page({
|
||||
templateUrl: 'cards/cards.html',
|
||||
@ -7,4 +7,4 @@ export class CardsPage {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {IonicPlatform, Page} from 'ionic/ionic';
|
||||
import {Page} from 'ionic/ionic';
|
||||
|
||||
@Page({
|
||||
templateUrl: 'icons/icons.html',
|
||||
@ -7,4 +7,4 @@ export class IconsPage {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {App, IonicApp, IonicPlatform, ActionSheet} from 'ionic/ionic';
|
||||
import {App, IonicApp, Platform, ActionSheet} from 'ionic/ionic';
|
||||
import {Page, Config, Events} from 'ionic/ionic';
|
||||
import {ActionSheetPage} from './actionSheet/actionSheet';
|
||||
import * as helpers from './helpers';
|
||||
@ -11,7 +11,7 @@ class DemoApp {
|
||||
|
||||
rootPage: any;
|
||||
|
||||
constructor(app: IonicApp, platform: IonicPlatform) {
|
||||
constructor(app: IonicApp, platform: Platform) {
|
||||
this.app = app;
|
||||
this.platform = platform;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {IonicPlatform, Page} from 'ionic/ionic';
|
||||
import {Page} from 'ionic/ionic';
|
||||
|
||||
@Page({
|
||||
templateUrl: 'lists/lists.html',
|
||||
@ -7,4 +7,4 @@ export class ListsPage {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {IonicPlatform, Page, Popup} from 'ionic/ionic';
|
||||
import {Page, Popup} from 'ionic/ionic';
|
||||
|
||||
@Page({
|
||||
templateUrl: 'popups/popups.html',
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {IonicPlatform, Page} from 'ionic/ionic';
|
||||
import {Page} from 'ionic/ionic';
|
||||
|
||||
@Page({
|
||||
templateUrl: 'slides/slides.html',
|
||||
@ -7,4 +7,4 @@ export class SlidesPage {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {App, IonicView, IonicApp, Config, IonicPlatform} from 'ionic/ionic';
|
||||
import {App, IonicView, IonicApp, Config, Platform} from 'ionic/ionic';
|
||||
import {Modal, ActionSheet, NavController, NavParams, Animation} from 'ionic/ionic';
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import {Modal, ActionSheet, NavController, NavParams, Animation} from 'ionic/ion
|
||||
})
|
||||
class MyAppCmp {
|
||||
|
||||
constructor(modal: Modal, app: IonicApp, config: Config, platform: IonicPlatform) {
|
||||
constructor(modal: Modal, app: IonicApp, config: Config, platform: Platform) {
|
||||
this.modal = modal;
|
||||
|
||||
console.log('platforms', platform.platforms());
|
||||
|
@ -4,7 +4,7 @@ import {Ion} from '../ion';
|
||||
import {IonicApp} from '../app/app';
|
||||
import {Config} from '../../config/config';
|
||||
import {ConfigComponent} from '../../config/decorators';
|
||||
import {IonicPlatform} from '../../platform/platform';
|
||||
import {Platform} from '../../platform/platform';
|
||||
import {IonicKeyboard} from '../../util/keyboard';
|
||||
import * as gestures from './menu-gestures';
|
||||
|
||||
@ -68,7 +68,7 @@ export class Menu extends Ion {
|
||||
app: IonicApp,
|
||||
elementRef: ElementRef,
|
||||
config: Config,
|
||||
platform: IonicPlatform,
|
||||
platform: Platform,
|
||||
keyboard: IonicKeyboard
|
||||
) {
|
||||
super(elementRef, config);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {App, Page, IonicApp, Config, IonicPlatform} from 'ionic/ionic';
|
||||
import {App, Page, IonicApp, Config, Platform} from 'ionic/ionic';
|
||||
import {Modal, ActionSheet, NavController, NavParams, Animation} from 'ionic/ionic';
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import {Modal, ActionSheet, NavController, NavParams, Animation} from 'ionic/ion
|
||||
})
|
||||
class MyAppCmp {
|
||||
|
||||
constructor(modal: Modal, app: IonicApp, config: Config, platform: IonicPlatform) {
|
||||
constructor(modal: Modal, app: IonicApp, config: Config, platform: Platform) {
|
||||
this.modal = modal;
|
||||
|
||||
console.log('platforms', platform.platforms());
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {Directive, Attribute, NgZone} from 'angular2/angular2'
|
||||
|
||||
import {IonicPlatform} from '../../platform/platform';
|
||||
import {Platform} from '../../platform/platform';
|
||||
|
||||
|
||||
class DisplayWhen {
|
||||
@ -68,7 +68,7 @@ export class ShowWhen extends DisplayWhen {
|
||||
*/
|
||||
constructor(
|
||||
@Attribute('show-when') showWhen: string,
|
||||
platform: IonicPlatform,
|
||||
platform: Platform,
|
||||
ngZone: NgZone
|
||||
) {
|
||||
super(showWhen, platform, ngZone);
|
||||
@ -97,7 +97,7 @@ export class HideWhen extends DisplayWhen {
|
||||
*/
|
||||
constructor(
|
||||
@Attribute('hide-when') hideWhen: string,
|
||||
platform: IonicPlatform,
|
||||
platform: Platform,
|
||||
ngZone: NgZone
|
||||
) {
|
||||
super(hideWhen, platform, ngZone);
|
||||
|
@ -6,7 +6,7 @@ import {Label} from './label';
|
||||
import {IonicApp} from '../app/app';
|
||||
import {Content} from '../content/content';
|
||||
import * as dom from '../../util/dom';
|
||||
import {IonicPlatform} from '../../platform/platform';
|
||||
import {Platform} from '../../platform/platform';
|
||||
|
||||
|
||||
/**
|
||||
@ -33,7 +33,7 @@ export class TextInput {
|
||||
renderer: Renderer,
|
||||
app: IonicApp,
|
||||
zone: NgZone,
|
||||
platform: IonicPlatform,
|
||||
platform: Platform,
|
||||
@Optional() @Host() scrollView: Content
|
||||
) {
|
||||
renderer.setElementClass(elementRef, 'item', true);
|
||||
|
@ -3,7 +3,7 @@ import {ROUTER_PROVIDERS, LocationStrategy, HashLocationStrategy} from 'angular2
|
||||
|
||||
import {IonicApp} from '../components/app/app';
|
||||
import {Config} from './config';
|
||||
import {IonicPlatform} from '../platform/platform';
|
||||
import {Platform} from '../platform/platform';
|
||||
import {OverlayController} from '../components/overlay/overlay-controller';
|
||||
import {IonicForm} from '../util/form';
|
||||
import {IonicKeyboard} from '../util/keyboard';
|
||||
@ -21,7 +21,7 @@ import * as dom from '../util/dom';
|
||||
|
||||
export function ionicProviders(config) {
|
||||
let app = new IonicApp();
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
|
||||
if (!(config instanceof Config)) {
|
||||
config = new Config(config);
|
||||
@ -46,7 +46,7 @@ export function ionicProviders(config) {
|
||||
return [
|
||||
provide(IonicApp, {useValue: app}),
|
||||
provide(Config, {useValue: config}),
|
||||
provide(IonicPlatform, {useValue: platform}),
|
||||
provide(Platform, {useValue: platform}),
|
||||
provide(TapClick, {useValue: tapClick}),
|
||||
provide(FeatureDetect, {useValue: featureDetect}),
|
||||
provide(Events, {useValue: events}),
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Config allows you to set the modes of your components
|
||||
*/
|
||||
|
||||
import {IonicPlatform} from '../platform/platform';
|
||||
import {Platform} from '../platform/platform';
|
||||
import {isObject, isDefined, isFunction, isArray, extend} from '../util/util';
|
||||
|
||||
/**
|
||||
@ -152,7 +152,7 @@ export class Config {
|
||||
}
|
||||
|
||||
// get default platform's setting
|
||||
configObj = IonicPlatform.get(activePlatformKeys[i]);
|
||||
configObj = Platform.get(activePlatformKeys[i]);
|
||||
if (configObj && configObj.settings) {
|
||||
|
||||
if (isDefined(configObj.settings[key])) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Config, IonicPlatform, ionicProviders} from 'ionic/ionic';
|
||||
import {Config, Platform, ionicProviders} from 'ionic/ionic';
|
||||
|
||||
export function run() {
|
||||
|
||||
@ -35,7 +35,7 @@ export function run() {
|
||||
let config = new Config({
|
||||
mode: 'md'
|
||||
});
|
||||
let platform = new IonicPlatform(['ios']);
|
||||
let platform = new Platform(['ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('mode')).toEqual('md');
|
||||
@ -50,7 +50,7 @@ export function run() {
|
||||
}
|
||||
}
|
||||
});
|
||||
let platform = new IonicPlatform(['ios']);
|
||||
let platform = new Platform(['ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('mode')).toEqual('md');
|
||||
@ -69,7 +69,7 @@ export function run() {
|
||||
}
|
||||
}
|
||||
});
|
||||
let platform = new IonicPlatform(['mobile']);
|
||||
let platform = new Platform(['mobile']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('mode')).toEqual('modeB');
|
||||
@ -79,7 +79,7 @@ export function run() {
|
||||
let config = new Config({
|
||||
mode: 'modeA'
|
||||
});
|
||||
let platform = new IonicPlatform(['core']);
|
||||
let platform = new Platform(['core']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('mode')).toEqual('modeA');
|
||||
@ -89,7 +89,7 @@ export function run() {
|
||||
let config = new Config({
|
||||
hoverCSS: true
|
||||
});
|
||||
let platform = new IonicPlatform(['ios']);
|
||||
let platform = new Platform(['ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('hoverCSS')).toEqual(true);
|
||||
@ -97,7 +97,7 @@ export function run() {
|
||||
|
||||
it('should get ios mode for core platform', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['core']);
|
||||
let platform = new Platform(['core']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('mode')).toEqual('ios');
|
||||
@ -105,7 +105,7 @@ export function run() {
|
||||
|
||||
it('should get ios mode for ipad platform', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['mobile', 'ios', 'ipad', 'tablet']);
|
||||
let platform = new Platform(['mobile', 'ios', 'ipad', 'tablet']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('mode')).toEqual('ios');
|
||||
@ -113,7 +113,7 @@ export function run() {
|
||||
|
||||
it('should get md mode for windowsphone platform', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['mobile', 'windowsphone']);
|
||||
let platform = new Platform(['mobile', 'windowsphone']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('mode')).toEqual('md');
|
||||
@ -121,7 +121,7 @@ export function run() {
|
||||
|
||||
it('should get md mode for android platform', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['mobile', 'android']);
|
||||
let platform = new Platform(['mobile', 'android']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('mode')).toEqual('md');
|
||||
@ -136,7 +136,7 @@ export function run() {
|
||||
}
|
||||
}
|
||||
});
|
||||
let platform = new IonicPlatform(['ios']);
|
||||
let platform = new Platform(['ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('tabBarPlacement')).toEqual('top');
|
||||
@ -146,7 +146,7 @@ export function run() {
|
||||
let config = new Config({
|
||||
tabBarPlacement: 'top'
|
||||
});
|
||||
let platform = new IonicPlatform(['ios']);
|
||||
let platform = new Platform(['ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('tabBarPlacement')).toEqual('top');
|
||||
@ -154,7 +154,7 @@ export function run() {
|
||||
|
||||
it('should get setting from md mode', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['android']);
|
||||
let platform = new Platform(['android']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('tabBarPlacement')).toEqual('top');
|
||||
@ -162,7 +162,7 @@ export function run() {
|
||||
|
||||
it('should get setting from ios mode', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['ios']);
|
||||
let platform = new Platform(['ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
expect(config.get('tabBarPlacement')).toEqual('bottom');
|
||||
@ -170,7 +170,7 @@ export function run() {
|
||||
|
||||
it('should set/get platform setting from set()', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['ios']);
|
||||
let platform = new Platform(['ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
config.set('tabBarPlacement', 'bottom');
|
||||
@ -181,7 +181,7 @@ export function run() {
|
||||
|
||||
it('should set/get setting from set()', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['ios']);
|
||||
let platform = new Platform(['ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
config.set('tabBarPlacement', 'top');
|
||||
@ -191,7 +191,7 @@ export function run() {
|
||||
|
||||
it('should set ios platform settings from settings()', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['ios']);
|
||||
let platform = new Platform(['ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
config.settings('ios', {
|
||||
@ -203,7 +203,7 @@ export function run() {
|
||||
|
||||
it('should set/get mobile setting even w/ higher priority ios', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['mobile', 'ios']);
|
||||
let platform = new Platform(['mobile', 'ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
config.settings({
|
||||
@ -220,7 +220,7 @@ export function run() {
|
||||
|
||||
it('should set/get mobile setting even w/ higher priority ios', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['mobile', 'ios']);
|
||||
let platform = new Platform(['mobile', 'ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
config.settings({
|
||||
@ -237,7 +237,7 @@ export function run() {
|
||||
|
||||
it('should set/get android setting w/ higher priority than mobile', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['mobile', 'android']);
|
||||
let platform = new Platform(['mobile', 'android']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
config.settings({
|
||||
@ -257,7 +257,7 @@ export function run() {
|
||||
|
||||
it('should set/get ios setting w/ platforms set', () => {
|
||||
let config = new Config();
|
||||
let platform = new IonicPlatform(['ios']);
|
||||
let platform = new Platform(['ios']);
|
||||
config.setPlatform(platform);
|
||||
|
||||
config.settings({
|
||||
|
@ -3,7 +3,7 @@
|
||||
+* @name platform
|
||||
+* @module ionic
|
||||
+* @description
|
||||
+* IonicPlatform returns the availble information about your current platform
|
||||
+* Platform returns the availble information about your current platform
|
||||
+*/
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ import * as dom from '../util/dom';
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
export class IonicPlatform {
|
||||
export class Platform {
|
||||
|
||||
constructor(platforms=[]) {
|
||||
this._platforms = platforms;
|
||||
@ -33,9 +33,9 @@ export class IonicPlatform {
|
||||
* @returns {bool}
|
||||
*
|
||||
* ```
|
||||
* import {IonicPlatform} 'ionic/ionic';
|
||||
* import {Platform} 'ionic/ionic';
|
||||
* export MyClass {
|
||||
* constructor(platform: IonicPlatform){
|
||||
* constructor(platform: Platform){
|
||||
* this.platform = platform;
|
||||
* if(this.platform.is('ios'){
|
||||
* // what ever you need to do for
|
||||
@ -57,9 +57,9 @@ export class IonicPlatform {
|
||||
* it would return mobile, ios, and iphone.
|
||||
*
|
||||
* ```
|
||||
* import {IonicPlatform} 'ionic/ionic';
|
||||
* import {Platform} 'ionic/ionic';
|
||||
* export MyClass {
|
||||
* constructor(platform: IonicPlatform){
|
||||
* constructor(platform: Platform){
|
||||
* this.platform = platform;
|
||||
* console.log(this.platform.platforms());
|
||||
* // This will return an array of all the availble platforms
|
||||
@ -82,9 +82,9 @@ export class IonicPlatform {
|
||||
* Returns an object containing the os version
|
||||
*
|
||||
* ```
|
||||
* import {IonicPlatform} 'ionic/ionic';
|
||||
* import {Platform} 'ionic/ionic';
|
||||
* export MyClass {
|
||||
* constructor(platform: IonicPlatform){
|
||||
* constructor(platform: Platform){
|
||||
* this.platform = platform;
|
||||
* console.log(this.platform.versions('android'));
|
||||
* // Returns an object with the os version as a string,
|
||||
@ -112,9 +112,9 @@ export class IonicPlatform {
|
||||
* Returns a promise when the platform is ready and native functionality can be called
|
||||
*
|
||||
* ```
|
||||
* import {IonicPlatform} 'ionic/ionic';
|
||||
* import {Platform} 'ionic/ionic';
|
||||
* export MyClass {
|
||||
* constructor(platform: IonicPlatform){
|
||||
* constructor(platform: Platform){
|
||||
* this.platform = platform;
|
||||
* this.platform.ready().then(() => {
|
||||
* console.log('Platform ready');
|
||||
@ -450,7 +450,7 @@ function insertSuperset(platformNode) {
|
||||
class PlatformNode {
|
||||
|
||||
constructor(platformName) {
|
||||
this.c = IonicPlatform.get(platformName);
|
||||
this.c = Platform.get(platformName);
|
||||
this.isEngine = this.c.isEngine;
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ class PlatformNode {
|
||||
}
|
||||
|
||||
getSubsetParents(subsetPlatformName) {
|
||||
let platformRegistry = IonicPlatform.registry();
|
||||
let platformRegistry = Platform.registry();
|
||||
|
||||
let parentPlatformNames = [];
|
||||
let platform = null;
|
||||
|
@ -1,23 +1,23 @@
|
||||
import {IonicPlatform} from './platform';
|
||||
import {Platform} from './platform';
|
||||
import {windowLoad} from '../util/dom';
|
||||
|
||||
|
||||
IonicPlatform.register({
|
||||
Platform.register({
|
||||
name: 'core',
|
||||
settings: {
|
||||
mode: 'ios',
|
||||
keyboardHeight: 290,
|
||||
}
|
||||
});
|
||||
IonicPlatform.setDefault('core');
|
||||
Platform.setDefault('core');
|
||||
|
||||
|
||||
IonicPlatform.register({
|
||||
Platform.register({
|
||||
name: 'mobile'
|
||||
});
|
||||
|
||||
|
||||
IonicPlatform.register({
|
||||
Platform.register({
|
||||
name: 'phablet',
|
||||
isMatch(p) {
|
||||
let smallest = Math.min(p.width(), p.height());
|
||||
@ -28,7 +28,7 @@ IonicPlatform.register({
|
||||
});
|
||||
|
||||
|
||||
IonicPlatform.register({
|
||||
Platform.register({
|
||||
name: 'tablet',
|
||||
isMatch(p) {
|
||||
let smallest = Math.min(p.width(), p.height());
|
||||
@ -39,7 +39,7 @@ IonicPlatform.register({
|
||||
});
|
||||
|
||||
|
||||
IonicPlatform.register({
|
||||
Platform.register({
|
||||
name: 'android',
|
||||
superset: 'mobile',
|
||||
subsets: [
|
||||
@ -62,7 +62,7 @@ IonicPlatform.register({
|
||||
|
||||
|
||||
|
||||
IonicPlatform.register({
|
||||
Platform.register({
|
||||
name: 'ios',
|
||||
superset: 'mobile',
|
||||
subsets: [
|
||||
@ -91,7 +91,7 @@ IonicPlatform.register({
|
||||
});
|
||||
|
||||
|
||||
IonicPlatform.register({
|
||||
Platform.register({
|
||||
name: 'ipad',
|
||||
superset: 'tablet',
|
||||
settings: {
|
||||
@ -103,7 +103,7 @@ IonicPlatform.register({
|
||||
});
|
||||
|
||||
|
||||
IonicPlatform.register({
|
||||
Platform.register({
|
||||
name: 'iphone',
|
||||
subsets: [
|
||||
'phablet'
|
||||
@ -114,7 +114,7 @@ IonicPlatform.register({
|
||||
});
|
||||
|
||||
|
||||
IonicPlatform.register({
|
||||
Platform.register({
|
||||
name: 'windowsphone',
|
||||
superset: 'mobile',
|
||||
subsets: [
|
||||
@ -133,7 +133,7 @@ IonicPlatform.register({
|
||||
});
|
||||
|
||||
|
||||
IonicPlatform.register({
|
||||
Platform.register({
|
||||
name: 'cordova',
|
||||
isEngine: true,
|
||||
methods: {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import {IonicPlatform} from 'ionic/ionic';
|
||||
import {Platform} from 'ionic/ionic';
|
||||
|
||||
export function run() {
|
||||
|
||||
it('should set core as the fallback', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.userAgent('idk');
|
||||
platform.load();
|
||||
|
||||
@ -13,7 +13,7 @@ export function run() {
|
||||
});
|
||||
|
||||
it('should set android via platformOverride, despite ios user agent', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.userAgent(IPAD_UA);
|
||||
platform.load('android');
|
||||
|
||||
@ -22,7 +22,7 @@ export function run() {
|
||||
});
|
||||
|
||||
it('should set ios via platformOverride, despite android querystring', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.url('/?ionicplatform=android');
|
||||
platform.load('ios');
|
||||
|
||||
@ -31,7 +31,7 @@ export function run() {
|
||||
});
|
||||
|
||||
it('should set ios via platformOverride', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.load('ios');
|
||||
|
||||
expect(platform.is('android')).toEqual(false);
|
||||
@ -39,7 +39,7 @@ export function run() {
|
||||
});
|
||||
|
||||
it('should set android via platformOverride', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.load('android');
|
||||
|
||||
expect(platform.is('android')).toEqual(true);
|
||||
@ -47,7 +47,7 @@ export function run() {
|
||||
});
|
||||
|
||||
it('should set ios via querystring', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.url('/?ionicplatform=ios');
|
||||
platform.load();
|
||||
|
||||
@ -58,7 +58,7 @@ export function run() {
|
||||
});
|
||||
|
||||
it('should set ios via querystring, even with android user agent', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.url('/?ionicplatform=ios');
|
||||
platform.userAgent(ANDROID_UA);
|
||||
platform.load();
|
||||
@ -68,7 +68,7 @@ export function run() {
|
||||
});
|
||||
|
||||
it('should set android via querystring', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.url('/?ionicplatform=android');
|
||||
platform.load();
|
||||
|
||||
@ -77,7 +77,7 @@ export function run() {
|
||||
});
|
||||
|
||||
it('should set android via querystring, even with ios user agent', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.url('/?ionicplatform=android');
|
||||
platform.userAgent(IPHONE_UA);
|
||||
platform.load();
|
||||
@ -87,7 +87,7 @@ export function run() {
|
||||
});
|
||||
|
||||
it('should set android via user agent', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.userAgent(ANDROID_UA);
|
||||
platform.load();
|
||||
|
||||
@ -97,7 +97,7 @@ export function run() {
|
||||
});
|
||||
|
||||
it('should set iphone via user agent', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.userAgent(IPHONE_UA);
|
||||
platform.load();
|
||||
|
||||
@ -109,7 +109,7 @@ export function run() {
|
||||
});
|
||||
|
||||
it('should set ipad via user agent', () => {
|
||||
let platform = new IonicPlatform();
|
||||
let platform = new Platform();
|
||||
platform.userAgent(IPAD_UA);
|
||||
platform.load();
|
||||
|
||||
|
Reference in New Issue
Block a user