@@ -2009,7 +2009,43 @@ describe('ui-select tests', function () {
2009
2009
2010
2010
el . find ( '.ui-select-match-item' ) . first ( ) . find ( '.ui-select-match-close' ) . click ( ) ;
2011
2011
expect ( el . scope ( ) . $select . sizeSearchInput ) . toHaveBeenCalled ( ) ;
2012
+ } ) ;
2013
+
2014
+ it ( 'input should take the whole remaining part of the current row, or, if smaller than the min input width, go to the next row' , function ( ) {
2015
+ //scope.selection.selectedMultiple = [scope.people[4], scope.people[5]]; //Wladimir & Samantha
2016
+ var el = createUiSelectMultiple ( {
2017
+ tagging : '' ,
2018
+ taggingLabel : 'false'
2019
+ } ) ;
2020
+
2021
+ //angular.element(document.body).css("width", "100%");
2022
+ angular . element ( document . body ) . append ( el ) ;
2023
+ $timeout . flush ( ) ; // needed to make input take it's real width, not 4 or 10 px
2024
+
2025
+ var searchInput = el . find ( '.ui-select-search' ) ;
2012
2026
2027
+ // no item selected, input should fill the whole row
2028
+ expect ( searchInput . outerWidth ( ) ) . toBe ( 792 ) ;
2029
+
2030
+ clickItem ( el , 'Wladimir' ) ;
2031
+ $timeout . flush ( ) ;
2032
+ // 2 items are selected, input should be less than 100%
2033
+ expect ( searchInput . outerWidth ( ) ) . toBe ( 548 ) ; // remaining width of the row
2034
+
2035
+ clickItem ( el , 'Samantha' ) ;
2036
+ $timeout . flush ( ) ;
2037
+ // input should be even smaller than before
2038
+ expect ( searchInput . outerWidth ( ) ) . toBe ( 304 ) ;
2039
+
2040
+ clickItem ( el , 'Adrian' ) ;
2041
+ $timeout . flush ( ) ;
2042
+ // min input width is 50px (unfortunately hardcoded), so we are still in the first row
2043
+ expect ( searchInput . outerWidth ( ) ) . toBe ( 98 ) ;
2044
+
2045
+ clickItem ( el , 'Nicole' ) ;
2046
+ $timeout . flush ( ) ;
2047
+ // input goes to the second row and should still fill the whole row minus the item width (whole row should be clickable)
2048
+ expect ( searchInput . outerWidth ( ) ) . toBe ( 649 ) ;
2013
2049
} ) ;
2014
2050
2015
2051
it ( 'should update size of search input use container width' , function ( ) {
0 commit comments