From e162b2032f07245fb2827df69414b955a2bfca65 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Thu, 10 Sep 2015 13:29:04 +0300 Subject: [PATCH] if condition fixed + test added --- .../xml-declaration/xml-declaration-tests.ts | 19 +++++++++++++++++++ ui/builder/component-builder.ts | 4 +++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/apps/tests/xml-declaration/xml-declaration-tests.ts b/apps/tests/xml-declaration/xml-declaration-tests.ts index da6eac120..542b06767 100644 --- a/apps/tests/xml-declaration/xml-declaration-tests.ts +++ b/apps/tests/xml-declaration/xml-declaration-tests.ts @@ -215,6 +215,25 @@ export function test_parse_ShouldApplyCssFromCssFile() { } }; +export function test_parse_ShouldResolveExportsFromCodeFileAndApplyCssFile() { + var newPage: Page; + var pageFactory = function (): Page { + newPage = builder.parse(""); + return newPage; + }; + + helper.navigate(pageFactory); + TKUnit.assert(newPage.isLoaded, "The page should be loaded here."); + TKUnit.assert((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("", { diff --git a/ui/builder/component-builder.ts b/ui/builder/component-builder.ts index cc5dde37a..c94788ec8 100644 --- a/ui/builder/component-builder.ts +++ b/ui/builder/component-builder.ts @@ -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) {