mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
default namespace replaced with regex
This commit is contained in:
@ -210,3 +210,31 @@ export function test_parse_ShouldParseCustomComponentWithoutXmlInListViewTemplat
|
|||||||
helper.goBack();
|
helper.goBack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function test_parse_ShouldParseNestedListViewInListViewTemplate() {
|
||||||
|
var p = <page.Page>builder.parse('<Page xmlns="http://www.nativescript.org/tns.xsd"><ListView items="{{ items }}" itemLoading="{{ itemLoading }}"><ListView.itemTemplate><ListView items="{{ subItems }}" /></ListView.itemTemplate></ListView></Page>');
|
||||||
|
|
||||||
|
function testAction(views: Array<viewModule.View>) {
|
||||||
|
var ctrl;
|
||||||
|
|
||||||
|
var obj = new observable.Observable();
|
||||||
|
obj.set("items", [{ subItems: [1] }]);
|
||||||
|
obj.set("itemLoading", function (args: listViewModule.ItemEventData) {
|
||||||
|
ctrl = args.view
|
||||||
|
});
|
||||||
|
p.bindingContext = obj;
|
||||||
|
|
||||||
|
TKUnit.wait(0.2);
|
||||||
|
|
||||||
|
TKUnit.assert(ctrl instanceof listViewModule.ListView, "Expected result: ListView!; Actual result: " + ctrl);
|
||||||
|
};
|
||||||
|
|
||||||
|
helper.navigate(function () { return p; });
|
||||||
|
|
||||||
|
try {
|
||||||
|
testAction([p.content, p]);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
helper.goBack();
|
||||||
|
}
|
||||||
|
}
|
@ -154,7 +154,10 @@ function parseInternal(value: string, exports: any): componentBuilder.ComponentM
|
|||||||
throw new Error("XML parse error: " + e.message);
|
throw new Error("XML parse error: " + e.message);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
xmlParser.parse(value.replace('xmlns="http://www.nativescript.org/tns.xsd"', "").replace("xmlns='http://www.nativescript.org/tns.xsd'", ""));
|
if (types.isString(value)) {
|
||||||
|
value = value.replace(/xmlns=("|')http:\/\/www.nativescript.org\/tns.xsd\1/, "");
|
||||||
|
xmlParser.parse(value);
|
||||||
|
}
|
||||||
|
|
||||||
return rootComponentModule;
|
return rootComponentModule;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user