Skip to content

Commit 0ee8265

Browse files
bereczdenesmesso
authored andcommitted
fixing the wollowing two bugs:
- angular-ui#241 - angular-ui#589
1 parent 0efa129 commit 0ee8265

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/bootstrap/select.tpl.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class="form-control ui-select-search"
99
placeholder="{{$select.placeholder}}"
1010
ng-model="$select.search"
11-
ng-show="$select.searchEnabled && $select.open">
11+
ng-show="$select.open"
12+
ng-readonly="!$select.searchEnabled">
1213
<div class="ui-select-choices"></div>
1314
</div>

src/uiSelectController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ uis.controller('uiSelectCtrl',
511511
_ensureHighlightVisible();
512512
}
513513

514-
if (key === KEY.ENTER || key === KEY.ESC) {
514+
if (key === KEY.ENTER || key === KEY.ESC || key === KEY.UP || key === KEY.DOWN) {
515515
e.preventDefault();
516516
e.stopPropagation();
517517
}

test/select.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,16 +1511,16 @@ describe('ui-select tests', function() {
15111511

15121512
describe('bootstrap theme', function() {
15131513

1514-
it('should show search input when true', function() {
1514+
it('should not be readonly search input when true', function() {
15151515
setupSelectComponent('true', 'bootstrap');
15161516
clickMatch(el);
1517-
expect($(el).find('.ui-select-search')).not.toHaveClass('ng-hide');
1517+
expect($(el).find('.ui-select-search').attr('readonly')).toBeUndefined();
15181518
});
15191519

1520-
it('should hide search input when false', function() {
1520+
it('should be readonly search input when false', function() {
15211521
setupSelectComponent('false', 'bootstrap');
15221522
clickMatch(el);
1523-
expect($(el).find('.ui-select-search')).toHaveClass('ng-hide');
1523+
expect($(el).find('.ui-select-search').attr('readonly')).toEqual('readonly');
15241524
});
15251525

15261526
});

0 commit comments

Comments
 (0)