diff --git a/example/personalLog/personalLog.js b/example/personalLog/personalLog.js
index c0273036..da946a6f 100644
--- a/example/personalLog/personalLog.js
+++ b/example/personalLog/personalLog.js
@@ -1,5 +1,5 @@
/**
- * @fileOverview Very simple personal log demo application to demostrate angular functionality,
+ * @fileOverview Very simple personal log demo application to demonstrate angular functionality,
* especially:
* - the MVC model
* - testability of controllers
@@ -46,7 +46,7 @@ function LogCtrl($cookieStore) {
logs.push(log);
$cookieStore.put(LOGS, logs);
self.newMsg = '';
- }
+ };
/**
@@ -56,16 +56,16 @@ function LogCtrl($cookieStore) {
this.rmLog = function(msgIdx) {
logs.splice(msgIdx,1);
$cookieStore.put(LOGS, logs);
- }
+ };
/**
* Persistently removes all logs.
*/
this.rmLogs = function() {
- logs.splice(0);
+ logs.splice(0, logs.length);
$cookieStore.remove(LOGS);
- }
+ };
}
//inject
diff --git a/scenario/widgets-scenario.js b/scenario/widgets-scenario.js
index ba3ef3cf..7e8b8ade 100644
--- a/scenario/widgets-scenario.js
+++ b/scenario/widgets-scenario.js
@@ -27,12 +27,22 @@ describe('widgets', function() {
expect(binding('multiselect').fromJson()).toEqual(['A', 'C']);
expect(binding('button').fromJson()).toEqual({'count': 0});
+ expect(binding('form').fromJson()).toEqual({'count': 0});
+
element('form a').click();
expect(binding('button').fromJson()).toEqual({'count': 1});
- element('input[value="submit"]').click();
+
+ element('input[value="submit input"]').click();
expect(binding('button').fromJson()).toEqual({'count': 2});
+ expect(binding('form').fromJson()).toEqual({'count': 1});
+
+ element('button:contains("submit button")').click();
+ expect(binding('button').fromJson()).toEqual({'count': 2});
+ expect(binding('form').fromJson()).toEqual({'count': 2});
+
element('input[value="button"]').click();
expect(binding('button').fromJson()).toEqual({'count': 3});
+
element('input[type="image"]').click();
expect(binding('button').fromJson()).toEqual({'count': 4});
diff --git a/scenario/widgets.html b/scenario/widgets.html
index a520a326..adf2fa27 100644
--- a/scenario/widgets.html
+++ b/scenario/widgets.html
@@ -73,15 +73,16 @@
| Buttons |
ng:change ng:click |
-
- |
| Repeaters |
diff --git a/src/scenario/Scenario.js b/src/scenario/Scenario.js
index f2ebc640..14d530ac 100644
--- a/src/scenario/Scenario.js
+++ b/src/scenario/Scenario.js
@@ -246,6 +246,15 @@ function browserTrigger(element, type) {
break;
}
element.fireEvent('on' + type);
+ if (lowercase(element.type) == 'submit') {
+ while(element) {
+ if (lowercase(element.nodeName) == 'form') {
+ element.fireEvent('onsubmit');
+ break;
+ }
+ element = element.parentNode;
+ }
+ }
} else {
var evnt = document.createEvent('MouseEvents');
evnt.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, element);
diff --git a/src/scenario/output/Xml.js b/src/scenario/output/Xml.js
index 47d98c78..cbc55ee7 100644
--- a/src/scenario/output/Xml.js
+++ b/src/scenario/output/Xml.js
@@ -3,10 +3,11 @@
*/
angular.scenario.output('xml', function(context, runner) {
var model = new angular.scenario.ObjectModel(runner);
-
+ var $ = function(args) {return new context.init(args);};
runner.on('RunnerEnd', function() {
- context.append('');
- serializeXml(context.find('> scenario'), model.value);
+ var scenario = $('');
+ context.append(scenario);
+ serializeXml(scenario, model.value);
});
/**
@@ -17,30 +18,31 @@ angular.scenario.output('xml', function(context, runner) {
*/
function serializeXml(context, tree) {
angular.foreach(tree.children, function(child) {
- context.append('');
- var describeContext = context.find('> describe:last');
+ var describeContext = $('');
describeContext.attr('id', child.id);
describeContext.attr('name', child.name);
+ context.append(describeContext);
serializeXml(describeContext, child);
});
- context.append('');
- context = context.find('> its');
+ var its = $('');
+ context.append(its);
angular.foreach(tree.specs, function(spec) {
- context.append('')
- var specContext = context.find('> it:last');
- specContext.attr('id', spec.id);
- specContext.attr('name', spec.name);
- specContext.attr('duration', spec.duration);
- specContext.attr('status', spec.status);
+ var it = $('');
+ it.attr('id', spec.id);
+ it.attr('name', spec.name);
+ it.attr('duration', spec.duration);
+ it.attr('status', spec.status);
+ its.append(it);
angular.foreach(spec.steps, function(step) {
- specContext.append('');
- var stepContext = specContext.find('> step:last');
+ var stepContext = $('');
stepContext.attr('name', step.name);
stepContext.attr('duration', step.duration);
stepContext.attr('status', step.status);
+ it.append(stepContext);
if (step.error) {
- stepContext.append('' +
- '' +
+ '' +
'');
scope.$eval();
expect(scope.submitted).not.toBeDefined();
diff --git a/test/manual.html b/test/manual.html
index 3b1886f3..dc491399 100644
--- a/test/manual.html
+++ b/test/manual.html
@@ -39,56 +39,80 @@
+
+
+
+
+
+
+
@@ -96,7 +120,10 @@ describe('manual', function(){