Skip to content

Commit 28177be

Browse files
author
vakrilov
committed
platfrom filters tests
1 parent 7810db1 commit 28177be

File tree

1 file changed

+17
-26
lines changed

1 file changed

+17
-26
lines changed

Diff for: tests/app/tests/platform-filter-components.ts

+17-26
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
//make sure you import mocha-config before @angular/core
2-
import {assert} from "./test-config";
3-
import {Component, ElementRef} from "@angular/core";
4-
import {ProxyViewContainer} from "ui/proxy-view-container";
5-
import {dumpView, createDevice} from "./test-utils";
6-
import {TestApp} from "./test-app";
7-
import {DEVICE} from "nativescript-angular/platform-providers";
8-
import {platformNames} from "platform";
2+
import { assert } from "./test-config";
3+
import { Component, ElementRef } from "@angular/core";
4+
import { dumpView, createDevice } from "./test-utils";
5+
import { TestApp } from "./test-app";
6+
import { DEVICE } from "nativescript-angular/platform-providers";
7+
import { platformNames } from "platform";
98

109
@Component({
1110
template: `
@@ -37,12 +36,12 @@ export class PlatformSpecificAttributeComponent {
3736
constructor(public elementRef: ElementRef) { }
3837
}
3938

40-
describe('Platofrm filter directives', () => {
39+
describe('Platform filter directives', () => {
4140
describe('on IOS device', () => {
4241
let testApp: TestApp = null;
4342

4443
before(() => {
45-
return TestApp.create([{provide: DEVICE, useValue: createDevice(platformNames.ios)}], [PlatformSpecificAttributeComponent, AndroidSpecificComponent, IosSpecificComponent]).then((app) => {
44+
return TestApp.create([{ provide: DEVICE, useValue: createDevice(platformNames.ios) }], [PlatformSpecificAttributeComponent, AndroidSpecificComponent, IosSpecificComponent]).then((app) => {
4645
testApp = app;
4746
});
4847
});
@@ -51,21 +50,17 @@ describe('Platofrm filter directives', () => {
5150
testApp.dispose();
5251
});
5352

54-
it("does render ios sepecific conternt", () => {
53+
it("does render ios specific content", () => {
5554
return testApp.loadComponent(IosSpecificComponent).then((componentRef) => {
5655
const componentRoot = componentRef.instance.elementRef.nativeElement;
57-
assert.equal(
58-
"(ProxyViewContainer (StackLayout (ProxyViewContainer (template), (Label[text=IOS]))))",
59-
dumpView(componentRoot, true));
56+
assert.isTrue(dumpView(componentRoot, true).indexOf("(Label[text=IOS])") >= 0);
6057
});
6158
});
6259

63-
it("does not render android sepecific conternt", () => {
60+
it("does not render android specific content", () => {
6461
return testApp.loadComponent(AndroidSpecificComponent).then((componentRef) => {
6562
const componentRoot = componentRef.instance.elementRef.nativeElement;
66-
assert.equal(
67-
"(ProxyViewContainer (StackLayout (ProxyViewContainer (template))))",
68-
dumpView(componentRoot, true));
63+
assert.isTrue(dumpView(componentRoot, true).indexOf("Label") < 0);
6964
});
7065
});
7166

@@ -84,7 +79,7 @@ describe('Platofrm filter directives', () => {
8479
let testApp: TestApp = null;
8580

8681
before(() => {
87-
return TestApp.create([{provide: DEVICE, useValue: createDevice(platformNames.android)}], [AndroidSpecificComponent, IosSpecificComponent, PlatformSpecificAttributeComponent]).then((app) => {
82+
return TestApp.create([{ provide: DEVICE, useValue: createDevice(platformNames.android) }], [AndroidSpecificComponent, IosSpecificComponent, PlatformSpecificAttributeComponent]).then((app) => {
8883
testApp = app;
8984
});
9085
});
@@ -93,21 +88,17 @@ describe('Platofrm filter directives', () => {
9388
testApp.dispose();
9489
});
9590

96-
it("does render android sepecific conternt", () => {
91+
it("does render android specific content", () => {
9792
return testApp.loadComponent(AndroidSpecificComponent).then((componentRef) => {
9893
const componentRoot = componentRef.instance.elementRef.nativeElement;
99-
assert.equal(
100-
"(ProxyViewContainer (StackLayout (ProxyViewContainer (template), (Label[text=ANDROID]))))",
101-
dumpView(componentRoot, true));
94+
assert.isTrue(dumpView(componentRoot, true).indexOf("(Label[text=ANDROID])") >= 0);
10295
});
10396
});
10497

105-
it("does not render ios sepecific conternt", () => {
98+
it("does not render ios specific content", () => {
10699
return testApp.loadComponent(IosSpecificComponent).then((componentRef) => {
107100
const componentRoot = componentRef.instance.elementRef.nativeElement;
108-
assert.equal(
109-
"(ProxyViewContainer (StackLayout (ProxyViewContainer (template))))",
110-
dumpView(componentRoot, true));
101+
assert.isTrue(dumpView(componentRoot, true).indexOf("Label") < 0);
111102
});
112103
});
113104

0 commit comments

Comments
 (0)