diff options
| author | Stephen Merity | 2013-06-03 18:09:36 +1000 | 
|---|---|---|
| committer | Pete Bacon Darwin | 2013-07-12 10:05:23 +0100 | 
| commit | 22a9b1ac07f98d07e1e5d71ce961411b5fa9b42d (patch) | |
| tree | 3351a4891a8f00a2741551c991b2eb1fb61bfdb3 /src | |
| parent | 7fef06fef9b6af4436f9fed10bd29d0a63707614 (diff) | |
| download | angular.js-22a9b1ac07f98d07e1e5d71ce961411b5fa9b42d.tar.bz2 | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngScenario/dsl.js | 7 | 
1 files changed, 6 insertions, 1 deletions
| diff --git a/src/ngScenario/dsl.js b/src/ngScenario/dsl.js index 67a56af9..becd13a5 100644 --- a/src/ngScenario/dsl.js +++ b/src/ngScenario/dsl.js @@ -295,7 +295,12 @@ angular.scenario.dsl('select', function() {        if (option.length) {          select.val(value);        } else { -        option = select.find('option:contains("' + value + '")'); +        option = select.find('option').filter(function(){ +          return _jQuery(this).text() === value; +        }); +        if (!option.length) { +          option = select.find('option:contains("' + value + '")'); +        }          if (option.length) {            select.val(option.val());          } else { | 
