diff options
Diffstat (limited to 'src/scenario')
| -rw-r--r-- | src/scenario/Scenario.js | 9 | ||||
| -rw-r--r-- | src/scenario/output/Xml.js | 36 |
2 files changed, 28 insertions, 17 deletions
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('<scenario></scenario>'); - serializeXml(context.find('> scenario'), model.value); + var scenario = $('<scenario></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('<describe></describe>'); - var describeContext = context.find('> describe:last'); + var describeContext = $('<describe></describe>'); describeContext.attr('id', child.id); describeContext.attr('name', child.name); + context.append(describeContext); serializeXml(describeContext, child); }); - context.append('<its></its>'); - context = context.find('> its'); + var its = $('<its></its>'); + context.append(its); angular.foreach(tree.specs, function(spec) { - context.append('<it></it>') - 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></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('<step></step>'); - var stepContext = specContext.find('> step:last'); + var stepContext = $('<step></step>'); stepContext.attr('name', step.name); stepContext.attr('duration', step.duration); stepContext.attr('status', step.status); + it.append(stepContext); if (step.error) { - stepContext.append('<error></error'); - stepContext.find('error').text(formatException(step.error)); + var error = $('<error></error'); + stepContext.append(error); + error.text(formatException(stepContext.error)); } }); }); |
