From 715c4001a95a8806f2b8c7b1f6667855d4f12cfa Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 9 Sep 2008 17:50:41 +0000 Subject: [PATCH] Making the xml_eq test method ignore whitespace only nodes by default. This can be configured by setting the ignoreWhiteSpace option. (see #1639) git-svn-id: http://svn.openlayers.org/trunk/openlayers@7987 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- tests/xml_eq.js | 77 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 12 deletions(-) diff --git a/tests/xml_eq.js b/tests/xml_eq.js index c330979945..47084cd858 100644 --- a/tests/xml_eq.js +++ b/tests/xml_eq.js @@ -97,10 +97,13 @@ * Parameters: * got - {DOMElement} * expected - {DOMElement} - * options - {Object} Optional object for configuring test options. Set - * 'prefix' property to true in order to compare element and attribute - * prefixes (namespace uri always tested). By default, prefixes - * are not tested. + * options - {Object} Optional object for configuring test options. + * + * Valid options: + * prefix - {Boolean} Compare element and attribute + * prefixes (namespace uri always tested). Default is false. + * includeWhiteSpace - {Boolean} Include whitespace only nodes when + * comparing child nodes. Default is false. */ function assertElementNodesEqual(got, expected, options) { var testPrefix = (options && options.prefix === true); @@ -190,14 +193,17 @@ } // compare children + var gotChildNodes = getChildNodes(got, options); + var expChildNodes = getChildNodes(expected, options); + assertEqual( - got.childNodes.length, expected.childNodes.length, + gotChildNodes.length, expChildNodes.length, "Children length mismatch for " + got.nodeName ); - for(var j=0; j