Code file exports fixed

This commit is contained in:
Vladimir Enchev
2016-03-09 14:35:20 +02:00
parent dcd389e0de
commit 2572cc13f7
2 changed files with 11 additions and 0 deletions

View File

@ -166,6 +166,13 @@ export function test_parse_ShouldResolveExportsFromCodeFile() {
TKUnit.assert((<any>page).customCodeLoaded, "Parse should resolve exports from custom code file.");
}
export function test_parse_ShouldResolveExportsFromCodeFileForPageContent() {
var page = builder.parse("<Page codeFile='~/xml-declaration/custom-code-file' loaded='loaded'><Button loaded='loaded' /></Page>");
(<any>page).content._emit("loaded");
TKUnit.assert((<any>page).content.customCodeLoaded, "Parse should resolve exports from custom code file for page content.");
}
export function test_parse_ShouldThrowErrorWhenInvalidCodeFileIsSpecified() {
var e: Error;
try {

View File

@ -485,6 +485,10 @@ namespace xml2ui {
if (this.rootComponentModule && this.rootComponentModule.component instanceof Page) {
this.currentPage = <Page>this.rootComponentModule.component;
if((<any>this.currentPage).exports){
this.context = (<any>this.currentPage).exports;
}
}
}