Skip to content

Commit 581e5d4

Browse files
author
Rick Yang
committed
Merge pull request angular-ui#1908 of angular-ui/ui-select
[why] If selection is clear, the value is better to be null. [how] Merge pull request: angular-ui#1908
1 parent 2646f39 commit 581e5d4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/uiSelectController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ uis.controller('uiSelectCtrl',
462462
};
463463

464464
ctrl.clear = function($event) {
465-
ctrl.select(undefined);
465+
ctrl.select(null);
466466
$event.stopPropagation();
467467
$timeout(function() {
468468
ctrl.focusser[0].focus();

test/select.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ describe('ui-select tests', function() {
549549

550550
// Trigger clear.
551551
el.find('.select2-search-choice-close').click();
552-
expect(scope.selection.selected).toEqual(undefined);
552+
expect(scope.selection.selected).toEqual(null);
553553

554554
// If there is no selection it the X icon should be gone.
555555
expect(el.find('.select2-search-choice-close').length).toEqual(0);

0 commit comments

Comments
 (0)