mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-09 23:34:42 +00:00
adding textarea() DSL for scenario runner
This commit is contained in:
parent
0bd4a473a7
commit
5c887ddb66
3 changed files with 42 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
# <angular/> 0.9.2 faunal-mimicry (in-progress) #
|
# <angular/> 0.9.2 faunal-mimicry (in-progress) #
|
||||||
|
|
||||||
### Testability
|
### Testability
|
||||||
|
#### Scenario Runner
|
||||||
- binding DSL in Scenario can now match bindings without specifying filters
|
- binding DSL in Scenario can now match bindings without specifying filters
|
||||||
- dsl statements now accept a label argument to make test output more readable (issue #94)
|
- dsl statements now accept a label argument to make test output more readable (issue #94)
|
||||||
- dsl element() statement now implements most of the jQuery API (issue #106)
|
- dsl element() statement now implements most of the jQuery API (issue #106)
|
||||||
|
|
@ -8,6 +9,7 @@
|
||||||
- scenario runner is now compatible with IE8 (issue #93)
|
- scenario runner is now compatible with IE8 (issue #93)
|
||||||
- scenarior runner checks if URL would return a non-success status code (issue #100)
|
- scenarior runner checks if URL would return a non-success status code (issue #100)
|
||||||
- binding() DSL now accepts regular expressions
|
- binding() DSL now accepts regular expressions
|
||||||
|
- new textarea() scenario runner DSL for entering text into textareas
|
||||||
|
|
||||||
### Breaking changes
|
### Breaking changes
|
||||||
#### Scenario Runner
|
#### Scenario Runner
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,30 @@ angular.scenario.dsl('input', function() {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Usage:
|
||||||
|
* textarea(name).enter(value) enters value in the text area with specified name
|
||||||
|
*/
|
||||||
|
angular.scenario.dsl('textarea', function() {
|
||||||
|
var chain = {};
|
||||||
|
|
||||||
|
chain.enter = function(value) {
|
||||||
|
return this.addFutureAction("textarea '" + this.name + "' enter '" + value + "'", function($window, $document, done) {
|
||||||
|
var textarea = $document.elements('textarea[name="$1"]', this.name);
|
||||||
|
textarea.val(value);
|
||||||
|
textarea.trigger('change');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return function(name) {
|
||||||
|
this.name = name;
|
||||||
|
return chain;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usage:
|
* Usage:
|
||||||
* repeater('#products table', 'Product List').count() number of rows
|
* repeater('#products table', 'Product List').count() number of rows
|
||||||
|
|
|
||||||
|
|
@ -486,5 +486,21 @@ describe("angular.scenario.dsl", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('Textarea', function() {
|
||||||
|
|
||||||
|
it('should change value in textarea', function() {
|
||||||
|
doc.append('<textarea name="test.textarea">something</textarea>');
|
||||||
|
var chain = $root.dsl.textarea('test.textarea');
|
||||||
|
chain.enter('foo');
|
||||||
|
expect(_jQuery('textarea[name="test.textarea"]').val()).toEqual('foo');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return error if no textarea exists', function() {
|
||||||
|
var chain = $root.dsl.input('test.textarea');
|
||||||
|
chain.enter('foo');
|
||||||
|
expect($root.futureError).toMatch(/did not match/);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue