(function($) {

Echo.Tests.module("Compatibility tests");

	var suite = Echo.Tests.Unit.compatibilityTest = function() {};

	suite.prototype.info = {
		"suiteName": "Compatibility tests"
	};

	suite.prototype.tests = {};

Echo.Tests.asyncTest("jQuery no conflict", function() {
	var testVersion = "1.4.1";
	QUnit.ok(!(window.$ || window.jQuery), "jQuery is not defined globally");

	Echo.Loader.download([{"url": "https://cdnjs.cloudflare.com/ajax/libs/jquery/" + testVersion + "/jquery.min.js"}], function () {
		QUnit.strictEqual(window.$.fn.jquery, testVersion, "Downloaded jQuery has the expected version");
		QUnit.notEqual(window.$.fn.jquery, $.fn.jquery, "Echo jQuery instance wasn't overridden after another jQuery version inclusion on the page");

		Echo.Loader.download([{"url": "third-party/jquery.pack.js"}], function () {
			QUnit.strictEqual(window.$.fn.jquery, testVersion, "External jQuery instance has the expected version after Echo jQuery inclusion");
			QUnit.notEqual(window.$.fn.jquery, $.fn.jquery, "Echo jQuery and external jQuery instances have different versions");
			window.jQuery.noConflict(true);
			QUnit.ok(!(window.$ || window.jQuery), "jQuery is not defined globally after noConflict() call");
			QUnit.start();
		});
	});
}, {
	"timeout": 6000
});

Echo.Tests.asyncTest("v2 and v3 no conflict", function() {
	var compareWithV2Scripts = Echo.Tests.isolate(function(callback) {
		var win = this;
		var script = win.document.createElement("script");
		$(script)
			.on("load", function() {
				$(this).off("load");
				var EchoV2 = win.Echo;
				var EchoV3 = window.Echo;
				var inV2 = $.map(EchoV3, function(v, k) {
					return EchoV2[k];
				});
				QUnit.equal(inV2.length, 0, "Neither of Echo V3 keys match with Echo V2 keys");
				callback();
			})
			.appendTo(win.document.body);
		// $(script).attr("src", ..) doesn't work for some reason so let's do it directly
		script.src = "http://cdn.echoenabled.com/clientapps/v2/packs/full-pack.js";
	});
	compareWithV2Scripts(function() {
		QUnit.start();
	});
});

Echo.Tests.asyncTest("yepnope no conflict", function() {
	var origYepnope = window.yepnope;
	QUnit.ok(!!Echo.yepnope, "Echo yepnope is loaded");

	Echo.Loader.download([{"url": "https://cdnjs.cloudflare.com/ajax/libs/yepnope/1.5.4/yepnope.min.js"}], function () {
		var externalYepnope = window.yepnope;
		QUnit.ok(!!window.yepnope, "External yepnope is loaded");
		QUnit.notDeepEqual(window.yepnope, Echo.yepnope,
			"External yepnope and Echo yepnope are different objects");

		Echo.Loader.download([{"url": "loader.js"}], function () {
			QUnit.deepEqual(window.yepnope, externalYepnope,
				"External yepnope is not overridden after Echo yepnope is loaded");
			window.yepnope = origYepnope;
			QUnit.start();
		});
	});
}, {
	"timeout": 6000
});

})(Echo.jQuery);

@@ -56,171 +56,8 @@
 );%0A%0A
-%09var suite = Echo.Tests.Unit.compatibilityTest = function() %7B%7D;%0A%0A%09suite.prototype.info = %7B%0A%09%09%22suiteName%22: %22Compatibility tests%22%0A%09%7D;%0A%0A%09suite.prototype.tests = %7B%7D;%0A%0A
 Echo

Remove obsolete code