/**
* Module Dependencies
*/
var assert = require('assert');
try {
var iterator = require('dom-iterator');
var parse = require('domify');
} catch (e) {
var iterator = require('../');
var parse = function(str) { return require('mini-html-parser')(str).parse(); };
}
/**
* Tests
*/
describe('iterator', function() {
var dom, i, article;
beforeEach(function() {
dom = parse('
hiwhateveromgbye');
article = dom.childNodes[1];
});
describe('(dom)', function() {
it('should iterate from the top', function() {
i = iterator(dom);
assert('' == format(i));
assert('hi' == format(i.next(), i));
assert('' == format(i.next(), i));
assert('' == format(i.next(), i));
assert('whatever' == format(i.next(), i));
assert('' == format(i.next(), i));
assert('omg' == format(i.next(), i));
assert('' == format(i.next(), i));
assert('' == format(i.next(), i));
assert('' == format(i.next(), i));
assert('bye' == format(i.next(), i));
assert('' == format(i.next(), i));
assert(null == i.next());
assert(null == i.next());
assert(null == i.next());
assert('