diff options
| author | Andres Ornelas | 2010-08-06 17:28:47 -0700 | 
|---|---|---|
| committer | Andres Ornelas | 2010-08-06 17:28:47 -0700 | 
| commit | de8d0984c85ae3078fd72a9c7f010b0fd4397150 (patch) | |
| tree | 9f3310082e85c5f29c926474001a4f55af69df50 /src/scenario | |
| parent | 989cffb43502744ab05baa741420c2082f137d69 (diff) | |
| download | angular.js-de8d0984c85ae3078fd72a9c7f010b0fd4397150.tar.bz2 | |
added repeater.collect to E2E DSL
Diffstat (limited to 'src/scenario')
| -rw-r--r-- | src/scenario/DSL.js | 20 | 
1 files changed, 20 insertions, 0 deletions
diff --git a/src/scenario/DSL.js b/src/scenario/DSL.js index 26157059..13576824 100644 --- a/src/scenario/DSL.js +++ b/src/scenario/DSL.js @@ -50,6 +50,26 @@ angular.scenario.dsl.repeater = function(selector) {        return $scenario.addFuture(namePrefix + ' count', function(done) {            done(this.testDocument.find(selector).size());        }); +    }, +    collect: function() { +      return $scenario.addFuture(namePrefix + ' collect', function(done) { +        var doCollect = bind(this, function() { +          var repeaterArray = []; +          this.testDocument.find(selector).each(function(index) { +            var element = angular.extend(_jQuery(this), +                {bindings: [], +                 boundTo: function(name) { return this.bindings[name]; }} +            ); +            element.find('*').each(function(index) { +              var bindName = _jQuery(this).attr('ng:bind'); +              element.bindings[bindName] = _jQuery(this).text(); +            }); +            repeaterArray[index] = element; +          }); +          return repeaterArray; +        }); +        done(doCollect()); +      });      }    };  };  | 
