From 22a9b1ac07f98d07e1e5d71ce961411b5fa9b42d Mon Sep 17 00:00:00 2001 From: Stephen Merity Date: Mon, 3 Jun 2013 18:09:36 +1000 Subject: fix(ngScenario): select().option(val) should prefer exact value match With select(...).option(val) it previously would select the first node which contains the value, even if an exact match was available. This fix prefers exact matches if available, otherwise it reverts to the previous 'contains' behaviour for backwards compatibility. Closes #2856 --- test/ngScenario/dslSpec.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/ngScenario/dslSpec.js b/test/ngScenario/dslSpec.js index 642e2d37..f94ec583 100644 --- a/test/ngScenario/dslSpec.js +++ b/test/ngScenario/dslSpec.js @@ -227,6 +227,7 @@ describe("angular.scenario.dsl", function() { $root.dsl.select('test').option('A'); expect(doc.find('[data-ng-model="test"]').val()).toEqual('A'); }); + it('should select single option using x-ng', function() { doc.append( '' + + ' ' + + ' ' + + ' ' + + ' ' + + '' + ); + $root.dsl.select('test').option('one'); + expect(doc.find('[ng-model="test"]').val()).toEqual('D'); + }); - - - it('should select option by name', function() { + it('should select option by name if no exact match and name contains value', function() { doc.append( '' ); $root.dsl.select('test').option('one'); -- cgit v1.2.3