/*
Unit test for count
*/
assert = chai.assert;
describe('Microformat.count', function() {
it('count', function(){
var doc,
node,
result;
var html = 'GlennJaneEvent2015-07-01';
doc = document.implementation.createHTMLDocument('New Document');
node = document.createElement('div');
node.innerHTML = html;
doc.body.appendChild(node);
options ={
'node': node,
};
result = Microformats.count(options);
assert.deepEqual( result, {'h-event': 1,'h-card': 2} );
});
it('count rels', function(){
var doc,
node,
result;
var html = 'GlennJaneEvent2015-07-01';
doc = document.implementation.createHTMLDocument('New Document');
node = document.createElement('div');
node.innerHTML = html;
doc.body.appendChild(node);
options ={
'node': node,
};
result = Microformats.count(options);
assert.deepEqual( result, {'h-event': 1,'h-card': 2, 'rels': 1} );
});
it('count - no results', function(){
var doc,
node,
result;
var html = 'Jane';
doc = document.implementation.createHTMLDocument('New Document');
node = document.createElement('div');
node.innerHTML = html;
doc.body.appendChild(node);
options ={
'node': node,
};
result = Microformats.count(options);
assert.deepEqual( result, {} );
});
it('count - no options', function(){
var result;
result = Microformats.count({});
assert.deepEqual( result, {} );
});
it('count - options.html', function(){
var options = {},
result;
options.html = 'GlennJaneEvent2015-07-01';
result = Microformats.count(options);
assert.deepEqual( result, {'h-event': 1,'h-card': 2} );
});
});