diff --git a/apps/tests/ui/bindable-tests.ts b/apps/tests/ui/bindable-tests.ts index 0cc4354c2..85c617145 100644 --- a/apps/tests/ui/bindable-tests.ts +++ b/apps/tests/ui/bindable-tests.ts @@ -465,6 +465,39 @@ export var test_getBindableOptionsFromStringTwoParamsNamedFormat = function () { TKUnit.assert(bindOptions.twoWay === true, "Expected: true, Actual: " + bindOptions.twoWay); } +export var test_getBindingOptionsFromStringWithFunctionWitnMoreParams = function () { + var bindingExpression = "bindProperty, converter(bindProperty, param1)"; + var bindOptions = bindingBuilder.getBindingOptions("targetBindProperty", bindingExpression); + + TKUnit.assertEqual(bindOptions.sourceProperty, "bindProperty"); + TKUnit.assertEqual(bindOptions.targetProperty, "targetBindProperty"); + TKUnit.assertEqual(bindOptions.expression, "converter(bindProperty, param1)"); + TKUnit.assertEqual(bindOptions.twoWay, true); +} + +export var test_getBindingOptionsFromStringWithFunctionArrayParams = function () { + var bindingExpression = "bindProperty, converter(bindProperty, [param1, param2])"; + var bindOptions = bindingBuilder.getBindingOptions("targetBindProperty", bindingExpression); + + TKUnit.assertEqual(bindOptions.sourceProperty, "bindProperty"); + TKUnit.assertEqual(bindOptions.targetProperty, "targetBindProperty"); + TKUnit.assertEqual(bindOptions.expression, "converter(bindProperty, [param1, param2])"); + TKUnit.assertEqual(bindOptions.twoWay, true); +} + +export var test_bindingToNestedPropertyWithValueSyntax = function () { + var bindingSource = new observable.Observable(); + bindingSource.set("testProperty", "testValue"); + + var testElement = new bindable.Bindable(); + testElement.bind({ + sourceProperty: "$value.testProperty", + targetProperty: "targetPropertyName" + }, bindingSource); + + TKUnit.assertEqual(testElement.get("targetPropertyName"), "testValue"); +} + export var test_TwoElementsBindingToSameBindingContext = function () { var testFunc = function (page: pageModule.Page) { var upperStackLabel = (page.getViewById("upperStackLabel")); diff --git a/apps/tests/ui/list-view/list-view-tests.ts b/apps/tests/ui/list-view/list-view-tests.ts index 3885d787a..e7053a84a 100644 --- a/apps/tests/ui/list-view/list-view-tests.ts +++ b/apps/tests/ui/list-view/list-view-tests.ts @@ -530,6 +530,56 @@ export function test_BindingListViewToASimpleArrayWithExpression() { helper.buildUIAndRunTest(listView, testAction); } +export function test_bindingToParentObject() { + var listView = new listViewModule.ListView(); + var expectedValue = "parentTestValue"; + + function testAction(views: Array) { + var listViewModel = new observable.Observable(); + listViewModel.set("items", [1, 2, 3]); + listViewModel.set("parentTestProp", expectedValue); + listView.bindingContext = listViewModel; + listView.bind({ sourceProperty: "items", targetProperty: "items" }); + listView.itemTemplate = "