Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Change $select.clear() so it sets value to null instead of undefined #1908

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/uiSelectController.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ uis.controller('uiSelectCtrl',
};

ctrl.clear = function($event) {
ctrl.select(undefined);
ctrl.select(null);
$event.stopPropagation();
$timeout(function() {
ctrl.focusser[0].focus();
Expand Down
2 changes: 1 addition & 1 deletion test/select.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ describe('ui-select tests', function() {

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

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