From ee6af9a97807e1f166da0f7b005f2133a86344d5 Mon Sep 17 00:00:00 2001 From: TEHEK Firefox Date: Wed, 12 Oct 2011 23:42:21 +0000 Subject: fix(ng:options): select correct element when '?'-option was previously selected Closes #599 --- test/widget/selectSpec.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'test/widget/selectSpec.js') diff --git a/test/widget/selectSpec.js b/test/widget/selectSpec.js index dd1dc0cb..63699d01 100644 --- a/test/widget/selectSpec.js +++ b/test/widget/selectSpec.js @@ -428,6 +428,21 @@ describe('select', function() { expect(select.val()).toEqual('0'); expect(select.find('option').length).toEqual(1); }); + + it('should select correct input if previously selected option was "?"', function() { + createSingleSelect(); + scope.values = [{name:'A'},{name:'B'}]; + scope.selected = {}; + scope.$digest(); + expect(select.find('option').length).toEqual(3); + expect(select.val()).toEqual('?'); + expect(select.find('option').eq(0).val()).toEqual('?'); + + browserTrigger(select.find('option').eq(1)); + 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() { @@ -504,7 +519,5 @@ describe('select', function() { expect(scope.selected).toEqual([scope.values[0]]); }); }); - }); - }); -- cgit v1.2.3