');
element.find('span').text(text);
container.append(element);
- return angular.extend(logger(element), {
+ return _(logger(element)).extend({
close: function(){
element.removeClass('running');
if(!element.hasClass('fail'))
@@ -81,7 +80,7 @@ angular.scenario.Runner.prototype = {
}
this.logger = logger(console);
var specNames = [];
- angular.foreach(this.specs, function(spec, name){
+ _(this.specs).each(function(spec, name){
specNames.push(name);
}, this);
specNames.sort();
@@ -109,7 +108,7 @@ angular.scenario.Runner.prototype = {
result.passed = false;
result.failed = true;
result.error = error;
- result.log('fail', angular.isString(error) ? error : angular.toJson(error)).fail();
+ result.log('fail', _(error).isString() ? error : toJson(error)).fail();
}
};
specThis = {
@@ -122,11 +121,11 @@ angular.scenario.Runner.prototype = {
function done() {
result.finished = true;
stepLogger.close();
- (callback||angular.noop).call(specThis);
+ (callback||_.identity).call(specThis);
}
function next(){
var step = spec.steps[spec.nextStepIndex];
- (result.log || {close:angular.noop}).close();
+ (result.log || {close:_.identity}).close();
result.log = null;
if (step) {
spec.nextStepIndex ++;
@@ -134,6 +133,7 @@ angular.scenario.Runner.prototype = {
try {
step.fn.call(specThis, next);
} catch (e) {
+ console.error(e);
result.fail(e);
done();
}
diff --git a/src/scenario/angular.prefix b/src/scenario/angular.prefix
new file mode 100644
index 00000000..5b44e17c
--- /dev/null
+++ b/src/scenario/angular.prefix
@@ -0,0 +1,30 @@
+/**
+ * The MIT License
+ *
+ * Copyright (c) 2010 Adam Abrons and Misko Hevery http://getangular.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+(function(window, document, previousOnLoad){
+ window.angular = {
+ scenario: {
+ dsl: window
+ }
+ };
+
diff --git a/src/scenario/angular.suffix b/src/scenario/angular.suffix
new file mode 100644
index 00000000..fc861cbf
--- /dev/null
+++ b/src/scenario/angular.suffix
@@ -0,0 +1,11 @@
+
+ var $scenarioRunner = new angular.scenario.Runner(window, jQuery);
+
+ window.onload = function(){
+ try {
+ if (previousOnLoad) previousOnLoad();
+ } catch(e) {}
+ $scenarioRunner.run(jQuery(window.document.body));
+ };
+
+})(window, document, window.onload);
diff --git a/src/scenario/bootstrap.js b/src/scenario/bootstrap.js
index 4c9cdc8d..694d0e97 100644
--- a/src/scenario/bootstrap.js
+++ b/src/scenario/bootstrap.js
@@ -18,6 +18,12 @@
document.write('');
}
+ window.angular = {
+ scenario: {
+ dsl: window
+ }
+ };
+
window.onload = function(){
_.defer(function(){
$scenarioRunner.run(jQuery(window.document.body));
@@ -27,8 +33,9 @@
addCSS("../../css/angular-scenario.css");
addScript("../../lib/underscore/underscore.js");
addScript("../../lib/jquery/jquery-1.4.2.js");
- addScript("../angular-bootstrap.js");
addScript("Runner.js");
+ addScript("../Angular.js");
+ addScript("../JSON.js");
addScript("DSL.js");
document.write('