Merge pull request #4896 from ahocevar/xml-ignore-order
Ignore XML sequence when comparing GML
This commit is contained in:
@@ -1034,7 +1034,7 @@ describe('ol.format.GML3', function() {
|
|||||||
|
|
||||||
it('writes back features as GML', function() {
|
it('writes back features as GML', function() {
|
||||||
var serialized = gmlFormat.writeFeaturesNode(features);
|
var serialized = gmlFormat.writeFeaturesNode(features);
|
||||||
expect(serialized).to.xmleql(ol.xml.parse(text));
|
expect(serialized).to.xmleql(ol.xml.parse(text), {ignoreElementOrder: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -125,6 +125,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (options && options.ignoreElementOrder) {
|
||||||
|
nodes.sort(function(a, b) {
|
||||||
|
return a.nodeName > b.nodeName ? 1 : a.nodeName < b.nodeName ? -1 : 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,7 +280,8 @@
|
|||||||
/**
|
/**
|
||||||
* Checks if the XML document sort of equals another XML document.
|
* Checks if the XML document sort of equals another XML document.
|
||||||
* @param {Object} obj The other object.
|
* @param {Object} obj The other object.
|
||||||
* @param {Object} options The options.
|
* @param {{includeWhiteSpace: (boolean|undefined),
|
||||||
|
* ignoreElementOrder: (boolean|undefined)}=} options The options.
|
||||||
* @return {expect.Assertion} The assertion.
|
* @return {expect.Assertion} The assertion.
|
||||||
*/
|
*/
|
||||||
expect.Assertion.prototype.xmleql = function(obj, options) {
|
expect.Assertion.prototype.xmleql = function(obj, options) {
|
||||||
|
|||||||
Reference in New Issue
Block a user