mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-04-22 07:34:44 +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).enter(value) enters value in input with specified name
|
||||||
* input(name).check() checks checkbox
|
* input(name).check() checks checkbox
|
||||||
* input(name).select(value) selects the radio button with specified name/value
|
* 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() {
|
angular.scenario.dsl('input', function() {
|
||||||
var chain = {};
|
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) {
|
return function(name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
return chain;
|
return chain;
|
||||||
|
|
|
||||||
|
|
@ -530,8 +530,15 @@ describe("angular.scenario.dsl", function() {
|
||||||
chain.select('foo');
|
chain.select('foo');
|
||||||
expect($root.futureError).toMatch(/did not match/);
|
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() {
|
describe('Textarea', function() {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue