Skip to content

Commit 6d6baac

Browse files
committed
Update select.spec.js
1 parent 2cc669a commit 6d6baac

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: test/select.spec.js

+15
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,21 @@ describe('ui-select tests', function() {
142142

143143
expect(getMatchLabel(el)).toEqual('Adam');
144144
});
145+
146+
it('should correctly render initial state with track by feature', function() {
147+
var el = compileTemplate(
148+
'<ui-select ng-model="selection.selected"> \
149+
<ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
150+
<ui-select-choices repeat="person in people | filter: $select.search track by person.name"> \
151+
<div ng-bind-html="person.name | highlight: $select.search"></div> \
152+
<div ng-bind-html="person.email | highlight: $select.search"></div> \
153+
</ui-select-choices> \
154+
</ui-select>'
155+
);
156+
scope.selection.selected = { name: 'Samantha', email: 'something different than array source', group: 'bar', age: 30 };
157+
scope.$digest();
158+
expect(getMatchLabel(el)).toEqual('Samantha');
159+
});
145160

146161
it('should display the choices when activated', function() {
147162
var el = createUiSelect();

0 commit comments

Comments
 (0)