<commit_before>var should = require("should");
var loader = require("../");

function loadAndEval() {
	var module = {};
	eval(loader.call.apply(loader, arguments));
	return module.exports;
}

describe("loader", function() {
	
	it("should convert to requires", function() {
		loadAndEval({}, '<h1>Hello World</h1>')().should.be.eql(
			'<h1>Hello World</h1>'
		);
	});

	it("should allow to pass values", function() {
		loadAndEval({}, '<h1>Hello <%= name %></h1>')({name : 'Moon'}).should.be.eql(
			'<h1>Hello Moon</h1>'
		);
	});

	it("should allow to minify html", function() {
		loadAndEval({
		   query: "?minimize=true"
		}, '<h1  >Hello <%= name %></h1>')({name : 'Moon'})
		.should.be.eql(
			'<h1>Hello Moon</h1>'
		);
	});

	it("should allow to minify html and collapse whitespaces", function() {
		loadAndEval({
		   query: "?minimize=true&collapseWhitespace=true"
		}, '<div>\n<h1>Hello <span><%= name %></span></h1>\n</div>')({name : 'Moon'})
		.should.be.eql(
			'<div><h1>Hello <span>Moon</span></h1></div>'
		);
	});<commit_msg>Add test for data attributes<commit_after>var should = require("should");
var loader = require("../");

function loadAndEval() {
	var module = {};
	eval(loader.call.apply(loader, arguments));
	return module.exports;
}

describe("loader", function() {
	
	it("should convert to requires", function() {
		loadAndEval({}, '<h1>Hello World</h1>')().should.be.eql(
			'<h1>Hello World</h1>'
		);
	});

	it("should allow to pass values", function() {
		loadAndEval({}, '<h1>Hello <%= name %></h1>')({name : 'Moon'}).should.be.eql(
			'<h1>Hello Moon</h1>'
		);
	});

	it("should allow to minify html", function() {
		loadAndEval({
		   query: "?minimize=true"
		}, '<h1  >Hello <%= name %></h1>')({name : 'Moon'})
		.should.be.eql(
			'<h1>Hello Moon</h1>'
		);
	});

	it("should allow to minify html with data attributes", function() {
		loadAndEval({
		   query: "?minimize=true"
		}, '<h1 data-attr="<%= name %>">Hello</h1>')({name : 'Moon'})
		.should.be.eql(
			'<h1 data-attr="Moon">Hello</h1>'
		);
	});

	it("should allow to minify html and collapse whitespaces", function() {
		loadAndEval({
		   query: "?minimize=true&collapseWhitespace=true"
		}, '<div>\n<h1>Hello <span><%= name %></span></h1>\n</div>')({name : 'Moon'})
		.should.be.eql(
			'<div><h1>Hello <span>Moon</span></h1></div>'
		);
	});
{'fraction_non_alphanumeric': 0.24286322965487858, 'fraction_numerical': 0.01533873029399233, 'mean_word_length': 4.1946902654867255, 'pattern_counts': {'":': 0, '<': 62, '<?xml version=': 0, '>': 62, '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': '4396445', 'n_tokens_mistral': 980, 'n_tokens_neox': 893, 'n_words': 176}