<commit_before><!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width">
	<title>fullcalendar-rightclick.js qUnit test</title>
	<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.9.1.css">
	<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.js'></script>
	<script src='https://code.jquery.com/jquery-2.1.3.js'></script>
	<link href='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.css' rel='stylesheet' />
</head>
<body>
	<div id="qunit"></div>
	<div id="qunit-fixture"></div>
	<script src="https://code.jquery.com/qunit/qunit-2.9.1.js"></script>
</body>
</html>

<script>
	var versions = [
		'3.10.0',
		'3.9.0',
		'3.8.2',
		'3.8.1',
		'3.8.0',
		'3.7.0',
		'3.6.2',
		'3.6.1',
		'3.6.0',
		'3.5.1',
		'3.5.0',
		'3.4.0',
		'3.3.1',
		'3.3.0',
		'3.2.0',
		'3.1.0',
		'3.0.1',
		'3.0.0',
		'2.9.1',
		'2.9.0',
		'2.8.0',
		'2.7.3',
		'2.7.2',
		'2.7.1',
		'2.7.0',
		'2.6.1',
		'2.6.0',
		'2.5.0',
		'2.4.0',
		'2.3.2',
		'2.3.1',
		'2.3.0',
	];

	function loadScript(filename) {
		return new Promise(function (resolve, reject) {
			var script = document.createElement('script');
			script.type = 'text/javascript';
			script.onload = resolve;
			script.onerror = reject;
			script.src = filename;
			document.getElementsByTagName("head")[0].appendChild(script);
		});
	}

	function setVersion(version) {
		delete window.FullCalendar;
		delete jQuery.fullCalendar;

		return loadScript("https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/" + version + "/fullcalendar.js");
	}


	function simulateRightClickEvent(el) {
		var ev = jQuery.Event("contextmenu");
		el.find(".fc-event").trigger(ev);
	}

	function simulateRightClickDay(el, x, y) {
		var ev = jQuery.Event("contextmenu");
		if (x && y) {
			// qUnit fixture is located 10000 px off screen in X and Y coordinates
			ev.pageX = x - 10000;
			ev.pageY = y - 10000;
		}
		el.find(".fc-day").trigger(ev);
	}

	versions.forEach(function(version) {
		var ctx = {
			dayRightclick: null,
			eventRightclick: null,
			month: null,
			week: null,
			day: null,
		}

		function newCalendar(view) {
			var el = $('#qunit-fixture').append('<div></div>');
			el.fullCalendar({
				dayRightclick: function(date, jsEvent, view) {
					ctx.dayRightclick(date, jsEvent, view);
					return false;
				},
				eventRightclick: function(event, jsEvent, view) {
					ctx.eventRightclick(event, jsEvent, view);
					return false;
				},
				defaultDate: '2015-02-01',
				defaultView: view,
				editable: true,
				eventLimit: true,
				events: [
					{
						title: 'All Day Event',
						start: '2015-02-01'
					},
				],
			})
			return el;
		}

		QUnit.module('FullCalendar version: ' + version, {
			before: function() {
				return setVersion(version).then(function() {
					return loadScript("fullcalendar-rightclick.js");
				});
			},
			beforeEach: function() {
				ctx.eventRightclick = ctx.dayRightclick = function(date, jsEvent, view) {
					throw new Error("Event not intercepted");
				}
			}
		}, function() {
			QUnit.test('loads', function(assert) {
				let v = version;
				// For whatever reason, it looks like FullCalendar
				// didn't run the templater for these versions,
				// so the release has the tag instead of the version.
				if (v === '2.9.1') {
					v = '<%= meta.version %>';
				} if (v === '3.7.0') {
					v = '<%= version %>';
				}
				assert.equal(jQuery.fullCalendar.version, v);
			});
			[ 'month', 'basicWeek', 'basicDay', 'agendaWeek', 'agendaDay' ].forEach(function(view) {
				QUnit.test('right-click on day in ' + view + ' view', function(assert) {
					var done = assert.async();
					ctx.dayRightclick = function(date) {
						assert.ok(moment.isMoment(date), 'receives the date')
						done();
					}
					// 235x360 is a location on the calendar that's not on an event.
					simulateRightClickDay(newCalendar(view), 235, 360);
				})
				QUnit.test('right-click on event in ' + view + ' view', function(assert) {
					var done = assert.async();
					ctx.eventRightclick = function(event) {
						assert.equal(typeof event, 'object', 'receives the event object');
						assert.equal(typeof event.title, 'string', 'event object has title');
						done();
					}
					simulateRightClickEvent(newCalendar(view));
				})
			})
		});
	});
</script>
<style>
/** /
#qunit-fixture {
	position: unset;
}
/** */

</style><commit_msg>Remove dead code<commit_after><!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width">
	<title>fullcalendar-rightclick.js qUnit test</title>
	<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.9.1.css">
	<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.js'></script>
	<script src='https://code.jquery.com/jquery-2.1.3.js'></script>
	<link href='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.css' rel='stylesheet' />
</head>
<body>
	<div id="qunit"></div>
	<div id="qunit-fixture"></div>
	<script src="https://code.jquery.com/qunit/qunit-2.9.1.js"></script>
</body>
</html>

<script>
	var versions = [
		'3.10.0',
		'3.9.0',
		'3.8.2',
		'3.8.1',
		'3.8.0',
		'3.7.0',
		'3.6.2',
		'3.6.1',
		'3.6.0',
		'3.5.1',
		'3.5.0',
		'3.4.0',
		'3.3.1',
		'3.3.0',
		'3.2.0',
		'3.1.0',
		'3.0.1',
		'3.0.0',
		'2.9.1',
		'2.9.0',
		'2.8.0',
		'2.7.3',
		'2.7.2',
		'2.7.1',
		'2.7.0',
		'2.6.1',
		'2.6.0',
		'2.5.0',
		'2.4.0',
		'2.3.2',
		'2.3.1',
		'2.3.0',
	];

	function loadScript(filename) {
		return new Promise(function (resolve, reject) {
			var script = document.createElement('script');
			script.type = 'text/javascript';
			script.onload = resolve;
			script.onerror = reject;
			script.src = filename;
			document.getElementsByTagName("head")[0].appendChild(script);
		});
	}

	function setVersion(version) {
		delete window.FullCalendar;
		delete jQuery.fullCalendar;

		return loadScript("https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/" + version + "/fullcalendar.js");
	}


	function simulateRightClickEvent(el) {
		var ev = jQuery.Event("contextmenu");
		el.find(".fc-event").trigger(ev);
	}

	function simulateRightClickDay(el, x, y) {
		var ev = jQuery.Event("contextmenu");
		if (x && y) {
			// qUnit fixture is located 10000 px off screen in X and Y coordinates
			ev.pageX = x - 10000;
			ev.pageY = y - 10000;
		}
		el.find(".fc-day").trigger(ev);
	}

	versions.forEach(function(version) {
		var ctx = {
			dayRightclick: null,
			eventRightclick: null,
			month: null,
			week: null,
			day: null,
		}

		function newCalendar(view) {
			var el = $('#qunit-fixture').append('<div></div>');
			el.fullCalendar({
				dayRightclick: function(date, jsEvent, view) {
					ctx.dayRightclick(date, jsEvent, view);
					return false;
				},
				eventRightclick: function(event, jsEvent, view) {
					ctx.eventRightclick(event, jsEvent, view);
					return false;
				},
				defaultDate: '2015-02-01',
				defaultView: view,
				editable: true,
				eventLimit: true,
				events: [
					{
						title: 'All Day Event',
						start: '2015-02-01'
					},
				],
			})
			return el;
		}

		QUnit.module('FullCalendar version: ' + version, {
			before: function() {
				return setVersion(version).then(function() {
					return loadScript("fullcalendar-rightclick.js");
				});
			},
			beforeEach: function() {
				ctx.eventRightclick = ctx.dayRightclick = function(date, jsEvent, view) {
					throw new Error("Event not intercepted");
				}
			}
		}, function() {
			QUnit.test('loads', function(assert) {
				let v = version;
				// For whatever reason, it looks like FullCalendar
				// didn't run the templater for these versions,
				// so the release has the tag instead of the version.
				if (v === '2.9.1') {
					v = '<%= meta.version %>';
				} if (v === '3.7.0') {
					v = '<%= version %>';
				}
				assert.equal(jQuery.fullCalendar.version, v);
			});
			[ 'month', 'basicWeek', 'basicDay', 'agendaWeek', 'agendaDay' ].forEach(function(view) {
				QUnit.test('right-click on day in ' + view + ' view', function(assert) {
					var done = assert.async();
					ctx.dayRightclick = function(date) {
						assert.ok(moment.isMoment(date), 'receives the date')
						done();
					}
					// 235x360 is a location on the calendar that's not on an event.
					simulateRightClickDay(newCalendar(view), 235, 360);
				})
				QUnit.test('right-click on event in ' + view + ' view', function(assert) {
					var done = assert.async();
					ctx.eventRightclick = function(event) {
						assert.equal(typeof event, 'object', 'receives the event object');
						assert.equal(typeof event.title, 'string', 'event object has title');
						done();
					}
					simulateRightClickEvent(newCalendar(view));
				})
			})
		});
	});
</script>
{'fraction_non_alphanumeric': 0.19123505976095617, 'fraction_numerical': 0.03710870802504269, 'mean_word_length': 2.982774252039891, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 63, 'https://': 12, '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': '1810089', 'n_tokens_mistral': 3983, 'n_tokens_neox': 3275, 'n_words': 638}