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

Commit 10ec09b

Browse files
committed
refactor(choices): avoid setting activeItem on mouseenter
1 parent bc3de20 commit 10ec09b

File tree

3 files changed

+5
-30
lines changed

3 files changed

+5
-30
lines changed

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 */

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', RepeatParser.getNgRepeatExpression($select.parserResult.itemName, '$select.items', $select.parserResult.trackByExp, 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');

test/select.spec.js

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

960960
});
961961

962-
it('should invoke hover callback', function(){
963-
964-
var highlighted;
965-
scope.onHighlightFn = function ($item) {
966-
highlighted = $item;
967-
};
968-
969-
var el = compileTemplate(
970-
'<ui-select on-select="onSelectFn($item, $model)" ng-model="selection.selected"> \
971-
<ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
972-
<ui-select-choices on-highlight="onHighlightFn(person)" repeat="person.name as person in people | filter: $select.search"> \
973-
<div ng-bind-html="person.name | highlight: $select.search"></div> \
974-
<div ng-bind-html="person.email | highlight: $select.search"></div> \
975-
</ui-select-choices> \
976-
</ui-select>'
977-
);
978-
979-
expect(highlighted).toBeFalsy();
980-
981-
if (!isDropdownOpened(el)){
982-
openDropdown(el);
983-
}
984-
985-
$(el).find('.ui-select-choices-row div:contains("Samantha")').trigger('mouseover');
986-
scope.$digest();
987-
988-
expect(highlighted).toBe(scope.people[5]);
989-
});
990-
991962
it('should set $item & $model correctly when invoking callback on select and no single prop. binding', function () {
992963

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

0 commit comments

Comments
 (0)