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

Commit f6b6d81

Browse files
committed
Merge pull request #1211 from angular-ui/feat-choices-hover-css
refactor(choices): avoid setting activeItem on mouseenter
2 parents 9f1950b + 1041786 commit f6b6d81

File tree

4 files changed

+5
-34
lines changed

4 files changed

+5
-34
lines changed

Diff for: src/common.css

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
top: 0px !important;
1818
}
1919

20+
21+
.ui-select-choices-row:hover {
22+
background-color: #f5f5f5;
23+
}
24+
2025
/* Select2 theme */
2126

2227
/* Mark invalid Select2 */

Diff for: src/uiSelectChoicesDirective.js

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ uis.directive('uiSelectChoices',
4141

4242
choices.attr('ng-repeat', $select.parserResult.repeatExpression(groupByExp))
4343
.attr('ng-if', '$select.open') //Prevent unnecessary watches when dropdown is closed
44-
.attr('ng-mouseenter', '$select.setActiveItem('+$select.parserResult.itemName +')')
4544
.attr('ng-click', '$select.select(' + $select.parserResult.itemName + ',false,$event)');
4645

4746
var rowsInner = element.querySelectorAll('.ui-select-choices-row-inner');

Diff for: src/uiSelectController.js

-4
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,6 @@ uis.controller('uiSelectCtrl',
224224
}
225225
};
226226

227-
ctrl.setActiveItem = function(item) {
228-
ctrl.activeIndex = ctrl.items.indexOf(item);
229-
};
230-
231227
ctrl.isActive = function(itemScope) {
232228
if ( !ctrl.open ) {
233229
return false;

Diff for: test/select.spec.js

-29
Original file line numberDiff line numberDiff line change
@@ -1135,35 +1135,6 @@ describe('ui-select tests', function() {
11351135

11361136
});
11371137

1138-
it('should invoke hover callback', function(){
1139-
1140-
var highlighted;
1141-
scope.onHighlightFn = function ($item) {
1142-
highlighted = $item;
1143-
};
1144-
1145-
var el = compileTemplate(
1146-
'<ui-select on-select="onSelectFn($item, $model)" ng-model="selection.selected"> \
1147-
<ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
1148-
<ui-select-choices on-highlight="onHighlightFn(person)" repeat="person.name as person in people | filter: $select.search"> \
1149-
<div ng-bind-html="person.name | highlight: $select.search"></div> \
1150-
<div ng-bind-html="person.email | highlight: $select.search"></div> \
1151-
</ui-select-choices> \
1152-
</ui-select>'
1153-
);
1154-
1155-
expect(highlighted).toBeFalsy();
1156-
1157-
if (!isDropdownOpened(el)){
1158-
openDropdown(el);
1159-
}
1160-
1161-
$(el).find('.ui-select-choices-row div:contains("Samantha")').trigger('mouseover');
1162-
scope.$digest();
1163-
1164-
expect(highlighted).toBe(scope.people[5]);
1165-
});
1166-
11671138
it('should set $item & $model correctly when invoking callback on select and no single prop. binding', function () {
11681139

11691140
scope.onSelectFn = function ($item, $model, $label) {

0 commit comments

Comments
 (0)