<commit_before>// if(typeof require === 'function') var kff = require('../build/kff.js');

// describe('kff.CheckBinder', function()
// {
// 	it('should bind check binder', function()
// 	{
// 		var $input = $('<input type="checkbox" data-kff-bind="myModel.checked:check"/>');
// 		var view = new kff.BindingView(
// 		{
// 			element: $input,
// 			scope: {
// 				myModel: {
// 					checked: true
// 				}
// 			}
// 		});
// 		view.init();

// 		expect($input.is(':checked')).to.equal(true);
// 		view.getModel('myModel').checked = false;
// 		view.refresh();

// 		expect($input.is(':checked')).to.equal(false);
// 		$input.prop('checked', true).triggerHandler('click');
// 		view.refresh();

// 		expect(view.getModel('myModel').checked).to.equal(true);
// 	});

// });<commit_msg>test(kff.CheckBinder.test): update tests<commit_after>if(typeof require === 'function') var kff = require('../build/kff.js');

describe('kff.CheckBinder', function()
{
	it('should bind check binder', function()
	{
		var myModel = new kff.Cursor({
			checked: true
		});

		var dispatcher = new kff.Dispatcher({
			set: function(event)
			{
				event.cursor.set(event.value);
				return {
					type: 'refresh'
				};
			}
		});

		var $input = $('<input type="checkbox" data-kff-bind="myModel.checked:check"/>');
		var view = new kff.View(
		{
			element: $input,
			scope: {
				myModel: myModel
			},
			dispatcher: dispatcher
		});
		view.renderAll();
		view.runAll();

		expect($input.is(':checked')).to.equal(true);
		myModel.setIn('checked', false);
		view.refreshAll();

		expect($input.is(':checked')).to.equal(false);
		$input.prop('checked', true).triggerHandler('click');

		expect(myModel.getIn('checked')).to.equal(true);
	});

});
{'fraction_non_alphanumeric': 0.22672064777327935, 'fraction_numerical': 0.0, 'mean_word_length': 3.2610837438423643, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3295122', 'n_tokens_mistral': 704, 'n_tokens_neox': 629, 'n_words': 96}