<commit_before>define([ "geoladris-tests" ], function(tests) {
	describe("ui-input-field", function() {
		var bus;
		var injector;
		var module;
		var parentId = "myparent";

		beforeEach(function(done) {
			var initialization = tests.init("ui", {}, {
				"pikaday" : "../jslib/pikaday/1.5.1/pikaday",
				"pikaday.jquery" : "../jslib/pikaday/1.5.1/pikaday.jquery"
			});
			bus = initialization.bus;
			injector = initialization.injector;
			injector.require([ "ui-input-field" ], function(m) {
				module = m;
				done();
			});
			tests.replaceParent(parentId);
		});

		it("creates div on ui-input-field:create", function() {
			module({
				id : "myinput",
				parent : parentId
			});

			expect($("#" + parentId).children().length).toBe(1);
			expect($("#" + parentId).children("#myinput").length).toBe(1);
		});

		it("adds label if specified on create", function() {
			var text = "Input: ";
			module({
				id : "myinput",
				parent : parentId,
				label : text
			});

			var label = $("#myinput").find("label");
			expect(label.length).toBe(1);
			expect(label.text()).toEqual(text);
		});

		it("sets input type if specified on create", function() {
			module({
				id : "myinput",
				parent : parentId,
				type : "password"
			});

			var input = $("#myinput").find("input");
			expect(input.length).toBe(1);
			expect(input.attr("type")).toBe("password");
		});

		it("fills message on -field-value-fill", function() {
			var inputText = "Input Text";
			module({
				id : "myinput",
				parent : parentId
			});
			$("#myinput").find("input").val(inputText);

			var message = {};
			bus.send("myinput-field-value-fill", message);
			expect(message["myinput"]).toEqual(inputText);
		});

		it("adds placeholder if type is file", function() {
			module({
				id : "myinput",
				parent : parentId,
				type : "file"
			});
			var placeholder = $("#myinput").find(".ui-file-input-placeholder");
			expect(placeholder.length).toBe(1);
		});

		it("adds step=any for number fields", function() {
			module({
				id : "myinput",
				type : "number",
				parent : parentId
			});

			var input = $("#myinput").find("input");
			expect(input.attr("step")).toBe("any");
		});

		it("fills values with actual types (number, date,...) instead of strings", function() {
			module({
				id : "mynumber",
				type : "number",
				parent : parentId
			});
			module({
				id : "mydate",
				type : "date",
				parent : parentId
			});

			var number = $("#mynumber").find("input");
			number.val(57.6);
			var date = $("#mydate").find("input");
			date.val("2016-06-10");

			var message = {};
			bus.send("mynumber-field-value-fill", message);
			expect(message["mynumber"]).toEqual(57.6);<commit_msg>Fix ui-input-field tests<commit_after>define([ "geoladris-tests" ], function(tests) {
	describe("ui-input-field", function() {
		var bus;
		var injector;
		var module;
		var parentId = "myparent";

		beforeEach(function(done) {
			var initialization = tests.init("ui", {}, {
				"pikaday" : "../jslib/pikaday/1.5.1/pikaday",
				"pikaday.jquery" : "../jslib/pikaday/1.5.1/pikaday.jquery"
			});
			bus = initialization.bus;
			injector = initialization.injector;
			injector.require([ "ui-input-field" ], function(m) {
				module = m;
				done();
			});
			tests.replaceParent(parentId);
		});

		it("creates div", function() {
			module({
				id : "myinput",
				parent : parentId
			});

			expect($("#" + parentId).children().length).toBe(1);
			expect($("#" + parentId).children("#myinput").length).toBe(1);
		});

		it("adds label if specified on create", function() {
			var text = "Input: ";
			module({
				id : "myinput",
				parent : parentId,
				label : text
			});

			var label = $("#myinput").find("label");
			expect(label.length).toBe(1);
			expect(label.text()).toEqual(text);
		});

		it("sets input type if specified on create", function() {
			module({
				id : "myinput",
				parent : parentId,
				type : "password"
			});

			var input = $("#myinput").find("input");
			expect(input.length).toBe(1);
			expect(input.attr("type")).toBe("password");
		});

		it("fills message on -field-value-fill", function() {
			var inputText = "Input Text";
			module({
				id : "myinput",
				parent : parentId
			});
			$("#myinput").find("input").val(inputText);

			var message = {};
			bus.send("myinput-field-value-fill", message);
			expect(message["myinput"]).toEqual(inputText);
		});

		it("adds step=any for number fields", function() {
			module({
				id : "myinput",
				type : "number",
				parent : parentId
			});

			var input = $("#myinput").find("input");
			expect(input.attr("step")).toBe("any");
		});

		it("fills values with actual types (number, date,...) instead of strings", function() {
			module({
				id : "mynumber",
				type : "number",
				parent : parentId
			});
			module({
				id : "mydate",
				type : "date",
				parent : parentId
			});

			var number = $("#mynumber").find("input");
			number.val(57.6);
			var date = $("#mydate").find("input");
			date.val("2016-06-10");

			var message = {};
			bus.send("mynumber-field-value-fill", message);
			expect(message["mynumber"]).toEqual(57.6);
{'fraction_non_alphanumeric': 0.20489415420469995, 'fraction_numerical': 0.00951641095358322, 'mean_word_length': 3.214402618657938, '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': '129852', 'n_tokens_mistral': 2145, 'n_tokens_neox': 1722, 'n_words': 345}