aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAndres Ornelas2010-06-09 16:05:51 -0700
committerAndres Ornelas2010-06-09 16:05:51 -0700
commitbbb45a7eed5264a343c191f3abfbe6f6b5d51139 (patch)
tree340453d4268200f36a7934274450502145e123cf /test
parent36b58b235eeca4e9580162a697d8a96c41263ebc (diff)
parentd0a468153d98c892323cb135b509cb46f67e44fd (diff)
downloadangular.js-bbb45a7eed5264a343c191f3abfbe6f6b5d51139.tar.bz2
Merge branch 'repeater'
Diffstat (limited to 'test')
-rw-r--r--test/scenario/DSLSpec.js14
-rw-r--r--test/scenario/RunnerSpec.js40
2 files changed, 52 insertions, 2 deletions
diff --git a/test/scenario/DSLSpec.js b/test/scenario/DSLSpec.js
index bed1f008..5aac9752 100644
--- a/test/scenario/DSLSpec.js
+++ b/test/scenario/DSLSpec.js
@@ -40,4 +40,16 @@ describe("DSL", function() {
expect(lastDocument.find(':radio:checked').val()).toEqual('female');
});
});
-}); \ No newline at end of file
+
+ describe('expect', function() {
+ var dslExpect = angular.scenario.dsl.expect;
+ describe('repeater', function() {
+ it('should check the count of repeated elements', function() {
+ dslExpect.repeater('.repeater-row').count.toEqual(2);
+ expect(lastStep.name).toEqual("Expect that there are 2 items in Repeater with selector '.repeater-row'");
+ var html = "<div class='repeater-row'>a</div><div class='repeater-row'>b</div>";
+ executeStep(lastStep, html);
+ });
+ });
+ });
+});
diff --git a/test/scenario/RunnerSpec.js b/test/scenario/RunnerSpec.js
index 35d74f51..ca6e8eb2 100644
--- a/test/scenario/RunnerSpec.js
+++ b/test/scenario/RunnerSpec.js
@@ -14,6 +14,8 @@ describe('Runner', function(){
body = _jQuery('<div></div>');
runner = new angular.scenario.Runner(scenario, _jQuery);
Describe = scenario.describe;
+ BeforeEach = scenario.beforeEach;
+ AfterEach = scenario.afterEach;
It = scenario.it;
$scenario = scenario.$scenario;
});
@@ -36,7 +38,10 @@ describe('Runner', function(){
expect(spec.name).toEqual('describe name: it should text');
});
- it('should camplain on duplicate it', angular.noop);
+ it('should complain on duplicate it', function() {
+ // WRITE ME!!!!
+ });
+
it('should create a failing step if there is a javascript error', function(){
var spec;
Describe('D1', function(){
@@ -55,6 +60,39 @@ describe('Runner', function(){
};
});
});
+
+ describe('beforeEach', function() {
+ it('should execute beforeEach before every it', function() {
+ Describe('describe name', function(){
+ BeforeEach(logger('before;'));
+ It('should text', logger('body;'));
+ It('should text2', logger('body2;'));
+ });
+ expect(log).toEqual('before;body;before;body2;');
+ });
+ });
+ describe('afterEach', function() {
+ it('should execute afterEach after every it', function() {
+ Describe('describe name', function(){
+ AfterEach(logger('after;'));
+ It('should text', logger('body;'));
+ It('should text2', logger('body2;'));
+ });
+ expect(log).toEqual('body;after;body2;after;');
+ });
+
+ it('should always execute afterEach after every it', function() {
+ Describe('describe name', function(){
+ AfterEach(logger('after;'));
+ It('should text', function() {
+ log = 'body;';
+ throw "MyError";
+ });
+ It('should text2', logger('body2;'));
+ });
+ expect(log).toEqual('body;after;body2;after;');
+ });
+ });
});
describe('steps building', function(){