<commit_before>if(typeof(jQuery) === "undefined"){
	throw("Unable to find jQuery");
}

if(typeof(luga) === "undefined"){
	luga = {};
}

(function(){
	"use strict";

	luga.jasmine = {};

	luga.jasmine.version = "0.1";

	var CONST = {
		CSS_CLASSES: {
			TRIGGER: "luga-jasmine-trigger"
		},
		SELECTORS: {
			FIRST_CHILD: ":first-child",
			ROOT_SUITE: ".summary > .suite",
			NODE_TITLE: "> li.suite-detail",
			NODE_SPECS: "> ul.specs",
			NODE_SUITES: "> ul.suite"
		},
		TEXT: {
			PLUS: "+",
			MINUS: "-"
		}
	};

	luga.jasmine.Suite = function(root){
		var rootNode = null;
		var titleNode = null;

		var self = this;

		var specs = [];
		var suites = [];
		var expanded = true;
		var triggerNode = jQuery("<a></a>").text(CONST.TEXT.MINUS).addClass(CONST.CSS_CLASSES.TRIGGER);

		var init = function(){
			rootNode = root;
			titleNode = rootNode.find(CONST.SELECTORS.NODE_TITLE);
			triggerNode.insertBefore(titleNode.find(CONST.SELECTORS.FIRST_CHILD));

			rootNode.find(CONST.SELECTORS.NODE_SPECS).each(function(index, item){
				specs.push(jQuery(item));
			});
			rootNode.find(CONST.SELECTORS.NODE_SUITES).each(function(index, item){
				var childSuite = new luga.jasmine.Suite(jQuery(item));
				suites.push(childSuite);
			});

			attachEvents();
		};

		var attachEvents = function(){
			triggerNode.click(function(event){
				event.preventDefault();
				if(expanded === true){
					self.collapse();
				}
				else{
					self.expand();
				}
			});
		};

		this.show = function(){
			rootNode.show();
		};

		this.hide = function(){
			rootNode.hide();
		};

		this.collapse = function(){
			triggerNode.text(CONST.TEXT.PLUS);
			for(var i = 0; i < suites.length; i++){
				suites[i].collapse();
				suites[i].hide();
			}
			for(var j = 0; j < specs.length; j++){
				specs[j].hide();
			}
			expanded = false;
		};

		this.expand = function(){
			triggerNode.text(CONST.TEXT.MINUS);
			for(var i = 0; i < suites.length; i++){
				suites[i].expand();
				suites[i].show();
			}
			for(var j = 0; j < specs.length; j++){
				specs[j].show();
			}
			expanded = true;
		};

		init();
	};

	luga.jasmine.init = function(){
		var rootNodes = jQuery(CONST.SELECTORS.ROOT_SUITE);
		for(var i = 0; i < rootNodes.length; i++){
			new luga.jasmine.Suite(jQuery(rootNodes[i]));
		}
	};

}());<commit_msg>Jasmine: Refactor<commit_after>if(typeof(jQuery) === "undefined"){
	throw("Unable to find jQuery");
}

if(typeof(luga) === "undefined"){
	luga = {};
}

(function(){
	"use strict";

	luga.jasmine = {};

	luga.jasmine.version = "0.1";

	var CONST = {
		CSS_CLASSES: {
			TRIGGER: "luga-jasmine-trigger"
		},
		SELECTORS: {
			FIRST_CHILD: ":first-child",
			ROOT_SUITE: ".summary > .suite",
			NODE_TITLE: "> li.suite-detail",
			NODE_SPECS: "> ul.specs",
			NODE_SUITES: "> ul.suite"
		},
		TEXT: {
			PLUS: "+",
			MINUS: "-"
		}
	};

	luga.jasmine.Suite = function(options){
		var config = {
			rootNode: null
		};
		jQuery.extend(config, options);
		var self = this;

		var specs = [];
		var suites = [];
		var expanded = true;
		var triggerNode = jQuery("<a></a>").text(CONST.TEXT.MINUS).addClass(CONST.CSS_CLASSES.TRIGGER);

		var init = function(){
			var titleNode = config.rootNode.find(CONST.SELECTORS.NODE_TITLE);
			triggerNode.insertBefore(titleNode.find(CONST.SELECTORS.FIRST_CHILD));

			config.rootNode.find(CONST.SELECTORS.NODE_SPECS).each(function(index, item){
				specs.push(jQuery(item));
			});
			config.rootNode.find(CONST.SELECTORS.NODE_SUITES).each(function(index, item){
				var childSuite = new luga.jasmine.Suite({
					rootNode: jQuery(item)
				});
				suites.push(childSuite);
			});
			attachEvents();
		};

		var attachEvents = function(){
			triggerNode.click(function(event){
				event.preventDefault();
				if(expanded === true){
					self.collapse();
				}
				else{
					self.expand();
				}
			});
		};

		this.show = function(){
			config.rootNode.show();
		};

		this.hide = function(){
			config.rootNode.hide();
		};

		this.collapse = function(){
			triggerNode.text(CONST.TEXT.PLUS);
			for(var i = 0; i < suites.length; i++){
				suites[i].collapse();
				suites[i].hide();
			}
			for(var j = 0; j < specs.length; j++){
				specs[j].hide();
			}
			expanded = false;
		};

		this.expand = function(){
			triggerNode.text(CONST.TEXT.MINUS);
			for(var i = 0; i < suites.length; i++){
				suites[i].expand();
				suites[i].show();
			}
			for(var j = 0; j < specs.length; j++){
				specs[j].show();
			}
			expanded = true;
		};

		init();
	};

	luga.jasmine.init = function(){
		jQuery(CONST.SELECTORS.ROOT_SUITE).each(function(index, item){
			var suite = new luga.jasmine.Suite({
					rootNode: jQuery(item)
				}
			);
		});
	};

}());
{'fraction_non_alphanumeric': 0.18985723417856382, 'fraction_numerical': 0.002770083102493075, 'mean_word_length': 3.176156583629893, 'pattern_counts': {'":': 2, '<': 16, '<?xml version=': 0, '>': 15, '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': '2717908', 'n_tokens_mistral': 2119, 'n_tokens_neox': 1722, 'n_words': 289}