mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Code file exports fixed
This commit is contained in:
@ -166,6 +166,13 @@ export function test_parse_ShouldResolveExportsFromCodeFile() {
|
|||||||
TKUnit.assert((<any>page).customCodeLoaded, "Parse should resolve exports from custom code file.");
|
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() {
|
export function test_parse_ShouldThrowErrorWhenInvalidCodeFileIsSpecified() {
|
||||||
var e: Error;
|
var e: Error;
|
||||||
try {
|
try {
|
||||||
|
@ -485,6 +485,10 @@ namespace xml2ui {
|
|||||||
|
|
||||||
if (this.rootComponentModule && this.rootComponentModule.component instanceof Page) {
|
if (this.rootComponentModule && this.rootComponentModule.component instanceof Page) {
|
||||||
this.currentPage = <Page>this.rootComponentModule.component;
|
this.currentPage = <Page>this.rootComponentModule.component;
|
||||||
|
|
||||||
|
if((<any>this.currentPage).exports){
|
||||||
|
this.context = (<any>this.currentPage).exports;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user