diff options
| author | Andres Ornelas | 2010-05-24 17:48:17 -0700 |
|---|---|---|
| committer | Andres Ornelas | 2010-05-24 17:48:17 -0700 |
| commit | 55c0767f16e60e77e9d1b4d46698ddbf343ed8b1 (patch) | |
| tree | 8dd944b5e5d95d775a0c0a22af0b30c3a4115006 /src | |
| parent | 3fab5d9879272b9f991a67c8135754f00c055834 (diff) | |
| download | angular.js-55c0767f16e60e77e9d1b4d46698ddbf343ed8b1.tar.bz2 | |
added dsl tests and select method
Diffstat (limited to 'src')
| -rw-r--r-- | src/scenario/DSL.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/scenario/DSL.js b/src/scenario/DSL.js index 4bc21d6c..842f7c7a 100644 --- a/src/scenario/DSL.js +++ b/src/scenario/DSL.js @@ -19,14 +19,24 @@ angular.scenario.dsl.browser = { angular.scenario.dsl.input = function(selector) { return { enter: function(value){ - $scenario.addStep("Set input text of '" + selector + "' to value '" + + $scenario.addStep("Set input text of '" + selector + "' to '" + value + "'", function(done){ var input = this.testDocument.find('input[name=' + selector + ']'); input.val(value); - input.trigger('change'); this.testWindow.angular.element(input[0]).trigger('change'); done(); }); + }, + select: function(value){ + $scenario.addStep("Select radio '" + selector + "' to '" + + value + "'", function(done){ + var input = this.testDocument. + find(':radio[name$=@' + selector + '][value=' + value + ']'); + var event = this.testWindow.document.createEvent('MouseEvent'); + event.initMouseEvent('click', true, true, this.testWindow, 0,0,0,0,0, false, false, false, false, 0, null); + input[0].dispatchEvent(event); + done(); + }); } }; }; |
