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:
Nathanael Anderson
2015-08-26 03:19:02 -05:00
parent a95dafd72e
commit a67e46fc98
5 changed files with 58 additions and 1 deletions

View File

@ -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;

View File

@ -0,0 +1,3 @@
Label {
background-color: #ff00ff00;
}

View File

@ -0,0 +1,3 @@
<Page>
<Label text="Label created within a page declarative file with css."/>
</Page>

View File

@ -0,0 +1,3 @@
Label {
background-color: #ff00ff00;
}

View 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();