mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
parent
1eebb771e3
commit
9fdb09ebf8
2 changed files with 16 additions and 1 deletions
|
|
@ -171,6 +171,7 @@ angular.scenario.dsl('binding', function() {
|
|||
* input(name).enter(value) enters value in input with specified name
|
||||
* input(name).check() checks checkbox
|
||||
* input(name).select(value) selects the radio button with specified name/value
|
||||
* input(name).val() returns the value of the input.
|
||||
*/
|
||||
angular.scenario.dsl('input', function() {
|
||||
var chain = {};
|
||||
|
|
@ -201,6 +202,13 @@ angular.scenario.dsl('input', function() {
|
|||
});
|
||||
};
|
||||
|
||||
chain.val = function() {
|
||||
return this.addFutureAction("return input val", function($window, $document, done) {
|
||||
var input = $document.elements(':input[name="$1"]', this.name);
|
||||
done(null,input.val());
|
||||
});
|
||||
};
|
||||
|
||||
return function(name) {
|
||||
this.name = name;
|
||||
return chain;
|
||||
|
|
|
|||
|
|
@ -530,8 +530,15 @@ describe("angular.scenario.dsl", function() {
|
|||
chain.select('foo');
|
||||
expect($root.futureError).toMatch(/did not match/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('val', function() {
|
||||
it('should return value in text input', function() {
|
||||
doc.append('<input name="test.input" value="something">');
|
||||
$root.dsl.input('test.input').val();
|
||||
expect($root.futureResult).toEqual("something");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Textarea', function() {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue