if condition fixed + test added

This commit is contained in:
Vladimir Enchev
2015-09-10 13:29:04 +03:00
parent 2d155f941d
commit e162b2032f
2 changed files with 22 additions and 1 deletions

View File

@ -215,6 +215,25 @@ export function test_parse_ShouldApplyCssFromCssFile() {
}
};
export function test_parse_ShouldResolveExportsFromCodeFileAndApplyCssFile() {
var newPage: Page;
var pageFactory = function (): Page {
newPage = <Page>builder.parse("<Page codeFile='~/xml-declaration/custom-code-file' cssFile='~/xml-declaration/custom-css-file.css' loaded='loaded'><Label cssClass='MyClass' /></Page>");
return newPage;
};
helper.navigate(pageFactory);
TKUnit.assert(newPage.isLoaded, "The page should be loaded here.");
TKUnit.assert((<any>newPage).customCodeLoaded, "Parse should resolve exports from custom code file.");
try {
helper.assertViewBackgroundColor(newPage.content, "#008000");
}
finally {
helper.goBack();
}
};
export function test_parse_ShouldFindEventHandlersInExports() {
var loaded;
var page = builder.parse("<Page loaded='myLoaded'></Page>", {

View File

@ -99,7 +99,9 @@ export function getComponentModule(elementName: string, namespace: string, attri
} else {
throw new Error("Code file atribute is valid only for pages!");
}
} else if (attributes[CSSFILE]) {
}
if (attributes[CSSFILE]) {
if (instance instanceof pages.Page) {
var cssFilePath = attributes[CSSFILE].trim();
if (cssFilePath.indexOf("~/") === 0) {