Implements: Proxy layout properties for the ProxyViewContainer (#8150)

* feat(ProxyViewContainer): proxy layout properties to children

* update import path

* fix(ProxyViewContainer): Layout properties not applied to new children

* test(ProxyViewContainer): Add test for layout properties

* chore: fix tslint errors
This commit is contained in:
Morten Sjøgren
2019-12-02 10:13:23 +01:00
committed by Alexander Vakrilov
parent 3199a392b4
commit 2bb7ad9d01
2 changed files with 129 additions and 1 deletions

View File

@@ -43,6 +43,35 @@ export function test_children_immediately_registered_in_parent_grid_layout() {
helper.buildUIAndRunTest(outer, testAction);
}
export function test_proxy_layout_properties() {
const outer = new GridLayout();
const proxy = new ProxyViewContainer();
function testAction(views: Array<View>) {
outer.addChild(proxy);
const btn = createBtn("1");
proxy.addChild(btn);
proxy.row = 1;
TKUnit.assertEqual(proxy.row, btn.row, "Proxy row value to existing child");
const btn2 = createBtn("2");
proxy.addChild(btn2);
TKUnit.assertEqual(proxy.row, btn2.row, "Proxy row value to new child");
proxy.removeChild(btn2);
btn.row = 0;
TKUnit.assertNotEqual(proxy.row, btn.row, "Child value changed");
proxy.row = 1;
TKUnit.assertNotEqual(proxy.row, btn.row, "Changed child value not overridden");
}
helper.buildUIAndRunTest(outer, testAction);
}
export function test_children_registered_in_parent_grid_layout_on_attach() {
const outer = new GridLayout();
const proxy = new ProxyViewContainer();