diff options
| author | Stephane Bisson | 2012-11-14 12:33:54 +0800 |
|---|---|---|
| committer | Pawel Kozlowski | 2012-12-01 20:05:42 +0100 |
| commit | 15183f3e1fbee031c9595206163962788f98b298 (patch) | |
| tree | efe538b33086ba0550d19133e622315fcd441dc2 | |
| parent | 2c405f417125c80c387a51baece8bf6e1e0c0a81 (diff) | |
| download | angular.js-15183f3e1fbee031c9595206163962788f98b298.tar.bz2 | |
feat(e2eRunner): fail when an option to select does not exist
| -rw-r--r-- | src/ngScenario/dsl.js | 2 | ||||
| -rw-r--r-- | test/ngScenario/dslSpec.js | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/ngScenario/dsl.js b/src/ngScenario/dsl.js index f660c318..2f3ca18e 100644 --- a/src/ngScenario/dsl.js +++ b/src/ngScenario/dsl.js @@ -298,6 +298,8 @@ angular.scenario.dsl('select', function() { option = select.find('option:contains("' + value + '")'); if (option.length) { select.val(option.val()); + } else { + return done("option '" + value + "' not found"); } } select.trigger('change'); diff --git a/test/ngScenario/dslSpec.js b/test/ngScenario/dslSpec.js index 4a4b17bc..2db2771c 100644 --- a/test/ngScenario/dslSpec.js +++ b/test/ngScenario/dslSpec.js @@ -269,6 +269,17 @@ describe("angular.scenario.dsl", function() { $root.dsl.select('test').options('A', 'B'); expect($root.futureError).toMatch(/did not match/); }); + + it('should fail to select an option that does not exist', function(){ + doc.append( + '<select ng-model="test">' + + ' <option value=A>one</option>' + + ' <option value=B selected>two</option>' + + '</select>' + ); + $root.dsl.select('test').option('three'); + expect($root.futureError).toMatch(/not found/); + }); }); describe('Element', function() { |
