Fixed issue when bindingContext is bound more than once.

This commit is contained in:
Nedyalko Nikolov
2015-04-30 13:48:52 +03:00
parent 315959a590
commit 2e4b2eacf2
10 changed files with 136 additions and 46 deletions

View File

@@ -10,6 +10,7 @@ import utils = require("utils/utils");
import pageModule = require("ui/page");
import stackLayoutModule = require("ui/layouts/stack-layout");
import bindingBuilder = require("ui/builder/binding-builder");
import labelModule = require("ui/label");
// <snippet module="ui/core/bindable" title="bindable">
// For information and examples how to use bindings please refer to special [**Data binding**](../../../../bindings.md) topic.
@@ -459,4 +460,17 @@ export var test_getBindableOptionsFromStringTwoParamsNamedFormat = function () {
TKUnit.assert(bindOptions.targetProperty === "targetBindProperty", "Expected: targetBindProperty, Actual: " + bindOptions.targetProperty);
TKUnit.assert(bindOptions.expression === "bindProperty * 2", "Expected: bindProperty * 2, Actual:" + bindOptions.expression);
TKUnit.assert(bindOptions.twoWay === true, "Expected: true, Actual: " + bindOptions.twoWay);
}
export var test_TwoElementsBindingToSameBindingContext = function () {
var testFunc = function (page: pageModule.Page) {
var upperStackLabel = <labelModule.Label>(page.getViewById("upperStackLabel"));
var label1 = <labelModule.Label>(page.getViewById("label1"));
var label2 = <labelModule.Label>(page.getViewById("label2"));
TKUnit.assertEqual(upperStackLabel.text, label1.text);
TKUnit.assertEqual(upperStackLabel.text, label2.text);
}
helper.navigateToModuleAndRunTest("./tests/ui/bindingContext_testPage", testFunc);
}