Fix a crash when using a ProxyViewContainer in ListView item templates.

Not a regular {N} usage scenario, but it can happen with Angular components
which get wrapped in a proxy container.
This commit is contained in:
Hristo Deshev
2016-03-01 17:27:55 +02:00
parent d4cf77e5fc
commit a30c4e13a0
3 changed files with 37 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ import {LayoutBase} from "ui/layouts/layout-base"
import {StackLayout} from "ui/layouts/stack-layout"
import {GridLayout} from "ui/layouts/grid-layout"
import {ProxyViewContainer} from "ui/proxy-view-container";
import {ListView} from "ui/list-view";
export function test_add_children_to_attached_proxy() {
var outer = new StackLayout();
@@ -224,6 +225,25 @@ export function test_proxy_iniside_border() {
helper.buildUIAndRunTest(scroll, testAction);
}
export function test_proxy_iniside_listview_itemtemplate_crash() {
// Usually reproducible with an Angular component in the template
// We use a simple declaration here to simulate it.
var list = new ListView();
list.items = ["item 1"];
list.itemTemplate = `
<ProxyViewContainer>
<Label text="{{$value}}"></Label>
</ProxyViewContainer>
`;
function testAction(views: Array<View>) {
var page = <Page>views[1];
waitUntilElementLayoutIsValid(page);
};
helper.buildUIAndRunTest(list, testAction);
}
// TODO: Proxy as a direct child to of TabItem is not supported. Not sure if we want to support it.
//export function test_proxy_iniside_tab() {
// var proxy = new ProxyViewContainer();