<commit_before>/*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/
/*global start:false, stop:false ok:false, equal:false, notEqual:false, deepEqual:false*/
/*global notDeepEqual:false, strictEqual:false, notStrictEqual:false, raises:false*/
/*global isLocal:false*/

(function($){

module("Templating");

test("Unit Testing Environment", function () {
	expect(1);
	ok( !isLocal, "Unit tests shouldn't be run from file://, especially in Chrome. If you must test from file:// with Chrome, run it with the --allow-file-access-from-files flag!" );
});

asyncTest("Binding", function (){
	var runtime = new JEFRi.Runtime("testContext.json", {storeURI: "/test/"});
	var init = JEFRi.Template.init({
		templates: ["../src/template.html"]
	});
	_.when(runtime.ready, init).done(function(){
		var user = runtime.build("User", {name: "southerd", address: "<EMAIL>"});
		var view = JEFRi.Template.render(user);
		view.appendTo("#templates-target");
		view.find(".User._property.name").click();
		var input = view.find(".User._property.name input");
		ok(input.length, 'Click replaced with input');
		input = input.first();
		equal(input.val(), "southerd", "Edit field has default value.");
		// This is really hard to test.
		//ok(view.find(".User._property.name input:focus").length, "Name field has focus");
		input.val("david.souther");
		input.blur();
		equal(view.find('.User._property.name').text(), "david.souther", "New text in field propagates on blur.");
		start();
	});
});

}(jQuery));<commit_msg>Hack for testing view update.<commit_after>/*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/
/*global start:false, stop:false ok:false, equal:false, notEqual:false, deepEqual:false*/
/*global notDeepEqual:false, strictEqual:false, notStrictEqual:false, raises:false*/
/*global isLocal:false*/

(function($){

module("Templating");

test("Unit Testing Environment", function () {
	expect(1);
	ok( !isLocal, "Unit tests shouldn't be run from file://, especially in Chrome. If you must test from file:// with Chrome, run it with the --allow-file-access-from-files flag!" );
});

asyncTest("Binding", function (){
	var runtime = new JEFRi.Runtime("testContext.json", {storeURI: "/test/"});
	var init = JEFRi.Template.init({
		templates: ["../src/template.html"]
	});
	_.when(runtime.ready, init).done(function(){
		var user = runtime.build("User", {name: "southerd", address: "<EMAIL>"});
		var view = JEFRi.Template.render(user);
		view.appendTo("#templates-target");
		view.find(".User._property.name").click();
		var input = view.find(".User._property.name input");
		ok(input.length, 'Click replaced with input');
		input = input.first();
		equal(input.val(), "southerd", "Edit field has default value.");
		// This is really hard to test.
		//ok(view.find(".User._property.name input:focus").length, "Name field has focus");
		input.val("david.souther");
		input.blur();
		// In the name test, .text() includes the label in the <b>
		equal(view.find('.User._property.name').text(), "name: david.souther", "New text in field propagates on blur.");
		start();
	});
});

}(jQuery));
{'fraction_non_alphanumeric': 0.18935288492189992, 'fraction_numerical': 0.000637551801083838, 'mean_word_length': 4.988549618320611, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '337546', 'n_tokens_mistral': 1036, 'n_tokens_neox': 992, 'n_words': 261}