/*
// require jqueryRequire.js
*/

console.log("This test must be run under web server. Script is referencing as 'http://localhost/JsMagic/require/modules/hello.js'");

var host = 'http://' + window.location.host,
	path = host + '/JsMagic/require/modules/';
	
describe("jqueryRequire test", function() {

	it("should be a function", function() {
		expect(typeof require).toBe("function");
	});
	
	it("should load script synchronously", function() {
		var myModule = require(path + 'hello.js');
		expect(typeof myModule).toBe("object");
		expect(typeof myModule.init).toBe("function");
	});
	
});

describe("Test asynchronous loading", function() {
	var sayNameFn,
		excuted;
	// Asynchronous test
	beforeEach(function(done) {
		var helloModule = require(path + 'sayName.js', function(sayName) {
			excuted = true;
			sayNameFn = sayName;
			done();
		});
	});
	
	it("should load script Asynchronously", function(done) {
		expect(excuted).toBe(true);
		expect(typeof sayNameFn).toBe("function");
		done();
	});
	
	it("should not has $r_cache cached in winodw", function() {
		expect(window.$r_cache).toBeUndefined();
	});
});


		
// doesn't work as expect when loading cross domain script
describe("Test asynchronous loading cross domain script", function() {
	var excuted,
		moduleA;
	var s = $('<script type="text" src="http://bizcreative.com.au/js/moduleA.js" async></script>');
	$("head").append(s);
	/*
	// Asynchronous test
	beforeEach(function(done) {
		var externalModule = require('http://bizcreative.com.au/js/moduleA.js', function(moduleA) {
			excuted = true;
			moduleA = moduleA;
			done();
		});
	});
	
	it("should load script moduleA Asynchronously", function(done) {
		expect(excuted).toBe(true);
		expect(typeof moduleA).toBe("object");
		done();
	});
	
	it("moduleA.getModuleName should be a function", function() {
		expect(typeof moduleA.getModuleName).toBe("function");
		done();
	});
	
	it("call moduleA.getModuleName should return 'This is Module A'", function() {
		var moduleName = moduleA.getModuleName();
		expect(moduleName).toMatch("This is Module A");
		done();
	});
	*/
});


/*
describe("Test asynchronous loading list of modules", function() {
	var moduleA,
		moduleB;
	// Asynchronous test
	beforeEach(function(done) {
		var finalModule = require([path + 'moduleA.js', path + 'moduleB.js'], function(a, b) {
			moduleA = a;
			moduleB = b;
			done();
		});
	});

});
*/
@@ -1124,989 +1124,8 @@
 ;%0A%0A%0A
-%09%09%0A// doesn't work as expect when loading cross domain script%0Adescribe(%22Test asynchronous loading cross domain script%22, function() %7B%0A%09var excuted,%0A%09%09moduleA;%0A%09var s = $('%3Cscript type=%22text%22 src=%22http://bizcreative.com.au/js/moduleA.js%22 async%3E%3C/script%3E');%0A%09$(%22head%22).append(s);%0A%09/*%0A%09// Asynchronous test%0A%09beforeEach(function(done) %7B%0A%09%09var externalModule = require('http://bizcreative.com.au/js/moduleA.js', function(moduleA) %7B%0A%09%09%09excuted = true;%0A%09%09%09moduleA = moduleA;%0A%09%09%09done();%0A%09%09%7D);%0A%09%7D);%0A%09%0A%09it(%22should load script moduleA Asynchronously%22, function(done) %7B%0A%09%09expect(excuted).toBe(true);%0A%09%09expect(typeof moduleA).toBe(%22object%22);%0A%09%09done();%0A%09%7D);%0A%09%0A%09it(%22moduleA.getModuleName should be a function%22, function() %7B%0A%09%09expect(typeof moduleA.getModuleName).toBe(%22function%22);%0A%09%09done();%0A%09%7D);%0A%09%0A%09it(%22call moduleA.getModuleName should return 'This is Module A'%22, function() %7B%0A%09%09var moduleName = moduleA.getModuleName();%0A%09%09expect(moduleName).toMatch(%22This is Module A%22);%0A%09%09done();%0A%09%7D);%0A%09*/%0A%7D);%0A%0A%0A
 /*%0Ad

remove comment