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