File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -490,4 +490,26 @@ export var test_BindingContext_NavigatingForwardAndBack = function () {
490490 }
491491
492492 helper . navigateToModuleAndRunTest ( "./tests/ui/bindingContext_testPage1" , null , testFunc ) ;
493+ }
494+
495+ export var test_BindingToSource_FailsAfterBindingContextChange = function ( ) {
496+ var createLabel = function ( ) {
497+ var label = new labelModule . Label ( ) ;
498+ return label ;
499+ }
500+ var labelViewModel = new observable . Observable ( ) ;
501+ var expectedValue = "testValue" ;
502+ labelViewModel . set ( "testProperty" , expectedValue ) ;
503+
504+ var testFunc = function ( views : Array < viewModule . View > ) {
505+ var testLabel = < labelModule . Label > ( views [ 0 ] ) ;
506+ testLabel . bind ( { sourceProperty : "testProperty" , targetProperty : "text" } , labelViewModel ) ;
507+
508+ var page = < pageModule . Page > ( views [ 1 ] ) ;
509+ page . bindingContext = new observable . Observable ;
510+
511+ TKUnit . assertEqual ( testLabel . text , expectedValue ) ;
512+ }
513+
514+ helper . buildUIAndRunTest ( createLabel ( ) , testFunc ) ;
493515}
Original file line number Diff line number Diff line change @@ -102,7 +102,8 @@ export class Bindable extends dependencyObservable.DependencyObservable implemen
102102 for ( var p in this . _bindings ) {
103103 binding = this . _bindings [ p ] ;
104104
105- if ( binding . updating ) {
105+ var sourceIsNotBindingContext = ( binding . source && ( binding . source . get ( ) !== oldValue ) ) ;
106+ if ( binding . updating || sourceIsNotBindingContext ) {
106107 continue ;
107108 }
108109
You can’t perform that action at this time.
0 commit comments