aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Compiler.js4
-rw-r--r--src/Scope.js14
-rw-r--r--src/delete/Binder.js76
-rw-r--r--src/delete/Widgets.js10
-rw-r--r--src/directives.js43
-rw-r--r--src/filters.js2
-rw-r--r--src/markups.js28
-rw-r--r--src/moveToAngularCom/ControlBar.js4
-rw-r--r--src/scenario/DSL.js5
-rw-r--r--src/scenario/Runner.js14
-rw-r--r--src/widgets.js18
11 files changed, 119 insertions, 99 deletions
diff --git a/src/Compiler.js b/src/Compiler.js
index c8910c27..9faafb13 100644
--- a/src/Compiler.js
+++ b/src/Compiler.js
@@ -121,7 +121,7 @@ Compiler.prototype = {
descend: function(value){ if(isDefined(value)) descend = value; return descend;},
directives: function(value){ if(isDefined(value)) directives = value; return directives;}
};
- priority = element.attr('ng-eval-order') || priority || 0;
+ priority = element.attr('ng:eval-order') || priority || 0;
if (isString(priority)) {
priority = PRIORITY[uppercase(priority)] || 0;
}
@@ -200,7 +200,7 @@ function eachAttribute(element, fn){
var i, attrs = element[0].attributes || [], chld, attr, name, value, attrValue = {};
for (i = 0; i < attrs.length; i++) {
attr = attrs[i];
- name = attr.name.replace(':', '-');
+ name = attr.name;
value = attr.value;
if (msie && name == 'href') {
value = decodeURIComponent(element[0].getAttribute(name, 2));
diff --git a/src/Scope.js b/src/Scope.js
index 637fc25e..35da77fe 100644
--- a/src/Scope.js
+++ b/src/Scope.js
@@ -46,6 +46,14 @@ function setter(instance, path, value){
///////////////////////////////////
var getterFnCache = {};
+var JS_KEYWORDS = {};
+foreach(
+ ["break", "const", "continue", "class", "delete",
+ "do", "while", "for", "function", "if",
+ "instanceof", "new", "return", "switch",
+ "this", "throw", "try", "catch", "with"],
+ function(key){ JS_KEYWORDS[key] = true;}
+);
function getterFn(path){
var fn = getterFnCache[path];
if (fn) return fn;
@@ -53,7 +61,7 @@ function getterFn(path){
var code = 'function (self){\n';
code += ' var last, fn, type;\n';
foreach(path.split('.'), function(key) {
- key = (key == 'this') ? '["this"]' : '.' + key;
+ key = (JS_KEYWORDS[key]) ? '["' + key + '"]' : '.' + key;
code += ' if(!self) return self;\n';
code += ' last = self;\n';
code += ' self = self' + key + ';\n';
@@ -71,8 +79,8 @@ function getterFn(path){
}
});
code += ' return self;\n}';
- fn = eval('(' + code + ')');
- fn.toString = function(){ return code; };
+ fn = eval('fn = ' + code);
+ fn["toString"] = function(){ return code; };
return getterFnCache[path] = fn;
}
diff --git a/src/delete/Binder.js b/src/delete/Binder.js
index 9fc32513..095e2b08 100644
--- a/src/delete/Binder.js
+++ b/src/delete/Binder.js
@@ -112,24 +112,24 @@ Binder.prototype = {
},
executeInit: function() {
- this.docFindWithSelf("[ng-init]").each(function() {
+ this.docFindWithSelf("[ng:init]").each(function() {
var jThis = jQuery(this);
var scope = jThis.scope();
try {
- scope.eval(jThis.attr('ng-init'));
+ scope.eval(jThis.attr('ng:init'));
} catch (e) {
- alert("EVAL ERROR:\n" + jThis.attr('ng-init') + '\n' + toJson(e, true));
+ alert("EVAL ERROR:\n" + jThis.attr('ng:init') + '\n' + toJson(e, true));
}
});
},
entity: function (scope) {
var self = this;
- this.docFindWithSelf("[ng-entity]").attr("ng-watch", function() {
+ this.docFindWithSelf("[ng-entity]").attr("ng:watch", function() {
try {
var jNode = jQuery(this);
var decl = scope.entity(jNode.attr("ng-entity"), self.datastore);
- return decl + (jNode.attr('ng-watch') || "");
+ return decl + (jNode.attr('ng:watch') || "");
} catch (e) {
log(e);
alert(e);
@@ -142,7 +142,7 @@ Binder.prototype = {
if (this.config['autoSubmit']) {
var submits = this.docFindWithSelf(":submit").not("[ng-action]");
submits.attr("ng-action", "$save()");
- submits.not(":disabled").not("ng-bind-attr").attr("ng-bind-attr", '{disabled:"{{$invalidWidgets}}"}');
+ submits.not(":disabled").not("ng:bind-attr").attr("ng:bind-attr", '{disabled:"{{$invalidWidgets}}"}');
}
this.precompile(this.doc)(this.doc, jNode.scope(), "");
this.docFindWithSelf("a[ng-action]").live('click', function (event) {
@@ -168,9 +168,9 @@ Binder.prototype = {
if (parts.length > 1 || Binder.binding(parts[0])) {
var parent = node.parentNode;
if (isLeafNode(parent)) {
- parent.setAttribute('ng-bind-template', node.nodeValue);
+ parent.setAttribute('ng:bind-template', node.nodeValue);
factories.push({path:path, fn:function(node, scope, prefix) {
- return new BindUpdater(node, node.getAttribute('ng-bind-template'));
+ return new BindUpdater(node, node.getAttribute('ng:bind-template'));
}});
} else {
for (var i = 0; i < parts.length; i++) {
@@ -180,7 +180,7 @@ Binder.prototype = {
if (binding) {
newNode = document.createElement("span");
var jNewNode = jQuery(newNode);
- jNewNode.attr("ng-bind", binding);
+ jNewNode.attr("ng:bind", binding);
if (i === 0) {
factories.push({path:path.concat(offset + i), fn:this.ng_bind});
}
@@ -228,13 +228,13 @@ Binder.prototype = {
}
if (!node.getAttribute) return;
- var nonBindable = node.getAttribute('ng-non-bindable');
+ var nonBindable = node.getAttribute('ng:non-bindable');
if (nonBindable || nonBindable === "") return;
var attributes = node.attributes;
if (attributes) {
- var bindings = node.getAttribute('ng-bind-attr');
- node.removeAttribute('ng-bind-attr');
+ var bindings = node.getAttribute('ng:bind-attr');
+ node.removeAttribute('ng:bind-attr');
bindings = bindings ? fromJson(bindings) : {};
var attrLen = attributes.length;
for (var i = 0; i < attrLen; i++) {
@@ -249,23 +249,23 @@ Binder.prototype = {
}
var json = toJson(bindings);
if (json.length > 2) {
- node.setAttribute("ng-bind-attr", json);
+ node.setAttribute("ng:bind-attr", json);
}
}
if (!node.getAttribute) log(node);
- var repeaterExpression = node.getAttribute('ng-repeat');
+ var repeaterExpression = node.getAttribute('ng:repeat');
if (repeaterExpression) {
- node.removeAttribute('ng-repeat');
+ node.removeAttribute('ng:repeat');
var precompiled = this.precompile(node);
- var view = document.createComment("ng-repeat: " + repeaterExpression);
+ var view = document.createComment("ng:repeat: " + repeaterExpression);
var parentNode = node.parentNode;
parentNode.insertBefore(view, node);
parentNode.removeChild(node);
function template(childScope, prefix, i) {
var clone = jQuery(node).clone();
clone.css('display', '');
- clone.attr('ng-repeat-index', "" + i);
+ clone.attr('ng:repeat-index', "" + i);
clone.data('scope', childScope);
precompiled(clone[0], childScope, prefix + i + ":");
return clone;
@@ -276,16 +276,16 @@ Binder.prototype = {
return;
}
- if (node.getAttribute('ng-eval')) factories.push({path:path, fn:this.ng_eval});
- if (node.getAttribute('ng-bind')) factories.push({path:path, fn:this.ng_bind});
- if (node.getAttribute('ng-bind-attr')) factories.push({path:path, fn:this.ng_bind_attr});
- if (node.getAttribute('ng-hide')) factories.push({path:path, fn:this.ng_hide});
- if (node.getAttribute('ng-show')) factories.push({path:path, fn:this.ng_show});
- if (node.getAttribute('ng-class')) factories.push({path:path, fn:this.ng_class});
- if (node.getAttribute('ng-class-odd')) factories.push({path:path, fn:this.ng_class_odd});
- if (node.getAttribute('ng-class-even')) factories.push({path:path, fn:this.ng_class_even});
- if (node.getAttribute('ng-style')) factories.push({path:path, fn:this.ng_style});
- if (node.getAttribute('ng-watch')) factories.push({path:path, fn:this.ng_watch});
+ if (node.getAttribute('ng:eval')) factories.push({path:path, fn:this.ng_eval});
+ if (node.getAttribute('ng:bind')) factories.push({path:path, fn:this.ng_bind});
+ if (node.getAttribute('ng:bind-attr')) factories.push({path:path, fn:this.ng_bind_attr});
+ if (node.getAttribute('ng:hide')) factories.push({path:path, fn:this.ng_hide});
+ if (node.getAttribute('ng:show')) factories.push({path:path, fn:this.ng_show});
+ if (node.getAttribute('ng:class')) factories.push({path:path, fn:this.ng_class});
+ if (node.getAttribute('ng:class-odd')) factories.push({path:path, fn:this.ng_class_odd});
+ if (node.getAttribute('ng:class-even')) factories.push({path:path, fn:this.ng_class_even});
+ if (node.getAttribute('ng:style')) factories.push({path:path, fn:this.ng_style});
+ if (node.getAttribute('ng:watch')) factories.push({path:path, fn:this.ng_watch});
var nodeName = node.nodeName;
if ((nodeName == 'INPUT' ) ||
nodeName == 'TEXTAREA' ||
@@ -301,7 +301,7 @@ Binder.prototype = {
var html = jQuery('<select/>').append(jQuery(node).clone()).html();
if (!html.match(/<option(\s.*\s|\s)value\s*=\s*.*>.*<\/\s*option\s*>/gi)) {
if (Binder.hasBinding(node.text)) {
- jQuery(node).attr('ng-bind-attr', angular.toJson({'value':node.text}));
+ jQuery(node).attr('ng:bind-attr', angular.toJson({'value':node.text}));
} else {
node.value = node.text;
}
@@ -315,42 +315,42 @@ Binder.prototype = {
},
ng_eval: function(node) {
- return new EvalUpdater(node, node.getAttribute('ng-eval'));
+ return new EvalUpdater(node, node.getAttribute('ng:eval'));
},
ng_bind: function(node) {
- return new BindUpdater(node, "{{" + node.getAttribute('ng-bind') + "}}");
+ return new BindUpdater(node, "{{" + node.getAttribute('ng:bind') + "}}");
},
ng_bind_attr: function(node) {
- return new BindAttrUpdater(node, fromJson(node.getAttribute('ng-bind-attr')));
+ return new BindAttrUpdater(node, fromJson(node.getAttribute('ng:bind-attr')));
},
ng_hide: function(node) {
- return new HideUpdater(node, node.getAttribute('ng-hide'));
+ return new HideUpdater(node, node.getAttribute('ng:hide'));
},
ng_show: function(node) {
- return new ShowUpdater(node, node.getAttribute('ng-show'));
+ return new ShowUpdater(node, node.getAttribute('ng:show'));
},
ng_class: function(node) {
- return new ClassUpdater(node, node.getAttribute('ng-class'));
+ return new ClassUpdater(node, node.getAttribute('ng:class'));
},
ng_class_even: function(node) {
- return new ClassEvenUpdater(node, node.getAttribute('ng-class-even'));
+ return new ClassEvenUpdater(node, node.getAttribute('ng:class-even'));
},
ng_class_odd: function(node) {
- return new ClassOddUpdater(node, node.getAttribute('ng-class-odd'));
+ return new ClassOddUpdater(node, node.getAttribute('ng:class-odd'));
},
ng_style: function(node) {
- return new StyleUpdater(node, node.getAttribute('ng-style'));
+ return new StyleUpdater(node, node.getAttribute('ng:style'));
},
ng_watch: function(node, scope) {
- scope.watch(node.getAttribute('ng-watch'));
+ scope.watch(node.getAttribute('ng:watch'));
}
};
diff --git a/src/delete/Widgets.js b/src/delete/Widgets.js
index 96b63793..53536ed0 100644
--- a/src/delete/Widgets.js
+++ b/src/delete/Widgets.js
@@ -19,7 +19,7 @@ WidgetFactory.prototype = {
if (exp) exp = exp.split(':').pop();
var event = "change";
var bubbleEvent = true;
- var formatter = angularFormatter[input.attr('ng-format')] || angularFormatter['noop'];
+ var formatter = angularFormatter[input.attr('ng:format')] || angularFormatter['noop'];
if (type == 'button' || type == 'submit' || type == 'reset' || type == 'image') {
controller = new ButtonController(input[0], exp, formatter);
event = "click";
@@ -99,7 +99,7 @@ angularCallbacks['flashEvent'] = function(id, event, args) {
FileController.template = function(id) {
return jQuery('<span class="ng-upload-widget">' +
- '<input type="checkbox" ng-non-bindable="true"/>' +
+ '<input type="checkbox" ng:non-bindable="true"/>' +
'<object id="' + id + '" />' +
'<a></a>' +
'<span/>' +
@@ -191,8 +191,8 @@ function TextController(view, exp, formatter) {
this.view = view;
this.formatter = formatter;
this.exp = exp;
- this.validator = view.getAttribute('ng-validate');
- this.required = typeof view.attributes['ng-required'] != "undefined";
+ this.validator = view.getAttribute('ng:validate');
+ this.required = typeof view.attributes['ng:required'] != "undefined";
this.lastErrorText = null;
this.lastValue = undefined;
this.initialValue = this.formatter['parse'](view.value);
@@ -640,7 +640,7 @@ function RepeaterUpdater(view, repeaterExpression, template, prefix) {
this.children = [];
var match = repeaterExpression.match(/^\s*(.+)\s+in\s+(.*)\s*$/);
if (! match) {
- throw "Expected ng-repeat in form of 'item in collection' but got '" +
+ throw "Expected ng:repeat in form of 'item in collection' but got '" +
repeaterExpression + "'.";
}
var keyValue = match[1];
diff --git a/src/directives.js b/src/directives.js
index cabf0c23..a333c4c4 100644
--- a/src/directives.js
+++ b/src/directives.js
@@ -1,10 +1,10 @@
-angularDirective("ng-init", function(expression){
+angularDirective("ng:init", function(expression){
return function(element){
this.$tryEval(expression, element);
};
});
-angularDirective("ng-controller", function(expression){
+angularDirective("ng:controller", function(expression){
return function(element){
var controller = getter(window, expression, true) || getter(this, expression, true);
if (!controller)
@@ -16,13 +16,13 @@ angularDirective("ng-controller", function(expression){
};
});
-angularDirective("ng-eval", function(expression){
+angularDirective("ng:eval", function(expression){
return function(element){
this.$onEval(expression, element);
};
});
-angularDirective("ng-bind", function(expression){
+angularDirective("ng:bind", function(expression){
return function(element) {
var lastValue = noop, lastError = noop;
this.$onEval(function() {
@@ -89,7 +89,7 @@ function compileBindTemplate(template){
return fn;
}
-angularDirective("ng-bind-template", function(expression){
+angularDirective("ng:bind-template", function(expression){
var templateFn = compileBindTemplate(expression);
return function(element) {
var lastValue;
@@ -108,7 +108,7 @@ var REMOVE_ATTRIBUTES = {
'readonly':'readOnly',
'checked':'checked'
};
-angularDirective("ng-bind-attr", function(expression){
+angularDirective("ng:bind-attr", function(expression){
return function(element){
var lastValue = {};
this.$onEval(function(){
@@ -134,17 +134,17 @@ angularDirective("ng-bind-attr", function(expression){
};
});
-angularWidget("@ng-non-bindable", noop);
+angularWidget("@ng:non-bindable", noop);
-angularWidget("@ng-repeat", function(expression, element){
- element.removeAttr('ng-repeat');
- element.replaceWith(this.comment("ng-repeat: " + expression));
+angularWidget("@ng:repeat", function(expression, element){
+ element.removeAttr('ng:repeat');
+ element.replaceWith(this.comment("ng:repeat: " + expression));
var template = this.compile(element);
return function(reference){
var match = expression.match(/^\s*(.+)\s+in\s+(.*)\s*$/),
lhs, rhs, valueIdent, keyIdent;
if (! match) {
- throw "Expected ng-repeat in form of 'item in collection' but got '" +
+ throw "Expected ng:repeat in form of 'item in collection' but got '" +
expression + "'.";
}
lhs = match[1];
@@ -162,8 +162,9 @@ angularWidget("@ng-repeat", function(expression, element){
var children = [], currentScope = this;
this.$onEval(function(){
var index = 0, childCount = children.length, childScope, lastElement = reference,
- collection = this.$tryEval(rhs, reference);
+ collection = this.$tryEval(rhs, reference), is_array = isArray(collection);
for ( var key in collection) {
+ if (is_array && !collection.hasOwnProperty(key)) break;
if (index < childCount) {
// reuse existing child
childScope = children[index];
@@ -176,7 +177,7 @@ angularWidget("@ng-repeat", function(expression, element){
if (keyIdent) childScope[keyIdent] = key;
lastElement.after(childScope.$element);
childScope.$index = index;
- childScope.$element.attr('ng-repeat-index', index);
+ childScope.$element.attr('ng:repeat-index', index);
childScope.$init();
children.push(childScope);
}
@@ -192,7 +193,7 @@ angularWidget("@ng-repeat", function(expression, element){
};
});
-angularDirective("ng-click", function(expression, element){
+angularDirective("ng:click", function(expression, element){
return function(element){
var self = this;
element.bind('click', function(){
@@ -203,7 +204,7 @@ angularDirective("ng-click", function(expression, element){
};
});
-angularDirective("ng-watch", function(expression, element){
+angularDirective("ng:watch", function(expression, element){
return function(element){
var self = this;
new Parser(expression).watch()({
@@ -231,11 +232,11 @@ function ngClass(selector) {
};
}
-angularDirective("ng-class", ngClass(function(){return true;}));
-angularDirective("ng-class-odd", ngClass(function(i){return i % 2 === 0;}));
-angularDirective("ng-class-even", ngClass(function(i){return i % 2 === 1;}));
+angularDirective("ng:class", ngClass(function(){return true;}));
+angularDirective("ng:class-odd", ngClass(function(i){return i % 2 === 0;}));
+angularDirective("ng:class-even", ngClass(function(i){return i % 2 === 1;}));
-angularDirective("ng-show", function(expression, element){
+angularDirective("ng:show", function(expression, element){
return function(element){
this.$onEval(function(){
element.css('display', toBoolean(this.$eval(expression)) ? '' : 'none');
@@ -243,7 +244,7 @@ angularDirective("ng-show", function(expression, element){
};
});
-angularDirective("ng-hide", function(expression, element){
+angularDirective("ng:hide", function(expression, element){
return function(element){
this.$onEval(function(){
element.css('display', toBoolean(this.$eval(expression)) ? 'none' : '');
@@ -251,7 +252,7 @@ angularDirective("ng-hide", function(expression, element){
};
});
-angularDirective("ng-style", function(expression, element){
+angularDirective("ng:style", function(expression, element){
return function(element){
this.$onEval(function(){
element.css(this.$eval(expression));
diff --git a/src/filters.js b/src/filters.js
index a911b935..24464477 100644
--- a/src/filters.js
+++ b/src/filters.js
@@ -2,7 +2,7 @@ var angularFilterGoogleChartApi;
foreach({
'currency': function(amount){
- this.$element.toggleClass('ng-format-negative', amount < 0);
+ this.$element.toggleClass('ng:format-negative', amount < 0);
return '$' + angularFilter['number'].apply(this, [amount, 2]);
},
diff --git a/src/markups.js b/src/markups.js
index 74b293b8..ac2b5636 100644
--- a/src/markups.js
+++ b/src/markups.js
@@ -32,14 +32,14 @@ angularTextMarkup('{{}}', function(text, textNode, parentElement) {
self = this;
if (hasBindings(bindings)) {
if (isLeafNode(parentElement[0])) {
- parentElement.attr('ng-bind-template', text);
+ parentElement.attr('ng:bind-template', text);
} else {
var cursor = textNode, newElement;
foreach(parseBindings(text), function(text){
var exp = binding(text);
if (exp) {
newElement = self.element('span');
- newElement.attr('ng-bind', exp);
+ newElement.attr('ng:bind', exp);
} else {
newElement = self.text(text);
}
@@ -68,18 +68,18 @@ angularTextMarkup('OPTION', function(text, textNode, parentElement){
}
});
-var NG_BIND_ATTR = 'ng-bind-attr';
+var NG_BIND_ATTR = 'ng:bind-attr';
angularAttrMarkup('{{}}', function(value, name, element){
- if (name.substr(0, 3) != 'ng-') {
- if (msie && name == 'src')
- value = decodeURI(value);
- var bindings = parseBindings(value),
- bindAttr;
- if (hasBindings(bindings)) {
- element.removeAttr(name);
- bindAttr = fromJson(element.attr(NG_BIND_ATTR) || "{}");
- bindAttr[name] = value;
- element.attr(NG_BIND_ATTR, toJson(bindAttr));
- }
+ // don't process existing attribute markup
+ if (angularDirective(name) || angularDirective("@" + name)) return;
+ if (msie && name == 'src')
+ value = decodeURI(value);
+ var bindings = parseBindings(value),
+ bindAttr;
+ if (hasBindings(bindings)) {
+ element.removeAttr(name);
+ bindAttr = fromJson(element.attr(NG_BIND_ATTR) || "{}");
+ bindAttr[name] = value;
+ element.attr(NG_BIND_ATTR, toJson(bindAttr));
}
});
diff --git a/src/moveToAngularCom/ControlBar.js b/src/moveToAngularCom/ControlBar.js
index 685beeb2..b9a2de8a 100644
--- a/src/moveToAngularCom/ControlBar.js
+++ b/src/moveToAngularCom/ControlBar.js
@@ -9,14 +9,14 @@ function ControlBar(document, serverUrl, database) {
ControlBar.HTML =
'<div>' +
'<div class="ui-widget-overlay"></div>' +
- '<div id="ng-login" ng-non-bindable="true">' +
+ '<div id="ng-login" ng:non-bindable="true">' +
'<div class="ng-login-container"></div>' +
'</div>' +
'</div>';
ControlBar.FORBIDEN =
- '<div ng-non-bindable="true" title="Permission Error:">' +
+ '<div ng:non-bindable="true" title="Permission Error:">' +
'Sorry, you do not have permission for this!'+
'</div>';
diff --git a/src/scenario/DSL.js b/src/scenario/DSL.js
index 194a28d6..b713cfd6 100644
--- a/src/scenario/DSL.js
+++ b/src/scenario/DSL.js
@@ -35,9 +35,8 @@ angular.scenario.dsl.input = function(selector) {
value + "'", function(done){
var input = this.testDocument.
find(':radio[name$=@' + selector + '][value=' + value + ']');
- var event = this.testWindow.document.createEvent('MouseEvent');
- event.initMouseEvent('click', true, true, this.testWindow, 0,0,0,0,0, false, false, false, false, 0, null);
- input[0].dispatchEvent(event);
+ jqLiteWrap(input[0]).trigger('click');
+ input[0].checked = true;
done();
});
}
diff --git a/src/scenario/Runner.js b/src/scenario/Runner.js
index 8e0cc909..13ba5af0 100644
--- a/src/scenario/Runner.js
+++ b/src/scenario/Runner.js
@@ -5,6 +5,7 @@ angular.scenario.Runner = function(scope, jQuery){
var self = scope.$scenario = this;
this.scope = scope;
this.jQuery = jQuery;
+ this.scope.$testrun = {done: false, results: []};
var specs = this.specs = {};
var path = [];
@@ -40,7 +41,7 @@ angular.scenario.Runner = function(scope, jQuery){
self.currentSpec = null;
};
this.logger = function returnNoop(){
- return extend(returnNoop, {close:noop, fail:noop});;
+ return extend(returnNoop, {close:noop, fail:noop});
};
};
@@ -99,6 +100,8 @@ angular.scenario.Runner.prototype = {
var next = specNames.shift();
if(next) {
self.execute(next, callback);
+ } else {
+ self.scope.$testrun.done = true;
}
};
callback();
@@ -111,6 +114,7 @@ angular.scenario.Runner.prototype = {
execute: function(name, callback) {
var spec = this.specs[name],
self = this,
+ stepsDone = [],
result = {
passed: false,
failed: false,
@@ -143,15 +147,23 @@ angular.scenario.Runner.prototype = {
if (step) {
spec.nextStepIndex ++;
result.log = stepLogger('step', step.name);
+ stepsDone.push(step.name);
try {
step.fn.call(specThis, next);
} catch (e) {
console.error(e);
result.fail(e);
+ self.scope.$testrun.results.push(
+ {name: name, passed: false, error: e, steps: stepsDone});
done();
}
} else {
result.passed = !result.failed;
+ self.scope.$testrun.results.push({
+ name: name,
+ passed: !result.failed,
+ error: result.error,
+ steps: stepsDone});
done();
}
};
diff --git a/src/widgets.js b/src/widgets.js
index efafa9c5..0b77dbf4 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -15,7 +15,7 @@ function modelAccessor(scope, element) {
function modelFormattedAccessor(scope, element) {
var accessor = modelAccessor(scope, element),
- formatterName = element.attr('ng-format') || NOOP,
+ formatterName = element.attr('ng:format') || NOOP,
formatter = angularFormatter(formatterName);
if (!formatter) throw "Formatter named '" + formatterName + "' not found.";
return {
@@ -33,10 +33,10 @@ function compileValidator(expr) {
}
function valueAccessor(scope, element) {
- var validatorName = element.attr('ng-validate') || NOOP,
+ var validatorName = element.attr('ng:validate') || NOOP,
validator = compileValidator(validatorName),
- requiredExpr = element.attr('ng-required'),
- formatterName = element.attr('ng-format') || NOOP,
+ requiredExpr = element.attr('ng:required'),
+ formatterName = element.attr('ng:format') || NOOP,
formatter = angularFormatter(formatterName),
format, parse, lastError, required;
invalidWidgets = scope.$invalidWidgets || {markValid:noop, markInvalid:noop};
@@ -193,10 +193,10 @@ function inputWidget(events, modelAccessor, viewAccessor, initFn) {
var scope = this,
model = modelAccessor(scope, element),
view = viewAccessor(scope, element),
- action = element.attr('ng-change') || '',
+ action = element.attr('ng:change') || '',
lastValue;
initFn.call(scope, model, view, element);
- this.$eval(element.attr('ng-init')||'');
+ this.$eval(element.attr('ng:init')||'');
// Don't register a handler if we are a button (noopAccessor) and there is no action
if (action || modelAccessor !== noopAccessor) {
element.bind(events, function(){
@@ -236,11 +236,11 @@ angularWidget('NG:INCLUDE', function(element){
var compiler = this,
srcExp = element.attr("src"),
scopeExp = element.attr("scope") || '';
- if (element[0]['ng-compiled']) {
+ if (element[0]['ng:compiled']) {
this.descend(true);
this.directives(true);
} else {
- element[0]['ng-compiled'] = true;
+ element[0]['ng:compiled'] = true;
return function(element){
var scope = this, childScope;
var changeCounter = 0;
@@ -276,7 +276,7 @@ var ngSwitch = angularWidget('NG:SWITCH', function (element){
cases = [];
if (!usingFn) throw "Using expression '" + usingExpr + "' unknown.";
eachNode(element, function(caseElement){
- var when = caseElement.attr('ng-switch-when');
+ var when = caseElement.attr('ng:switch-when');
if (when) {
cases.push({
when: function(scope, value){