/*
Unit test for hasMicroformat
*/
assert = chai.assert;
describe('Microformat.hasMicroformats', function() {
it('true - v2 on node', function(){
var doc,
node;
var html = 'Glenn';
doc = document.implementation.createHTMLDocument('New Document');
node = document.createElement('div');
doc.body.appendChild( node );
node.innerHTML = html;
node = doc.querySelector( 'a' );
assert.isTrue( Microformats.hasMicroformats( node ) );
});
it('true - v1 on node', function(){
var doc,
node;
var html = 'Glenn';
doc = document.implementation.createHTMLDocument('New Document');
node = document.createElement('div');
doc.body.appendChild( node );
node.innerHTML = html;
node = doc.querySelector( 'a' );
assert.isTrue( Microformats.hasMicroformats( node ) );
});
it('true - v2 filter on node', function(){
var doc,
node;
var html = 'Glenn';
doc = document.implementation.createHTMLDocument('New Document');
node = document.createElement('div');
doc.body.appendChild( node );
node.innerHTML = html;
node = doc.querySelector( 'a' );
assert.isTrue( Microformats.hasMicroformats( node, {'filters': ['h-card']} ) );
});
it('true - v1 filter on node', function(){
var doc,
node;
var html = 'Glenn';
doc = document.implementation.createHTMLDocument('New Document');
node = document.createElement('div');
doc.body.appendChild( node );
node.innerHTML = html;
node = doc.querySelector( 'a' );
assert.isTrue( Microformats.hasMicroformats( node, {'filters': ['h-card']} ) );
});
it('false - v2 filter on node', function(){
var doc,
node;
var html = 'Glenn';
doc = document.implementation.createHTMLDocument('New Document');
node = document.createElement('div');
doc.body.appendChild( node );
node.innerHTML = html;
node = doc.querySelector( 'a' );
assert.isFalse( Microformats.hasMicroformats( node, {'filters': ['h-entry']} ) );
});
it('false - property', function(){
var doc,
node,
parser;
var html = 'Glenn';
doc = document.implementation.createHTMLDocument('New Document');
node = document.createElement('div');
doc.body.appendChild( node );
node.innerHTML = html;
node = doc.querySelector( 'span' );
assert.isFalse( Microformats.hasMicroformats( node ) );
});
it('false - no class', function(){
var doc,
node,
parser;
var html = 'Glenn';
doc = document.implementation.createHTMLDocument('New Document');
node = document.createElement('div');
doc.body.appendChild( node );
node.innerHTML = html;
node = doc.querySelector( 'span' );
assert.isFalse( Microformats.hasMicroformats( node ) );
});
it('false - no node', function(){
assert.isFalse( Microformats.hasMicroformats( ) );
});
it('false - undefined node', function(){
assert.isFalse( Microformats.hasMicroformats( undefined ) );
});
it('true - child', function(){
var doc,
node;
var html = '