adding regular expressions support for binding() DSL

This commit is contained in:
Igor Minar 2010-11-02 16:23:12 -07:00
parent dcf76e6816
commit 0bd4a473a7
3 changed files with 16 additions and 4 deletions

View file

@ -4,12 +4,16 @@
- 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 element() statement now implements most of the jQuery API (issue #106)
- file:// URLs are no longer supported for running a scenario. You must use a web server that implements HEAD
- new browser() dsl statement for getting info about the emulated browser running the app (issue #109)
- navigateTo() is now browser().navigateTo(). Old code must be updated
- navigating to about:blank is no longer supported. It results in a sandbox error
- scenario runner is now compatible with IE8 (issue #93)
- scenarior runner checks if URL would return a non-success status code (issue #100)
- binding() DSL now accepts regular expressions
### Breaking changes
#### Scenario Runner
- navigating to about:blank is no longer supported. It results in a sandbox error
- navigateTo() is now browser().navigateTo(). Old code must be updated
- file:// URLs are no longer supported for running a scenario. You must use a web server that implements HEAD
# <angular/> 0.9.1 repulsion-field (2010-10-26) #

View file

@ -156,7 +156,9 @@ angular.scenario.dsl('using', function() {
*/
angular.scenario.dsl('binding', function() {
function contains(text, value) {
return text && text.indexOf(value) >= 0;
return value instanceof RegExp ?
value.test(text) :
text && text.indexOf(value) >= 0;
}
return function(name) {
return this.addFutureAction("select binding '" + name + "'", function($window, $document, done) {

View file

@ -370,6 +370,12 @@ describe("angular.scenario.dsl", function() {
expect($root.futureResult).toEqual('some value');
});
it('should select binding by regexp', function() {
doc.append('<span class="ng-binding" ng:bind="foo.bar">some value</span>');
$root.dsl.binding(/^foo\..+/);
expect($root.futureResult).toEqual('some value');
});
it('should select binding in template by name', function() {
doc.append('<pre class="ng-binding" ng:bind-template="foo {{bar}} baz">foo some baz</pre>');
$root.dsl.binding('bar');