<commit_before>describe('View', function() {
	var Barefoot = requireModule('./index')
		, should = require('chai').should();

	describe('Mixin Functionality', function() {
		it('should apply a mixin to its prototype', function() {
			var mixin = { mix: function() { } }
				, View = requireModule('./view')
				, withMixin = View(mixin);

			withMixin.prototype.should.have.property('mix', mixin.mix);
		})
	})

	describe('addSubview', function() {
		var view;

		beforeEach(function() {
			view = new Barefoot.View({ el: 'body' });
		})

		it('should add a subview', function() {
			var subview = new Barefoot.View({ el: 'nav' });
			view.addSubview(subview);

			view.subviews[0].should.be.equal(subview);
		})

		it('should set the parent view of subview when adding the subview', function() {
			var subview = new Barefoot.View({ el: 'nav' });
			view.addSubview(subview);

			subview.parentView.should.be.equal(view);
		})
	})

	describe('removeSubview', function() {
		var view
			, subview;

		beforeEach(function() {
			view = new Barefoot.View({ el: 'body' });
			subview = new Barefoot.View({ el: 'nav' });
			view.addSubview(subview);
		})

		it('should remove a subview', function() {
			view.removeSubview(subview);
			view.subviews.should.have.length(0);
		})

		it('should reset the parent view of subview when removing the subview', function() {
			view.removeSubview(subview);
			should.not.exist(subview.parentView);
		})

		it('should call close on the subview on removal', function(done) {
			subview.close = done;
			view.removeSubview(subview);
		})
	})

})<commit_msg>more view tests<commit_after>describe('View', function() {
	var Barefoot = requireModule('./index')
		, should = requireModule('chai').should();

	describe('Mixin Functionality', function() {
		it('should apply a mixin to its prototype', function() {
			var mixin = { mix: function() { } }
				, View = requireModule('./view')
				, withMixin = View(mixin);

			withMixin.prototype.should.have.property('mix', mixin.mix);
		})
	})

	describe('addSubview', function() {
		var view;

		beforeEach(function() {
			view = new Barefoot.View({ el: 'body' });
		})

		it('should add a subview', function() {
			var subview = new Barefoot.View({ el: 'nav' });
			view.addSubview(subview);

			view.subviews[0].should.be.equal(subview);
		})

		it('should set the parent view of subview when adding the subview', function() {
			var subview = new Barefoot.View({ el: 'nav' });
			view.addSubview(subview);

			subview.parentView.should.be.equal(view);
		})
	})

	describe('removeSubview', function() {
		var view
			, subview;

		beforeEach(function() {
			view = new Barefoot.View({ el: 'body' });
			subview = new Barefoot.View({ el: 'nav' });
			view.addSubview(subview);
		})

		it('should remove a subview', function() {
			view.removeSubview(subview);
			view.subviews.should.have.length(0);
		})

		it('should reset the parent view of subview when removing the subview', function() {
			view.removeSubview(subview);
			should.not.exist(subview.parentView);
		})

		it('should call close on the subview on removal', function(done) {
			subview.close = done;
			view.removeSubview(subview);
		})
	})

	describe('render', function() {
		var view;

		beforeEach(function() {
			view = new Barefoot.View({ el: 'body' });
		})

		it('should call renderView', function(done) {
			view.renderView = done;
			view.render();
		})

		it('should throw an error if renderView is not implemented', function() {
			(function() {
				view.render();
			}).should.throw();
		})

		it('should call renderSubviews', function(done) {
			view.renderView = function() {};
			view.renderSubviews = done;
			view.render();
		})
	})

	describe('renderSubviews', function() {
		var view
			, subview;

		beforeEach(function() {
			view = new Barefoot.View({ el: 'body' });
			subview = new Barefoot.View({ el: 'nav' });
			
			view.$ = function() {};
			subview.renderView = function() {};
			view.addSubview(subview);
		})

		it('should call render on subviews', function(done) {
			subview.render = done;
			view.renderSubviews();
		})

		it('should call delegateEvents on subviews', function(done) {
			subview.delegateEvents = done;
			view.renderSubviews();
		})
	})
	
})
{'fraction_non_alphanumeric': 0.16588013213780084, 'fraction_numerical': 0.0009438414346389807, 'mean_word_length': 3.704772475027747, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3697931', 'n_tokens_mistral': 1626, 'n_tokens_neox': 1395, 'n_words': 322}