Skip to content

Rxjs6 + remove snippets tests #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions tests/app/snippets/navigation/page-outlet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { registerTestApp } from "../../tests/test-app";
import { ApplicationRef } from "@angular/core";
import { Router, NavigationStart, NavigationEnd } from "@angular/router";
// >> page-outlet-example
Expand All @@ -22,8 +21,6 @@ export class PageNavigationApp {
public done: Promise<void>;

constructor(public router: Router, public appRef: ApplicationRef) {
registerTestApp(PageNavigationApp, this, appRef);

this.done = new Promise<void>((resolve, reject) => {
this.router.events.subscribe((e) => {
if (e instanceof NavigationStart) {
Expand Down
13 changes: 5 additions & 8 deletions tests/app/snippets/navigation/router-outlet.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {registerTestApp} from "../../tests/test-app";
import { ApplicationRef } from "@angular/core";
// >> router-outlet-example
import { Component, NgModule } from "@angular/core";
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
import { NativeScriptRouterModule } from "nativescript-angular/router";
import { Router, NavigationStart, NavigationEnd } from "@angular/router";
import { routes } from "./app.routes";
import {FirstComponent, SecondComponent} from "./navigation-common";
import { FirstComponent, SecondComponent } from "./navigation-common";

@Component({
selector: "navigation-test",
Expand All @@ -30,8 +29,6 @@ export class NavigationApp {
public done: Promise<void>;

constructor(public router: Router, public appRef: ApplicationRef) {
registerTestApp(NavigationApp, this, appRef);

this.done = new Promise<void>((resolve, reject) => {
this.router.events.subscribe((e) => {
if (e instanceof NavigationStart) {
Expand All @@ -55,13 +52,13 @@ export class NavigationApp {
NativeScriptRouterModule.forRoot(routes)
]
})
export class NavigationAppModule {}
export class NavigationAppModule { }

// >> (hide)
function start_snippet() {
// << (hide)
platformNativeScriptDynamic().bootstrapModule(NavigationAppModule);
// >> (hide)
// << (hide)
platformNativeScriptDynamic().bootstrapModule(NavigationAppModule);
// >> (hide)
}
// << (hide)
// << router-outlet-example
4 changes: 1 addition & 3 deletions tests/app/tests/renderer-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Component, ComponentRef, ElementRef, NgZone, Renderer2, ViewChild } fro
import { ProxyViewContainer } from "ui/proxy-view-container";
import { Red } from "color/known-colors";
import { dumpView } from "./test-utils";
import { TestApp } from "./test-app";
import { LayoutBase } from "tns-core-modules/ui/layouts/layout-base";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
import { ContentView } from "tns-core-modules/ui/content-view";
Expand All @@ -16,8 +15,7 @@ import { isIOS } from "tns-core-modules/platform";
import { View, fontInternalProperty, backgroundInternalProperty } from "tns-core-modules/ui/core/view"
import { nsTestBedAfterEach, nsTestBedBeforeEach, nsTestBedRender } from "nativescript-angular/testing";
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { Observable } from "rxjs/Observable";
import { ReplaySubject } from "rxjs/ReplaySubject";
import { Observable, ReplaySubject } from "rxjs";

@Component({
template: `<StackLayout><Label text="Layout"></Label></StackLayout>`
Expand Down
95 changes: 0 additions & 95 deletions tests/app/tests/snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { assert } from "./test-config";

import { NavigationEnd, NavigationStart } from "@angular/router";
import { Subscription } from "rxjs";
import { bootstrapTestApp, destroyTestApp } from "./test-app";

import { GestureComponent } from "../snippets/gestures.component";
import { LayoutsComponent } from "../snippets/layouts.component";
Expand Down Expand Up @@ -56,97 +55,3 @@ describe("Snippets", () => {
});
});
});

describe("Snippets Navigation", () => {
let runningApp: any;
let subscription: Subscription;

const cleanup = () => {
if (subscription) {
subscription.unsubscribe();
subscription = null;
}
if (runningApp) {
destroyTestApp(runningApp);
runningApp = null;
}
};

after(cleanup);

it("router-outlet app", (done) => {
bootstrapTestApp(NavigationApp, [], routes, [
NavigationApp,
FirstComponent,
SecondComponent
]).then((app) => {
runningApp = app;

return runningApp.done.then(() => {
assert(app.startEvent instanceof NavigationStart);
assert.equal("/", app.startEvent.url);

assert(app.endEvent instanceof NavigationEnd);
assert.equal("/", app.endEvent.url);
assert.equal("/first", app.endEvent.urlAfterRedirects);

cleanup();
}).then(() => done(), err => done(err));
});
});

//TODO: Skip the page-router-outlet test as it causes a crash in android in the current test-runner setup
(isIOS ? it : it.skip)("page-router-outlet app", (done) => {
bootstrapTestApp(PageNavigationApp, [], routes, [
PageNavigationApp,
FirstComponent,
SecondComponent
]).then((app) => {
runningApp = app;

return runningApp.done.then(() => {
assert(app.startEvent instanceof NavigationStart);
assert.equal("/", app.startEvent.url);

assert(app.endEvent instanceof NavigationEnd);
assert.equal("/", app.endEvent.url);
assert.equal("/first", app.endEvent.urlAfterRedirects);

cleanup();
}).then(() => done(), err => done(err));
});
});
});

describe("Snippets ListView", () => {
let runningApp: any;

const cleanup = () => {
if (runningApp) {
destroyTestApp(runningApp);
runningApp = null;
}
};

after(cleanup);

it("template selector", (done) => {
bootstrapTestApp(
ListTemplateSelectorTest,
[DataService],
null,
[
HeaderComponent,
ItemComponent,
ListTemplateSelectorTest
])
.then((app) => {
setTimeout(() => {
cleanup();
done();
}, 100);
})
.catch(err => done(err));
});
});

148 changes: 0 additions & 148 deletions tests/app/tests/test-app.ts

This file was deleted.