diff options
| author | Andres Ornelas | 2010-06-09 12:35:40 -0700 | 
|---|---|---|
| committer | Andres Ornelas | 2010-06-09 12:35:40 -0700 | 
| commit | fe03ea0d1f8814817bee5a35d745db16858eb490 (patch) | |
| tree | 4a230103a90944c0ea05c09f59fca06018cb9ef7 /src | |
| parent | cb5d21192787985bbff20b369e885639de253345 (diff) | |
| download | angular.js-fe03ea0d1f8814817bee5a35d745db16858eb490.tar.bz2 | |
add repeater DSL and fix typo
Diffstat (limited to 'src')
| -rw-r--r-- | src/scenario/DSL.js | 27 | 
1 files changed, 15 insertions, 12 deletions
diff --git a/src/scenario/DSL.js b/src/scenario/DSL.js index b318e99c..a017f29d 100644 --- a/src/scenario/DSL.js +++ b/src/scenario/DSL.js @@ -44,17 +44,20 @@ angular.scenario.dsl.input = function(selector) {    };  }; -angular.scenario.dsl.expect = function(selector) { -  return { -    toEqual: function(expected) { -      $scenario.addStep("Expect that " + selector + " equals '" + expected + "'", function(done){ -        var attrName = selector.substring(2, selector.length - 2); -        var binding = this.testDocument.find('span[ng-bind=' + attrName + ']'); -        if (binding.text() != expected) { -          this.result.fail("Expected '" + expected + "' but was '" + binding.text() + "'"); +angular.scenario.dsl.expect = { +  repeater: function(selector) { +    return { +      count: { +        toEqual: function(number) { +          $scenario.addStep("Expect to see " + number + " items repeated with selector '" + selector + "'", function(done) { +            var items = this.testDocument.find(selector); +            if (items.length != number) { +              this.result.fail("Expected " + number + " but was " + items.length); +            } +            done(); +          });          } -        done(); -      }); -    } -  }; +      } +    }; +  }  };  | 
