summaryrefslogtreecommitdiffstats
path: root/toolkit/components/microformats/test/module-tests/html-test.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /toolkit/components/microformats/test/module-tests/html-test.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/components/microformats/test/module-tests/html-test.js')
-rw-r--r--toolkit/components/microformats/test/module-tests/html-test.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/toolkit/components/microformats/test/module-tests/html-test.js b/toolkit/components/microformats/test/module-tests/html-test.js
new file mode 100644
index 000000000..cd06c7b7f
--- /dev/null
+++ b/toolkit/components/microformats/test/module-tests/html-test.js
@@ -0,0 +1,50 @@
+/*
+Unit test for html
+*/
+
+assert = chai.assert;
+
+// Tests the private Modules.html object
+// Modules.html is unit tested as it has an interface access by other modules
+
+describe('Modules.html', function() {
+
+
+ it('parse', function(){
+ var html = '<a href="http://glennjones.net">Glenn Jones</a>',
+ bloghtml = '<section id="content" class="body"><ol id="posts-list" class="h-feed"><li><article class="h-entry"><header><h2 class="p-namee"><a href="#" rel="bookmark" title="Permalink to this POST TITLE">This be the title</a></h2></header><footer class="post-info"><abbr class="dt-published" title="2005-10-10T14:07:00-07:00">10th October 2005</abbr><address class="h-card p-author">By <a class="u-url p-name" href="#">Enrique Ramírez</a></address></footer><div class="e-content"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque venenatis nunc vitae libero iaculis elementum. Nullam et justo <a href="#">non sapien</a> dapibus blandit nec et leo. Ut ut malesuada tellus.</p></div></article></li></ol></section>',
+ node = document.createElement('div');
+
+ node.innerHTML = html;
+ assert.equal(Modules.html.parse( node ), html );
+
+ // make sure excludes 'data-include' marked items
+ var child = document.createElement('p');
+ child.setAttribute('data-include', 'true');
+ node.appendChild(child);
+ assert.equal( Modules.html.parse( node ), html );
+
+ node = document.createElement('div');
+ node.innerHTML = bloghtml;
+ assert.equal( Modules.html.parse( node ), bloghtml );
+
+ node = document.createElement('div');
+ assert.equal( Modules.html.parse( node ), '' );
+
+ child = document.createElement('br');
+ node.appendChild(child);
+ assert.equal( Modules.html.parse( node ), '<br />' );
+
+ node = document.createComment('test comment');
+ assert.equal( Modules.html.parse( node ), '' );
+
+ });
+
+
+
+
+
+
+
+
+});