<commit_before>// Create new YUI instance, and populate it with the required modules
YUI().use("node", "console", "test", "node-event-simulate", function (Y) {
 
	// Test Case for delayed images loaded
		var testCaseAsynch = new Y.Test.Case({
			name: "TestCase Images loaded after timeout",
			setUp : function() {
				$('#container')
					.append('<img class="lazy" data-href="../sample1.jpg" src="../img/blank.jpg" width="200" height="200"/> ')
					.append('<img class="lazy" data-href="../sample2.jpg" src="../img/blank.jpg" width="200" height="200" style="position:absolute; left:-1000px;"/> ')
			},
			tearDown : function() {
				$('.lazy').remove();
			},

			"test Images Loaded Asynchronously after DOM is ready" : function() {
				// Call to the method
				$('img.lazy').asynchImageLoader();

				this.wait(function(){
					Y.Assert.areEqual($('img.lazy').attr("src"), "../sample1.jpg");
					Y.Assert.isUndefined( $('img.lazy').attr('data-href'));
				}, 10);
			},

			"test Images Loaded Asynchronously with 1 seconds Delay" : function () {
				// Call to the method with timeout
				$('img.lazy').asynchImageLoader({timeout : 1000 });

				Y.Assert.areEqual($('img.lazy').attr("src"), "../img/blank.jpg");

				this.wait(function(){
					Y.Assert.areEqual($('img.lazy').attr("src"), "../sample1.jpg");
				}, 1000);
			},

			"Visible images should load immediately and hidden images on a delay" : function () {
				$('img.lazy').asynchImageLoader({ event:'load', timeout : 1000 });

				Y.Assert.areEqual( "../sample1.jpg", $('img.lazy:first').attr("src") );
				Y.Assert.areEqual( "../img/blank.jpg", $('img.lazy:last').attr("src") );

				this.wait(function(){
					Y.Assert.areEqual( "../sample2.jpg", $('img.lazy:last').attr("src") );
				}, 1001);
			}
		});
	
		// Test Case for images loading after a click
		var testCaseClickAsynch = new Y.Test.Case({
			name: "TestCase Images loaded after a click",
			setUp : function() {
				$('#container')
					.append('<a class="link">Link</a><img id="img1" class="lazy" data-href="img1.jpg" src="blank.jpg" /><img class="lazy" data-href="img2.jpg" src="blank.jpg" /> ')
					.append('<a class="link2">Link</a><img class="lazy" data-href="img3.jpg" src="blank.jpg" /><img class="lazy" data-href="img4.jpg" src="blank.jpg" 	/>');
			},
			tearDown : function() {
				$('.lazy').remove();
				$('.link').remove();
				$('.link2').remove();
			},

			"test All Images Loaded after a click on a link" : function () {
				$('img.lazy').asynchImageLoader({event: "click", selector : "a.link" });

				// Click on the link
				Y.one("a.link").simulate("click");

				this.wait(function() {
					Y.Assert.areEqual($('img.lazy').eq(0).attr("src"), "img1.jpg");
					Y.Assert.areEqual($('img.lazy').eq(1).attr("src"), "img2.jpg");
					Y.Assert.areEqual($('img.lazy').eq(2).attr("src"), "img3.jpg");
					Y.Assert.areEqual($('img.lazy').eq(3).attr("src"), "img4.jpg");
				}, 1);
			},

			"test Image Fades in after a click on the image placeholder" : function () {
				$('img.lazy').asynchImageLoader({event: "click", effect : "fadeIn", placeholder: "img/loader" });

				Y.one("#img1").simulate("click");

				Y.Assert.areEqual($('img.lazy').eq(0).attr("src"), "img1.jpg");
				Y.Assert.areEqual($('img.lazy').eq(1).attr("src"), "img/loader");
				Y.Assert.areEqual($('img.lazy').eq(2).attr("src"), "img/loader");
				Y.Assert.areEqual($('img.lazy').eq(3).attr("src"), "img/loader");
			},

			"test Images loaded after a click on a link and callback associated" : function () {
				Y.Assert.areEqual(value, "10");

				$('img.lazy').asynchImageLoader({event: "click", selector : "a.link", callback : function(){value=20;}});

				Y.one("a.link").simulate("click");

				this.wait(function() {
					Y.Assert.areEqual($('img.lazy').eq(0).attr("src"), "img1.jpg");
					Y.Assert.areEqual($('img.lazy').eq(1).attr("src"), "img2.jpg");
					Y.Assert.areEqual($('img.lazy').eq(2).attr("src"), "img3.jpg");
					Y.Assert.areEqual($('img.lazy').eq(3).attr("src"), "img4.jpg");

					Y.Assert.areEqual(value, "20");
				}, 1);
			}
		});

		// Test Case for images loading after mouseover on a div
		var testCaseMouseOverAsynch = new Y.Test.Case({
			name: "TestCase Images loaded after mousing over on a div",
			setUp : function() {
				$('#container').append('<div id="tool" class="tool"></div><img id="img1" class="lazy" data-href="img1.jpg" src="blank.jpg" /><img class="lazy" data-href="img2.jpg" src="blank.jpg" /> ');
				$('body').append('<div id="wrapper"><div class="container2"><a class="link2">Link</a><img class="lazy" data-href="img3.jpg" src="blank.jpg" /><img class="lazy" data-href="img4.jpg" src="blank.jpg" /></div></div>');
			},
			tearDown : function() {
				$('.tool').remove().empty();
				$('.lazy').remove().empty();
				$('.link').remove().empty();
				$('#wrapper').remove().empty();
			},

			"test All Images Loaded after a mouse over on a div" : function () {
				$('img.lazy').asynchImageLoader({event: "mouseover", selector : ".tool" });

				//Click on the link
				Y.one("#tool").simulate("mouseover");

				this.wait(function() {
					Y.Assert.areEqual($('img.lazy').eq(0).attr("src"), "img1.jpg");
					Y.Assert.areEqual($('img.lazy').eq(1).attr("src"), "img2.jpg");
					Y.Assert.areEqual($('img.lazy').eq(2).attr("src"), "img3.jpg");
					Y.Assert.areEqual($('img.lazy').eq(3).attr("src"), "img4.jpg");

					testCaseMouseOverAsynch.tearDown();
				}, 1);
			},

			"test Image loading after mousing over" : function() {
				testCaseMouseOverAsynch.setUp();

				$('img.lazy').asynchImageLoader({event: "mouseover"});

				Y.one("#img1").simulate("mouseover");

				Y.Assert.areEqual($('img.lazy').eq(0).attr("src"), "img1.jpg");
				Y.Assert.areEqual($('img.lazy').eq(1).attr("src"), "blank.jpg");
				Y.Assert.areEqual($('img.lazy').eq(2).attr("src"), "blank.jpg");
				Y.Assert.areEqual($('img.lazy').eq(3).attr("src"), "blank.jpg");

				testCaseMouseOverAsynch.tearDown();
			},

			"test Images only inside a wrapper after mousing over on a link" : function() {
				testCaseMouseOverAsynch.setUp();
				$('img.lazy').asynchImageLoader({event: "mouseover", selector : ".tool", callback : function(){value2=20;}});

				Y.one(".tool").simulate("mouseover");

				this.wait(function() {
					Y.Assert.areEqual($('.container2 img.lazy').eq(0).attr("src"), "img3.jpg");
					Y.Assert.areEqual($('.container2 img.lazy').eq(1).attr("src"), "img4.jpg");

					Y.Assert.areEqual(value2, "20");

					testCaseMouseOverAsynch.tearDown();
				}, 1);
			}
		});

	var console = new Y.Console({
		verbose: true,
		newestOnTop: false,<commit_msg>Correct assetions. Expected results come first, then actual values.<commit_after>// Create new YUI instance, and populate it with the required modules
YUI().use("node", "console", "test", "node-event-simulate", function (Y) {
 
	// Test Case for delayed images loaded
		var testCaseAsynch = new Y.Test.Case({
			name: "TestCase Images loaded after timeout",
			setUp : function() {
				$('#container')
					.append('<img class="lazy" data-href="../sample1.jpg" src="../img/blank.jpg" width="200" height="200"/> ')
					.append('<img class="lazy" data-href="../sample2.jpg" src="../img/blank.jpg" width="200" height="200" style="position:absolute; left:-1000px;"/> ')
			},
			tearDown : function() {
				$('.lazy').remove();
			},

			"test Images Loaded Asynchronously after DOM is ready" : function() {
				// Call to the method
				$('img.lazy').asynchImageLoader();

				this.wait(function(){
					Y.Assert.areEqual("../sample1.jpg", $('img.lazy').attr("src"));
					Y.Assert.isUndefined( $('img.lazy').attr('data-href'));
				}, 10);
			},

			"test Images Loaded Asynchronously with 1 seconds Delay" : function () {
				// Call to the method with timeout
				$('img.lazy').asynchImageLoader({timeout : 1000 });

				Y.Assert.areEqual("../img/blank.jpg", $('img.lazy').attr("src"));

				this.wait(function(){
					Y.Assert.areEqual("../sample1.jpg", $('img.lazy').attr("src"));
				}, 1000);
			},

			"Visible images should load immediately and hidden images on a delay" : function () {
				$('img.lazy').asynchImageLoader({ event:'load', timeout : 1000 });

				Y.Assert.areEqual( "../sample1.jpg", $('img.lazy:first').attr("src") );
				Y.Assert.areEqual( "../img/blank.jpg", $('img.lazy:last').attr("src") );

				this.wait(function(){
					Y.Assert.areEqual( "../sample2.jpg", $('img.lazy:last').attr("src") );
				}, 1001);
			}
		});
	
		// Test Case for images loading after a click
		var testCaseClickAsynch = new Y.Test.Case({
			name: "TestCase Images loaded after a click",
			setUp : function() {
				$('#container')
					.append('<a class="link">Link</a><img id="img1" class="lazy" data-href="img1.jpg" src="blank.jpg" /><img class="lazy" data-href="img2.jpg" src="blank.jpg" /> ')
					.append('<a class="link2">Link</a><img class="lazy" data-href="img3.jpg" src="blank.jpg" /><img class="lazy" data-href="img4.jpg" src="blank.jpg" 	/>');
			},
			tearDown : function() {
				$('.lazy').remove();
				$('.link').remove();
				$('.link2').remove();
			},

			"test All Images Loaded after a click on a link" : function () {
				$('img.lazy').asynchImageLoader({event: "click", selector : "a.link" });

				// Click on the link
				Y.one("a.link").simulate("click");

				this.wait(function() {
					Y.Assert.areEqual("img1.jpg", $('img.lazy').eq(0).attr("src"));
					Y.Assert.areEqual("img2.jpg", $('img.lazy').eq(1).attr("src"));
					Y.Assert.areEqual("img3.jpg", $('img.lazy').eq(2).attr("src"));
					Y.Assert.areEqual("img4.jpg", $('img.lazy').eq(3).attr("src"));
				}, 1);
			},

			"test Image Fades in after a click on the image placeholder" : function () {
				$('img.lazy').asynchImageLoader({event: "click", effect : "fadeIn", placeholder: "img/loader" });

				Y.one("#img1").simulate("click");

				Y.Assert.areEqual("img1.jpg", $('img.lazy').eq(0).attr("src"));
				Y.Assert.areEqual("img/loader", $('img.lazy').eq(1).attr("src"));
				Y.Assert.areEqual("img/loader", $('img.lazy').eq(2).attr("src"));
				Y.Assert.areEqual("img/loader", $('img.lazy').eq(3).attr("src"));
			},

			"test Images loaded after a click on a link and callback associated" : function () {
				Y.Assert.areEqual(value, "10");

				$('img.lazy').asynchImageLoader({event: "click", selector : "a.link", callback : function(){value=20;}});

				Y.one("a.link").simulate("click");

				this.wait(function() {
					Y.Assert.areEqual("img1.jpg", $('img.lazy').eq(0).attr("src"));
					Y.Assert.areEqual("img2.jpg", $('img.lazy').eq(1).attr("src"));
					Y.Assert.areEqual("img3.jpg", $('img.lazy').eq(2).attr("src"));
					Y.Assert.areEqual("img4.jpg", $('img.lazy').eq(3).attr("src"));

					Y.Assert.areEqual("20", value);
				}, 1);
			}
		});

		// Test Case for images loading after mouseover on a div
		var testCaseMouseOverAsynch = new Y.Test.Case({
			name: "TestCase Images loaded after mousing over on a div",
			setUp : function() {
				$('#container').append('<div id="tool" class="tool"></div><img id="img1" class="lazy" data-href="img1.jpg" src="blank.jpg" /><img class="lazy" data-href="img2.jpg" src="blank.jpg" /> ');
				$('body').append('<div id="wrapper"><div class="container2"><a class="link2">Link</a><img class="lazy" data-href="img3.jpg" src="blank.jpg" /><img class="lazy" data-href="img4.jpg" src="blank.jpg" /></div></div>');
			},
			tearDown : function() {
				$('.tool').remove().empty();
				$('.lazy').remove().empty();
				$('.link').remove().empty();
				$('#wrapper').remove().empty();
			},

			"test All Images Loaded after a mouse over on a div" : function () {
				$('img.lazy').asynchImageLoader({event: "mouseover", selector : ".tool" });

				//Click on the link
				Y.one("#tool").simulate("mouseover");

				this.wait(function() {
					Y.Assert.areEqual("img1.jpg", $('img.lazy').eq(0).attr("src"));
					Y.Assert.areEqual("img2.jpg", $('img.lazy').eq(1).attr("src"));
					Y.Assert.areEqual("img3.jpg", $('img.lazy').eq(2).attr("src"));
					Y.Assert.areEqual("img4.jpg", $('img.lazy').eq(3).attr("src"));

					testCaseMouseOverAsynch.tearDown();
				}, 1);
			},

			"test Image loading after mousing over" : function() {
				testCaseMouseOverAsynch.setUp();

				$('img.lazy').asynchImageLoader({event: "mouseover"});

				Y.one("#img1").simulate("mouseover");

				Y.Assert.areEqual("img1.jpg", $('img.lazy').eq(0).attr("src"));
				Y.Assert.areEqual("blank.jpg", $('img.lazy').eq(1).attr("src"));
				Y.Assert.areEqual("blank.jpg", $('img.lazy').eq(2).attr("src"));
				Y.Assert.areEqual("blank.jpg", $('img.lazy').eq(3).attr("src"));

				testCaseMouseOverAsynch.tearDown();
			},

			"test Images only inside a wrapper after mousing over on a link" : function() {
				testCaseMouseOverAsynch.setUp();
				$('img.lazy').asynchImageLoader({event: "mouseover", selector : ".tool", callback : function(){value2=20;}});

				Y.one(".tool").simulate("mouseover");

				this.wait(function() {
					Y.Assert.areEqual("img3.jpg", $('.container2 img.lazy').eq(0).attr("src"));
					Y.Assert.areEqual("img4.jpg", $('.container2 img.lazy').eq(1).attr("src"));

					Y.Assert.areEqual("20", value2);

					testCaseMouseOverAsynch.tearDown();
				}, 1);
			}
		});

	var console = new Y.Console({
		verbose: true,
		newestOnTop: false,
{'fraction_non_alphanumeric': 0.24083258190562068, 'fraction_numerical': 0.016982266305981365, 'mean_word_length': 3.7515173152445556, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, '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': '7005127', 'n_tokens_mistral': 5521, 'n_tokens_neox': 4606, 'n_words': 823}