Skip to content

Commit

Permalink
fix(ng:options): select correct element when '?'-option was previousl…
Browse files Browse the repository at this point in the history
…y selected

Closes angular#599
  • Loading branch information
TEHEK committed Oct 13, 2011
1 parent fec16a4 commit 38ea53e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/widget/selectSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,22 @@ describe('select', function() {
expect(select.val()).toEqual('0');
expect(select.find('option').length).toEqual(1);
});

it('should select correct input if previously bound to something not in the list', function() {
createSingleSelect();
scope.values = [{name:'A'},{name:'B'}];
scope.selected = {};
scope.$digest();
expect(select.find('option').length).toEqual(3);
expect(select.val()).toEqual('?');
expect(jqLite(select.find('option')[0]).val()).toEqual('?');

select.find('option').eq(1).prop('selected', true);
browserTrigger(select, 'change');

This comment has been minimized.

Copy link
@TEHEK

TEHEK Oct 18, 2011

Author Owner

Selecting option with browserTrigger(optionElement, 'select') didnt work, so i did it in a little bit different way

expect(select.val()).toEqual('0');
expect(select.find('option').eq(0).prop('selected')).toBeTruthy();
expect(select.find('option').length).toEqual(2);
});
});

describe('on change', function() {
Expand Down

0 comments on commit 38ea53e

Please sign in to comment.