Permalink
Browse files

Add tests for parseHTML

  • Loading branch information...
1 parent c5460f7 commit 1198b0ed2bfa04a3d9ac1e696877ce3a7655da98 @samclarke committed Aug 11, 2013
Showing with 33 additions and 0 deletions.
  1. +33 −0 tests/dom.js
View
@@ -103,6 +103,39 @@
);
});
+
+ test('parseHTML', function() {
+ expect(3);
+
+ var node, parsed;
+
+
+ parsed = $.sceditor.dom.parseHTML('<span>one</span>');
+ equal(
+ parsed.length,
+ 1,
+ 'Parse single node'
+ );
+
+
+ node = html2dom('<span>span<div style="font-weight: bold;">div</div>span</span>');
+ parsed = $.sceditor.dom.parseHTML('<span>span<div style="font-weight: bold;">div</div>span</span>');
+ equal(
+ parsed[0].outerHTML,
+ node.innerHTML,
+ 'Parse single node'
+ );
+
+
+ parsed = $.sceditor.dom.parseHTML('<span>one</span><span>two</span><span>three</span>');
+ equal(
+ parsed.length,
+ 3,
+ 'Parse multiple nodes'
+ );
+ });
+
+
// IE 8 and below adds new lines when calling innerHTML even through
// they don't exist in the DOM. Instead of fixing it, just skip IE < 8
// for this test.

0 comments on commit 1198b0e

Please sign in to comment.