From 55c0767f16e60e77e9d1b4d46698ddbf343ed8b1 Mon Sep 17 00:00:00 2001 From: Andres Ornelas Date: Mon, 24 May 2010 17:48:17 -0700 Subject: added dsl tests and select method --- src/scenario/DSL.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') 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(); + }); } }; }; -- cgit v1.2.3