From 9c0225512c63ebfc37e6408cc155d9da1fe682c9 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 26 Oct 2010 15:35:58 -0700 Subject: fixes IE related failures, and form submit event handling in ie --- src/scenario/Scenario.js | 9 +++++++++ src/scenario/output/Xml.js | 36 +++++++++++++++++++----------------- src/widgets.js | 4 ---- 3 files changed, 28 insertions(+), 21 deletions(-) (limited to 'src') 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('