describe('each', function() {
	it('should iterate a NodeList', function() {
		var n = 0;
		Polydom(document.querySelectorAll('.each1')).each(function(i) {
			if (i === 1) {
				expect(this.textContent).to.be('each1.2');
			} else {
				expect(this.textContent).to.not.be('each1.2');
			}
			n++;
		});
		expect(n).to.be(3);
	});

	it('should accept a single Element', function() {
		var n = 0;
		Polydom(document.getElementById('each2')).each(function(i) {
			expect(i).to.be(0);
			expect(this.textContent).to.be('each2');
			n++;
		});
		expect(n).to.be(1);
	});

	it('should iterate an array', function() {
		var n = 0;
		Polydom([document.getElementById('each3'), document.getElementById('each3.2')]).each(function(i) {
			if (i === 0) {
				expect(this.textContent).to.be('each3');
			} else {
				expect(this.textContent).to.not.be('each2');
			}
			n++;
		});
		expect(n).to.be(2);
	});

	it('should not iterate an empty array', function() {
		var n = 0;
		Polydom([]).each(function(i) {
			n++;
		});
		expect(n).to.be(0);
	});

	it('should not iterate over the children of form elements', function() {
		var n = 0;
		Polydom(document.getElementById('each4')).each(function(i) {
			n++;
		});
		expect(n).to.be(1);
	});
});
