1 define(['libs/jquery-1.9.1.min', 'libs/chai'], function($, chai) {
\r
3 cleanUp: function(xml) {
\r
4 var rmws = function(node) {
\r
5 if(node.nodeType === 3) {
\r
6 node.data = $.trim(node.data);
\r
9 $(node).contents().each(function() {
\r
15 xml = $($.trim(xml));
\r
16 xml.each(function() {
\r
21 .replace(/(<.*>)\s*(<.*>)/gm, '$1$2')
\r
22 .replace(/(<\/.*>)\s*(<\/.*>)/gm, '$1$2')
\r
23 .replace(/(<\/.*>)\s*(<.*>)/gm, '$1$2');
\r
24 return $.trim(toret);*/
\r
25 return $('<div>').append(xml).html();
\r
28 assertDomEqual: function(lhs, rhs) {
\r
30 var rhsArr = $.parseHTML(rhs);
\r
31 if(rhsArr.length === 1) {
\r
35 $.each(rhsArr, function(i, el) {
\r
39 if(lhs.length > 1) {
\r
40 lhs = $('<div>').append(lhs);
\r
44 lhs.find('*').each(function() {$(this).attr('id', '');});
\r
45 rhs.find('*').each(function() {$(this).attr('id', '');});
\r
46 return chai.assert.ok(lhs[0].isEqualNode(rhs[0]), 'nodes are equal');
\r