mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Tests to test both a Declarative UI w/ CSS and a createPage w/ CSS file to verify CSS file is loaded
This commit is contained in:
@ -247,7 +247,7 @@ export function test_LoadPageFromModule() {
|
|||||||
try {
|
try {
|
||||||
var topFrame = FrameModule.topmost();
|
var topFrame = FrameModule.topmost();
|
||||||
TKUnit.assert(topFrame.currentPage.content instanceof LabelModule.Label, "Content of the test page should be a Label created within test-page-module.");
|
TKUnit.assert(topFrame.currentPage.content instanceof LabelModule.Label, "Content of the test page should be a Label created within test-page-module.");
|
||||||
var testLabel = <LabelModule.Label>topFrame.currentPage.content
|
var testLabel = <LabelModule.Label>topFrame.currentPage.content;
|
||||||
TKUnit.assert(testLabel.text === "Label created within a page module.");
|
TKUnit.assert(testLabel.text === "Label created within a page module.");
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
@ -255,6 +255,35 @@ export function test_LoadPageFromModule() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function test_LoadPageFromDeclarativeWithCSS() {
|
||||||
|
helper.navigateToModule("ui/page/test-page-declarative-css");
|
||||||
|
try {
|
||||||
|
var topFrame = FrameModule.topmost();
|
||||||
|
TKUnit.assert(topFrame.currentPage.content instanceof LabelModule.Label, "Content of the test page should be a Label created within test-page-module-css.");
|
||||||
|
var testLabel = <LabelModule.Label>topFrame.currentPage.content;
|
||||||
|
TKUnit.assert(testLabel.text === "Label created within a page declarative file with css.");
|
||||||
|
TKUnit.assert(testLabel.style.backgroundColor.hex === "#ff00ff00", "Expected: #ff00ff00, Actual: " + testLabel.style.backgroundColor.hex);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
helper.goBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export function test_LoadPageFromModuleWithCSS() {
|
||||||
|
helper.navigateToModule("ui/page/test-page-module-css");
|
||||||
|
try {
|
||||||
|
var topFrame = FrameModule.topmost();
|
||||||
|
TKUnit.assert(topFrame.currentPage.content instanceof LabelModule.Label, "Content of the test page should be a Label created within test-page-module-css.");
|
||||||
|
var testLabel = <LabelModule.Label>topFrame.currentPage.content;
|
||||||
|
TKUnit.assert(testLabel.text === "Label created within a page module css.");
|
||||||
|
TKUnit.assert(testLabel.style.backgroundColor.hex === "#ff00ff00", "Expected: #ff00ff00, Actual: " + testLabel.style.backgroundColor.hex);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
helper.goBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function test_NavigateToPageCreatedWithNavigationEntry() {
|
export function test_NavigateToPageCreatedWithNavigationEntry() {
|
||||||
var expectedText = "Label created with a NavigationEntry";
|
var expectedText = "Label created with a NavigationEntry";
|
||||||
var testPage: PageModule.Page;
|
var testPage: PageModule.Page;
|
||||||
|
3
apps/tests/ui/page/test-page-declarative-css.css
Normal file
3
apps/tests/ui/page/test-page-declarative-css.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Label {
|
||||||
|
background-color: #ff00ff00;
|
||||||
|
}
|
3
apps/tests/ui/page/test-page-declarative-css.xml
Normal file
3
apps/tests/ui/page/test-page-declarative-css.xml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<Page>
|
||||||
|
<Label text="Label created within a page declarative file with css."/>
|
||||||
|
</Page>
|
3
apps/tests/ui/page/test-page-module-css.css
Normal file
3
apps/tests/ui/page/test-page-module-css.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Label {
|
||||||
|
background-color: #ff00ff00;
|
||||||
|
}
|
19
apps/tests/ui/page/test-page-module-css.ts
Normal file
19
apps/tests/ui/page/test-page-module-css.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import PageModule = require("ui/page");
|
||||||
|
import LabelModule = require("ui/label");
|
||||||
|
|
||||||
|
export class TestPageModule extends PageModule.Page {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
var label = new LabelModule.Label();
|
||||||
|
label.text = "Label created within a page module css.";
|
||||||
|
|
||||||
|
this.content = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createPage() {
|
||||||
|
return new TestPageModule();
|
||||||
|
}
|
||||||
|
|
||||||
|
//export var Page = new TestPageModule();
|
Reference in New Issue
Block a user