This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree 2 files changed +17
-2
lines changed
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,13 @@ angular.module('ui.select', [])
54
54
var ngModelCtrl = controllers [ 1 ] ;
55
55
56
56
scope . $watch ( '$select.selected' , function ( newVal , oldVal ) {
57
- ngModelCtrl . $setViewValue ( newVal ) ;
57
+ if ( ngModelCtrl . $viewValue != newVal ) ngModelCtrl . $setViewValue ( newVal ) ;
58
58
} ) ;
59
59
60
+ ngModelCtrl . $render = function ( ) {
61
+ scope . $select . selected = ngModelCtrl . $viewValue ;
62
+ } ;
63
+
60
64
$document . bind ( 'click' , function ( evt ) {
61
65
if ( angular . element ( evt . target ) . hasClass ( 'ui-select-search' ) ) {
62
66
return ;
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ describe('ui-select tests', function() {
39
39
return element ;
40
40
} ;
41
41
42
- it ( 'should compile basic ui-select-* elements ' , function ( ) {
42
+ it ( 'should compile child directives ' , function ( ) {
43
43
44
44
var el = uiSelectElInstance1 ( ) ;
45
45
@@ -60,4 +60,15 @@ describe('ui-select tests', function() {
60
60
61
61
} ) ;
62
62
63
+ it ( 'should correctly render initial state' , function ( ) {
64
+
65
+ scope . selection = scope . matches [ 0 ] ;
66
+
67
+ var el = uiSelectElInstance1 ( ) ;
68
+ var matchLabel = $ ( '.ui-select-match > div[ng-transclude]' , el ) . text ( ) ;
69
+
70
+ expect ( matchLabel ) . toEqual ( 'Wladimir Coka' ) ;
71
+
72
+ } ) ;
73
+
63
74
} ) ;
You can’t perform that action at this time.
0 commit comments