Idea is to have a web page which takes time to load, but also to have timer which will be executed if loading page is stuck somewhere. Code which I am going to present is not the best one, of course, but point is just to show an example.

First we need web site which we will test, since code is small I will not present every file, just main JS which I am gonna test:

(function(ns) {
	
	function MyLoadFile() {
		var isLoadingStarted,
			contentURI = 'http://localhost/jasmineClock/file.html',
			loadingTimeOutHandle;
			
		function startLoading() {
			isLoadingStarted = true;

			setTimeout(function () {
				$( "#myWebSite" ).append( "<p>setTimeout</p>" );
				isLoadingStarted = false;
			}, 15000);
			
			$.get( contentURI, function (data) {
				isLoadingStarted = false;	
				$( "#myWebSite" ).append( data );
			});
		}
		
		function getIsLoadingStarted() {
			return isLoadingStarted;
		}
		
		return {
			isLoadingStarted: getIsLoadingStarted,
			startLoading: startLoading
		}
	}

	ns.MyLoadFile = MyLoadFile;
}(window.loadFile))

Here notice method:

function getIsLoadingStarted() {
  return isLoadingStarted;
}

I've completely forgot that variable "isLoadingStarted" cannot be seen "outside", instead you need "get" method ("getters" and "setters" in .NET world)

Now Jasmine test:

describe("when web site is loading", function() {
	var sut;
	
	beforeEach(function() {
		sut = new window.loadFile.MyLoadFile();
		jasmine.clock().install();
		sut.startLoading();

		jasmine.clock().tick(15000);
	});
	
	afterEach(function() {
		jasmine.clock().uninstall();
	});
	
	it("isLoadingStarted should be false", function() {
		expect(sut.isLoadingStarted()).toBe(false);
	});
});

Here first notice install and uninstall clock, and then tick. If you try to debug, you will see that Jasmine test will go directly to setTimeOut part of startLoading method, even though loading files is still going on, exactly how and why at this moment I don't know.

Jasmine test example you can see here, code which I am testing is here (you have to wait 15 sec to see text "setTimeout"), and whole example download from here.