aboutsummaryrefslogtreecommitdiffstats
path: root/src/scenario/Runner.js
diff options
context:
space:
mode:
authorAndres Ornelas2010-05-24 15:25:30 -0700
committerAndres Ornelas2010-05-24 15:25:30 -0700
commit3fab5d9879272b9f991a67c8135754f00c055834 (patch)
tree2f33b6de3e3d0900c0bdba3b198e15dceac63712 /src/scenario/Runner.js
parentf6c67e28c94033edf6a16eb6508de54679cb49db (diff)
downloadangular.js-3fab5d9879272b9f991a67c8135754f00c055834.tar.bz2
added error handling on scenario definition
Diffstat (limited to 'src/scenario/Runner.js')
-rw-r--r--src/scenario/Runner.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/scenario/Runner.js b/src/scenario/Runner.js
index 9e20d394..003ce487 100644
--- a/src/scenario/Runner.js
+++ b/src/scenario/Runner.js
@@ -1,9 +1,11 @@
-angular['scenario'] = (angular['scenario'] = {});
+angular['scenario'] = (angular['scenario'] = {});
+angular.scenario['dsl'] = (angular.scenario['dsl'] = {});
angular.scenario.Runner = function(scope, jQuery){
var self = scope.$scenario = this;
this.scope = scope;
this.jQuery = jQuery;
+ angular.extend(scope, angular.scenario.dsl);
var specs = this.specs = {};
var path = [];
@@ -18,7 +20,13 @@ angular.scenario.Runner = function(scope, jQuery){
name: specName,
steps:[]
};
- body();
+ try {
+ body();
+ } catch(err) {
+ self.addStep(err.message || 'ERROR', function(){
+ throw err;
+ });
+ }
self.currentSpec = null;
};
this.logger = function returnNoop(){
@@ -55,6 +63,7 @@ angular.scenario.Runner.prototype = {
return angular.extend(logger(element), {
close: function(){
element.removeClass('running');
+ console.scrollTop(console[0].scrollHeight);
},
fail: function(){
element.removeClass('running');
@@ -66,7 +75,7 @@ angular.scenario.Runner.prototype = {
current = current.parent();
}
}
- });;
+ });
};
}
this.logger = logger(console);