' +
+ '
.' +
+ '
.' +
+ '
.' +
'').find(".run");
current.log = current.scenario.append('
').find(".log");
current.run.find(".name").text(name);
@@ -79,7 +81,7 @@ nglr.test.Runner.prototype = {
log.text(buf.join(" "));
this.current.log.append(log);
this.console.scrollTop(this.console[0].scrollHeight);
- if (level == "error")
+ if (level == "error")
this.current.error = buf.join(" ");
}
};
@@ -114,16 +116,16 @@ nglr.test.Scenario.prototype = {
else if (step.Then) fn = angular.test.THEN[step.Then];
return fn || function (){
throw "ERROR: Need Given/When/Then got: " + nglr.toJson(step);
- };
+ };
},
context: function(runner) {
var frame = runner.frame;
var window = frame[0].contentWindow;
var document;
- if (window.jQuery)
+ if (window.jQuery)
document = window.jQuery(window.document);
var context = {
- frame:frame,
+ frame:frame,
window:window,
log:_.bind(runner.log, runner, "info"),
document:document,
--
cgit v1.2.3
From 9b9a0dadcce82ae42ac09ad396d647739af20a06 Mon Sep 17 00:00:00 2001
From: Misko Hevery
Date: Sat, 9 Jan 2010 15:02:43 -0800
Subject: removed nglr namespace
---
src/test/Runner.js | 26 +++++++++++++-------------
src/test/Steps.js | 2 +-
2 files changed, 14 insertions(+), 14 deletions(-)
(limited to 'src/test')
diff --git a/src/test/Runner.js b/src/test/Runner.js
index c7dd431a..5840282e 100644
--- a/src/test/Runner.js
+++ b/src/test/Runner.js
@@ -1,11 +1,11 @@
-if (!nglr.test) nglr.test = {};
+if (typeof test == 'undefined') test = {};
-nglr.test.ScenarioRunner = function(scenarios, body) {
+test.ScenarioRunner = function(scenarios, body) {
this.scenarios = scenarios;
this.body = body;
};
-nglr.test.ScenarioRunner.prototype = {
+test.ScenarioRunner.prototype = {
run:function(){
this.setUpUI();
this.runScenarios();
@@ -25,22 +25,22 @@ nglr.test.ScenarioRunner.prototype = {
});
},
runScenarios:function(){
- var runner = new nglr.test.Runner(this.console, this.testFrame);
+ var runner = new test.Runner(this.console, this.testFrame);
_.stepper(this.scenarios, function(next, scenario, name){
- new nglr.test.Scenario(name, scenario).run(runner, next);
+ new test.Scenario(name, scenario).run(runner, next);
}, function(){
}
);
}
};
-nglr.test.Runner = function(console, frame){
+test.Runner = function(console, frame){
this.console = console;
this.current = null;
this.tests = [];
this.frame = frame;
};
-nglr.test.Runner.prototype = {
+test.Runner.prototype = {
start:function(name){
var current = this.current = {
name:name,
@@ -75,7 +75,7 @@ nglr.test.Runner.prototype = {
var buf = [];
for ( var i = 1; i < arguments.length; i++) {
var arg = arguments[i];
- buf.push(typeof arg == "string" ?arg:nglr.toJson(arg));
+ buf.push(typeof arg == "string" ?arg:toJson(arg));
}
var log = jQuery('
');
log.text(buf.join(" "));
@@ -86,11 +86,11 @@ nglr.test.Runner.prototype = {
}
};
-nglr.test.Scenario = function(name, scenario){
+test.Scenario = function(name, scenario){
this.name = name;
this.scenario = scenario;
};
-nglr.test.Scenario.prototype = {
+test.Scenario.prototype = {
run:function(runner, callback) {
var self = this;
_.stepper(this.scenario, function(next, steps, name){
@@ -115,7 +115,7 @@ nglr.test.Scenario.prototype = {
else if (step.When) fn = angular.test.WHEN[step.When];
else if (step.Then) fn = angular.test.THEN[step.Then];
return fn || function (){
- throw "ERROR: Need Given/When/Then got: " + nglr.toJson(step);
+ throw "ERROR: Need Given/When/Then got: " + toJson(step);
};
},
context: function(runner) {
@@ -149,14 +149,14 @@ nglr.test.Scenario.prototype = {
callback();
return;
}
- runner.log("info", nglr.toJson(step));
+ runner.log("info", toJson(step));
var fn = this.verb(step);
var context = this.context(runner);
_.extend(context, step);
try {
(fn.call(context)||function(c){c();})(callback);
} catch (e) {
- runner.log("error", "ERROR: " + nglr.toJson(e));
+ runner.log("error", "ERROR: " + toJson(e));
}
}
};
diff --git a/src/test/Steps.js b/src/test/Steps.js
index af4b84d6..cc9ff549 100644
--- a/src/test/Steps.js
+++ b/src/test/Steps.js
@@ -14,7 +14,7 @@ angular.test.GIVEN = {
};
},
dataset:function(){
- this.frame.name="$DATASET:" + nglr.toJson({dataset:this.dataset});
+ this.frame.name="$DATASET:" + toJson({dataset:this.dataset});
}
};
angular.test.WHEN = {
--
cgit v1.2.3
From 1aba6b53b88c70b61a0cc991b1371739305d117b Mon Sep 17 00:00:00 2001
From: Misko Hevery
Date: Sun, 10 Jan 2010 08:58:57 -0800
Subject: basic calculator works with minified.js, lots of references still
broken
---
src/test/Runner.js | 2 +-
src/test/_namespace.js | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
(limited to 'src/test')
diff --git a/src/test/Runner.js b/src/test/Runner.js
index 5840282e..c6684951 100644
--- a/src/test/Runner.js
+++ b/src/test/Runner.js
@@ -110,7 +110,7 @@ test.Scenario.prototype = {
},
verb:function(step){
var fn = null;
- if (!step) fn = function (){ throw "Step is null!"; }
+ if (!step) fn = function (){ throw "Step is null!"; };
else if (step.Given) fn = angular.test.GIVEN[step.Given];
else if (step.When) fn = angular.test.WHEN[step.When];
else if (step.Then) fn = angular.test.THEN[step.Then];
diff --git a/src/test/_namespace.js b/src/test/_namespace.js
index 78f430f1..e29ae72a 100644
--- a/src/test/_namespace.js
+++ b/src/test/_namespace.js
@@ -1,5 +1,5 @@
-if (!angular) angular = {};
-if (!angular.test) angular.test = {};
-if (!angular.test.GIVEN) angular.test.GIVEN = {};
-if (!angular.test.WHEN) angular.test.WHEN = {};
-if (!angular.test.THEN) angular.test.THEN = {};
+if (!angular) var angular = window['angular'] = {};
+if (!angular['test']) var angularTest = angular['test'] = {};
+if (!angular['test']['GIVEN']) angularTest['GIVEN'] = {};
+if (!angular['test']['WHEN']) angularTest['WHEN'] = {};
+if (!angular['test']['THEN']) angularTest['THEN'] = {};
--
cgit v1.2.3