@@ -1603,6 +1603,44 @@ describe('ui-select tests', function() {
1603
1603
expect ( el . find ( '.ui-select-match-item' ) . length ) . toBe ( 0 ) ;
1604
1604
} ) ;
1605
1605
1606
+ it ( 'should render intial state with data-multiple attribute' , function ( ) {
1607
+ // ensure match template has been loaded by having more than one selection
1608
+ scope . selection . selectedMultiple = [ scope . people [ 0 ] , scope . people [ 1 ] ] ;
1609
+
1610
+ var el = compileTemplate (
1611
+ '<ui-select data-multiple ng-model="selection.selectedMultiple" theme="bootstrap" style="width: 800px;"> \
1612
+ <ui-select-match placeholder="Pick one...">{{$item.name}} <{{$item.email}}></ui-select-match> \
1613
+ <ui-select-choices repeat="person in people | filter: $select.search"> \
1614
+ <div ng-bind-html="person.name | highlight: $select.search"></div> \
1615
+ <div ng-bind-html="person.email | highlight: $select.search"></div> \
1616
+ </ui-select-choices> \
1617
+ </ui-select>'
1618
+ ) ;
1619
+
1620
+ expect ( el ) . toHaveClass ( 'ui-select-multiple' ) ;
1621
+ expect ( el . scope ( ) . $select . selected . length ) . toBe ( 2 ) ;
1622
+ expect ( el . find ( '.ui-select-match-item' ) . length ) . toBe ( 2 ) ;
1623
+ } ) ;
1624
+
1625
+ it ( 'should render intial state with x-multiple attribute' , function ( ) {
1626
+ // ensure match template has been loaded by having more than one selection
1627
+ scope . selection . selectedMultiple = [ scope . people [ 0 ] , scope . people [ 1 ] ] ;
1628
+
1629
+ var el = compileTemplate (
1630
+ '<ui-select x-multiple ng-model="selection.selectedMultiple" theme="bootstrap" style="width: 800px;"> \
1631
+ <ui-select-match placeholder="Pick one...">{{$item.name}} <{{$item.email}}></ui-select-match> \
1632
+ <ui-select-choices repeat="person in people | filter: $select.search"> \
1633
+ <div ng-bind-html="person.name | highlight: $select.search"></div> \
1634
+ <div ng-bind-html="person.email | highlight: $select.search"></div> \
1635
+ </ui-select-choices> \
1636
+ </ui-select>'
1637
+ ) ;
1638
+
1639
+ expect ( el ) . toHaveClass ( 'ui-select-multiple' ) ;
1640
+ expect ( el . scope ( ) . $select . selected . length ) . toBe ( 2 ) ;
1641
+ expect ( el . find ( '.ui-select-match-item' ) . length ) . toBe ( 2 ) ;
1642
+ } ) ;
1643
+
1606
1644
it ( 'should set model as an empty array if ngModel isnt defined after an item is selected' , function ( ) {
1607
1645
1608
1646
// scope.selection.selectedMultiple = [];
0 commit comments