Skip to content
This repository was archived by the owner on Jun 29, 2022. It is now read-only.

Commit 0469756

Browse files
committed
Revert "fix(uiSelectController): calculateContainerWidth use width of ui-select-container"
This reverts commit 7ad4ef1.
1 parent 92b2cc3 commit 0469756

File tree

7 files changed

+13
-37
lines changed

7 files changed

+13
-37
lines changed

dist/select.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* ui-select
33
* http://github.com/angular-ui/ui-select
4-
* Version: 0.19.8 - 2017-06-27T22:41:15.889Z
4+
* Version: 0.19.8 - 2017-06-27T23:11:39.236Z
55
* License: MIT
66
*/
77

dist/select.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* ui-select
33
* http://github.com/angular-ui/ui-select
4-
* Version: 0.19.8 - 2017-06-27T22:41:15.750Z
4+
* Version: 0.19.8 - 2017-06-27T23:11:39.099Z
55
* License: MIT
66
*/
77

@@ -817,7 +817,7 @@ uis.controller('uiSelectCtrl',
817817
ctrl.sizeSearchInput = function() {
818818

819819
var input = ctrl.searchInput[0],
820-
container = ctrl.$element[0],
820+
container = ctrl.searchInput.parent().parent()[0],
821821
minInputWidth = 50,
822822
calculateContainerWidth = function() {
823823
// Return the container width only if the search input is visible
@@ -827,7 +827,7 @@ uis.controller('uiSelectCtrl',
827827
if (containerWidth === 0) {
828828
return false;
829829
}
830-
var inputWidth = containerWidth - input.offsetLeft;
830+
var inputWidth = containerWidth - input.offsetLeft - 10;
831831
if (inputWidth < minInputWidth) inputWidth = containerWidth;
832832
ctrl.searchInput.css('width', inputWidth+'px');
833833
return true;

dist/select.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/select.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/select.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uiSelectController.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ uis.controller('uiSelectCtrl',
536536
ctrl.sizeSearchInput = function() {
537537

538538
var input = ctrl.searchInput[0],
539-
container = ctrl.$element[0],
539+
container = ctrl.searchInput.parent().parent()[0],
540540
minInputWidth = 50,
541541
calculateContainerWidth = function() {
542542
// Return the container width only if the search input is visible
@@ -546,7 +546,7 @@ uis.controller('uiSelectCtrl',
546546
if (containerWidth === 0) {
547547
return false;
548548
}
549-
var inputWidth = containerWidth - input.offsetLeft;
549+
var inputWidth = containerWidth - input.offsetLeft - 10;
550550
if (inputWidth < minInputWidth) inputWidth = containerWidth;
551551
ctrl.searchInput.css('width', inputWidth+'px');
552552
return true;

test/select.spec.js

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,34 +2016,10 @@ describe('ui-select tests', function () {
20162016

20172017
});
20182018

2019-
it('should update size of search input use container width', function () {
2020-
scope.selection.selectedMultiple = [scope.people[4], scope.people[5]]; //Wladimir & Samantha
2021-
var el = createUiSelectMultiple({
2022-
appendToBody: true
2023-
});
2024-
2025-
angular.element(document.body).css("width", "100%");
2026-
angular.element(document.body).css("height", "100%");
2027-
angular.element(document.body).append(el);
2028-
2029-
spyOn(el.scope().$select, 'sizeSearchInput');
2030-
2031-
var searchInput = el.find('.ui-select-search');
2032-
el.find('.ui-select-match-item').first().find('.ui-select-match-close').click();
2033-
2034-
expect(el.scope().$select.sizeSearchInput).toHaveBeenCalled();
2019+
it('should move to last match when pressing BACKSPACE key from search', function() {
20352020

2036-
$timeout.flush();
2037-
2038-
var newWidth = searchInput[0].clientWidth + searchInput[0].offsetLeft;
2039-
var containerWidth = el[0].clientWidth;
2040-
expect(containerWidth - newWidth).toBeLessThan(10);
2041-
2042-
});
2043-
it('should move to last match when pressing BACKSPACE key from search', function () {
2044-
2045-
var el = createUiSelectMultiple();
2046-
var searchInput = el.find('.ui-select-search');
2021+
var el = createUiSelectMultiple();
2022+
var searchInput = el.find('.ui-select-search');
20472023

20482024
expect(isDropdownOpened(el)).toEqual(false);
20492025
triggerKeydown(searchInput, Key.Backspace);

0 commit comments

Comments
 (0)