@ionic/angular#Platform TypeScript Examples
The following examples show how to use
@ionic/angular#Platform.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: app.component.spec.ts From Uber-ServeMe-System with MIT License | 6 votes |
describe('AppComponent', () => {
let statusBarSpy, splashScreenSpy, platformReadySpy, platformSpy;
beforeEach(async(() => {
statusBarSpy = jasmine.createSpyObj('StatusBar', ['styleDefault']);
splashScreenSpy = jasmine.createSpyObj('SplashScreen', ['hide']);
platformReadySpy = Promise.resolve();
platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy });
TestBed.configureTestingModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [
{ provide: StatusBar, useValue: statusBarSpy },
{ provide: SplashScreen, useValue: splashScreenSpy },
{ provide: Platform, useValue: platformSpy },
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it('should initialize the app', async () => {
TestBed.createComponent(AppComponent);
expect(platformSpy.ready).toHaveBeenCalled();
await platformReadySpy;
expect(statusBarSpy.styleDefault).toHaveBeenCalled();
expect(splashScreenSpy.hide).toHaveBeenCalled();
});
// TODO: add more tests!
});
Example #2
Source File: ion-media-cache.directive.ts From ion-media-cache with MIT License | 6 votes |
constructor(
private el: ElementRef,
private file: File,
private renderer: Renderer2,
private platform: Platform,
private webview: WebView) {
this.tag = this.el;
if (!window['IonMediaCache']) {
window['IonMediaCache'] = {};
}
if (this.isMobile) {
fromEvent(document, 'deviceready').pipe(first()).subscribe(res => {
this.initCache();
});
} else {
this.initCache();
}
}
Example #3
Source File: app.component.spec.ts From mylog14 with GNU General Public License v3.0 | 6 votes |
describe('AppComponent', () => {
let platformIsSpy, platformSpy;
beforeEach(async(() => {
platformIsSpy = Promise.resolve();
platformSpy = jasmine.createSpyObj('Platform', { is: platformIsSpy });
TestBed.configureTestingModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [],
providers: [
{ provide: Platform, useValue: platformSpy },
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it('should initialize the app', async () => {
TestBed.createComponent(AppComponent);
expect(platformSpy.is).toHaveBeenCalled();
});
});
Example #4
Source File: app.component.ts From BetterCrewlink-mobile with GNU General Public License v3.0 | 6 votes |
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private backgroundMode: BackgroundMode,
private appCenterCrashes: AppCenterCrashes,
private appCenterAnalytics: AppCenterAnalytics
) {
this.initializeApp();
}
Example #5
Source File: app.component.ts From contact-tracer with MIT License | 6 votes |
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private bluetoothLE: BluetoothLE,
private databaseService: DatabaseService,
private authService: AuthService,
private loadingService: LoadingService,
private navCtrl: NavController
) {
this.initializeApp();
}
Example #6
Source File: app.component.ts From Elastos.Essentials.App with MIT License | 6 votes |
constructor(
private platform: Platform,
public splashScreen: SplashScreen,
private statusBar: StatusBar,
public storage: GlobalStorageService,
public theme: GlobalThemeService,
private globalNav: GlobalNavService,
private didSessions: GlobalDIDSessionsService,
private globalAppBackgroundService: GlobalAppBackgroundService,
private language: GlobalLanguageService,
private intentService: GlobalIntentService,
private screenOrientation: ScreenOrientation,
private notificationsService: GlobalNotificationsService,
private publicationService: GlobalPublicationService,
private globalHiveService: GlobalHiveService,
private walletConnect: GlobalWalletConnectService,
private globalFirebaseService: GlobalFirebaseService,
private globalNetworksService: GlobalNetworksService,
private globalElastosAPIService: GlobalElastosAPIService,
private globalStartupService: GlobalStartupService,
public globalEthereumService: GlobalEthereumRPCService, // IMPORTANT: Unused by this component, but keep it here for instantiation by angular
public globalBTCService: GlobalBTCRPCService, // IMPORTANT: Unused by this component, but keep it here for instantiation by angular
private credentialTypesService: GlobalCredentialTypesService,
private credentialToolboxService: GlobalCredentialToolboxService,
private globalSecurityService: GlobalSecurityService,
private globalELAUtxoService: GlobalELAUtxoService,
private firebase: FirebaseX
) { }
Example #7
Source File: app.component.ts From fyle-mobile-app with MIT License | 6 votes |
constructor(
private platform: Platform,
private router: Router,
private authService: AuthService,
private userEventService: UserEventService,
private menuController: MenuController,
private deviceService: DeviceService,
private appVersionService: AppVersionService,
private routerAuthService: RouterAuthService,
private networkService: NetworkService,
private freshChatService: FreshChatService,
private zone: NgZone,
private deepLinkService: DeepLinkService,
private pushNotificationService: PushNotificationService,
private trackingService: TrackingService,
private loginInfoService: LoginInfoService,
private navController: NavController,
private popoverController: PopoverController
) {
this.initializeApp();
this.registerBackButtonAction();
}
Example #8
Source File: app.component.ts From mycoradar with MIT License | 6 votes |
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private backgroundMode: BackgroundMode,
public toastController: ToastController,
private pushService: PushService,
private alertController: AlertController,
private service: BackendAdapterService,
private databaseSerive: DatabaseService,
private bluetoothService: BluetoothService
) {
this.initializeApp();
}
Example #9
Source File: app.component.ts From ionic-ecommerce-app with MIT License | 6 votes |
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private util: UtilService,
private router: Router,
) {
this.initializeApp();
}
Example #10
Source File: app.component.ts From actions-test with Apache License 2.0 | 6 votes |
constructor(
private menu: MenuController,
private platform: Platform,
private router: Router,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private storage: Storage,
private userData: UserData,
private swUpdate: SwUpdate,
private toastCtrl: ToastController,
) {
this.initializeApp();
}
Example #11
Source File: app.component.spec.ts From capture-lite with GNU General Public License v3.0 | 6 votes |
describe('AppComponent', () => {
let platformReadySpy: Promise<void>;
let platformSpy: Platform;
beforeEach(
waitForAsync(() => {
platformReadySpy = Promise.resolve();
platformSpy = jasmine.createSpyObj('Platform', {
ready: platformReadySpy,
});
TestBed.configureTestingModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [
CapacitorPluginsTestingModule,
HttpClientTestingModule,
getTranslocoTestingModule(),
MaterialTestingModule,
],
providers: [{ provide: Platform, useValue: platformSpy }],
}).compileComponents();
})
);
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
});
Example #12
Source File: app.component.spec.ts From onchat-web with Apache License 2.0 | 6 votes |
describe('AppComponent', () => {
let statusBarSpy, splashScreenSpy, platformReadySpy, platformSpy;
beforeEach(waitForAsync(() => {
statusBarSpy = jasmine.createSpyObj('StatusBar', ['styleDefault']);
splashScreenSpy = jasmine.createSpyObj('SplashScreen', ['hide']);
platformReadySpy = Promise.resolve();
platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy });
TestBed.configureTestingModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [
{ provide: Platform, useValue: platformSpy },
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it('should initialize the app', async () => {
TestBed.createComponent(AppComponent);
expect(platformSpy.ready).toHaveBeenCalled();
await platformReadySpy;
expect(statusBarSpy.styleDefault).toHaveBeenCalled();
expect(splashScreenSpy.hide).toHaveBeenCalled();
});
// TODO: add more tests!
});
Example #13
Source File: app.component.spec.ts From casual-chess with GNU General Public License v3.0 | 6 votes |
describe('AppComponent', () => {
let statusBarSpy, splashScreenSpy, platformReadySpy, platformSpy;
beforeEach(waitForAsync(() => {
statusBarSpy = jasmine.createSpyObj('StatusBar', ['styleDefault']);
splashScreenSpy = jasmine.createSpyObj('SplashScreen', ['hide']);
platformReadySpy = Promise.resolve();
platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy });
TestBed.configureTestingModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [
{ provide: StatusBar, useValue: statusBarSpy },
{ provide: SplashScreen, useValue: splashScreenSpy },
{ provide: Platform, useValue: platformSpy },
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it('should initialize the app', async () => {
TestBed.createComponent(AppComponent);
expect(platformSpy.ready).toHaveBeenCalled();
await platformReadySpy;
expect(statusBarSpy.styleDefault).toHaveBeenCalled();
expect(splashScreenSpy.hide).toHaveBeenCalled();
});
// TODO: add more tests!
});
Example #14
Source File: main.component.ts From WiLearning with GNU Affero General Public License v3.0 | 6 votes |
constructor(
public profile: ProfileService,
public peer: PeerService,
public chat: ChatService,
public classroom: ClassroomService,
public i18n: I18nService,
private menu: MenuController,
private platform: Platform,
private router: Router,
private signaling: SignalingService,
private logger: LoggerService,
private eventbus: EventbusService,
private popoverController: PopoverController,
private modalController: ModalController,
private ds: DocumentService,
private alert: AlertController,
private media: MediaService,
) {
this.initializeApp();
window.onunload = async (e) => {
await this.signaling.sendClosePeer(this.classroom.bClassStarter);
};
}
Example #15
Source File: app.component.ts From Uber-ServeMe-System with MIT License | 5 votes |
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
) {
this.initializeApp();
}
Example #16
Source File: ios-view-restriction.guard.ts From xBull-Wallet with GNU Affero General Public License v3.0 | 5 votes |
constructor(
private platform: Platform,
private router: Router,
) { }
Example #17
Source File: app.component.spec.ts From BetterCrewlink-mobile with GNU General Public License v3.0 | 5 votes |
describe('AppComponent', () => {
// tslint:disable-next-line
let statusBarSpy, splashScreenSpy, platformReadySpy, platformSpy;
beforeEach(waitForAsync(() => {
statusBarSpy = jasmine.createSpyObj('StatusBar', ['styleDefault']);
splashScreenSpy = jasmine.createSpyObj('SplashScreen', ['hide']);
platformReadySpy = Promise.resolve();
platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy });
TestBed.configureTestingModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [
{ provide: StatusBar, useValue: statusBarSpy },
{ provide: SplashScreen, useValue: splashScreenSpy },
{ provide: Platform, useValue: platformSpy },
],
imports: [RouterTestingModule.withRoutes([])],
}).compileComponents();
}));
it('should create the app', async () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it('should initialize the app', async () => {
TestBed.createComponent(AppComponent);
expect(platformSpy.ready).toHaveBeenCalled();
await platformReadySpy;
expect(statusBarSpy.styleDefault).toHaveBeenCalled();
expect(splashScreenSpy.hide).toHaveBeenCalled();
});
it('should have menu labels', async () => {
const fixture = await TestBed.createComponent(AppComponent);
await fixture.detectChanges();
const app = fixture.nativeElement;
const menuItems = app.querySelectorAll('ion-label');
expect(menuItems.length).toEqual(12);
expect(menuItems[0].textContent).toContain('Inbox');
expect(menuItems[1].textContent).toContain('Outbox');
});
it('should have urls', async () => {
const fixture = await TestBed.createComponent(AppComponent);
await fixture.detectChanges();
const app = fixture.nativeElement;
const menuItems = app.querySelectorAll('ion-item');
expect(menuItems.length).toEqual(12);
expect(menuItems[0].getAttribute('ng-reflect-router-link')).toEqual('/folder/Inbox');
expect(menuItems[1].getAttribute('ng-reflect-router-link')).toEqual('/folder/Outbox');
});
});
Example #18
Source File: ion-intl-tel-input.component.ts From ion-intl-tel-input with MIT License | 5 votes |
constructor(
private el: ElementRef,
private platform: Platform,
private ionIntlTelInputService: IonIntlTelInputService
) {}
Example #19
Source File: home.page.ts From contact-tracer with MIT License | 5 votes |
constructor(
private databaseService: DatabaseService,
private platform: Platform,
private navController: NavController) {
}
Example #20
Source File: favorites.service.ts From Elastos.Essentials.App with MIT License | 5 votes |
constructor(
public translate: TranslateService,
public theme: GlobalThemeService,
public httpClient: HttpClient,
public zone: NgZone,
private platform: Platform,
private globalStorageService: GlobalStorageService
) { }
Example #21
Source File: app.component.spec.ts From fyle-mobile-app with MIT License | 5 votes |
xdescribe('AppComponent', () => {
let platformReadySpy;
let platformSpy;
beforeEach(
waitForAsync(() => {
platformReadySpy = Promise.resolve();
platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy });
TestBed.configureTestingModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [{ provide: Platform, useValue: platformSpy }],
imports: [RouterTestingModule.withRoutes([])],
}).compileComponents();
})
);
it('should create the app', async () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it('should initialize the app', async () => {
TestBed.createComponent(AppComponent);
expect(platformSpy.ready).toHaveBeenCalled();
await platformReadySpy;
});
it('should have menu labels', async () => {
const fixture = await TestBed.createComponent(AppComponent);
await fixture.detectChanges();
const app = fixture.nativeElement;
const menuItems = app.querySelectorAll('ion-label');
expect(menuItems.length).toEqual(12);
expect(menuItems[0].textContent).toContain('Inbox');
expect(menuItems[1].textContent).toContain('Outbox');
});
it('should have urls', async () => {
const fixture = await TestBed.createComponent(AppComponent);
await fixture.detectChanges();
const app = fixture.nativeElement;
const menuItems = app.querySelectorAll('ion-item');
expect(menuItems.length).toEqual(12);
expect(menuItems[0].getAttribute('ng-reflect-router-link')).toEqual('/folder/Inbox');
expect(menuItems[1].getAttribute('ng-reflect-router-link')).toEqual('/folder/Outbox');
});
});
Example #22
Source File: recommendation.page.ts From mycoradar with MIT License | 5 votes |
constructor(public plt: Platform, public alertController: AlertController) {
}