8000 refact(ngOptions): major refactoring... by petebacondarwin · Pull Request #10639 · angular/angular.js · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

refact(ngOptions): major refactoring... #10639

Closed
wants to merge 9 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test(ngOptions): should place non-grouped items in the list where the…
…y appear

Closes #10531
  • Loading branch information
petebacondarwin committed Jan 12, 2015
commit b4b682243394bde83c53340a06fd0072812c8349
30 changes: 30 additions & 0 deletions test/ng/directive/ngOptionsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,36 @@ describe('ngOptions', function() {
});


it('should place non-grouped items in the list where they appear', function() {
createSelect({
'ng-model': 'selected',
'ng-options': 'item.name group by item.group for item in values'
});

scope.$apply(function() {
scope.values = [{name: 'A'},
{name: 'B', group: 'first'},
{name: 'C', group: 'second'},
{name: 'D'},
{name: 'E', group: 'first'},
{name: 'F'},
{name: 'G'},
{name: 'H', group: 'second'}];
scope.selected = scope.values[0];
});

var children = element.children();
expect(children.length).toEqual(6);

expect(nodeName_(children[0])).toEqual('option');
expect(nodeName_(children[1])).toEqual('optgroup');
expect(nodeName_(children[2])).toEqual('optgroup');
expect(nodeName_(children[3])).toEqual('option');
expect(nodeName_(children[4])).toEqual('option');
expect(nodeName_(children[5])).toEqual('option');
});


it('should bind to scope value and track/identify objects', function() {
createSelect({
'ng-model': 'selected',
Expand Down
0