mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 19:40:56 +08:00
added dsl tests and select method
This commit is contained in:
@@ -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();
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user