mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
adding regular expressions support for binding() DSL
This commit is contained in:
parent
dcf76e6816
commit
0bd4a473a7
3 changed files with 16 additions and 4 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -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) #
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in a new issue