Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions 25 test/test_hashchange.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
QUnit.asyncTest('update window.location.hash', function(assert) {
var onhashchange = null,
wait_time = 14; // a reasonable wait time

expect(1);

// first reset hash in case we are re-running test
// this can be removed without affecting test results
// as long as you load the page fresh
window.location.hash = '';

setTimeout(function() {
window.addEventListener('hashchange', function(e) {
onhashchange = e;
}, false);

window.location.hash = "#/path";

// allow onhashchange to fire
setTimeout(function() {
assert.ok(onhashchange != null, "hashchange event was not fired!");
QUnit.start();
}, wait_time);
}, wait_time);
});
15 changes: 15 additions & 0 deletions 15 test/test_hashchange_html5.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit Example</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.14.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="http://code.jquery.com/qunit/qunit-1.14.0.js"></script>
<script src="../history.js"></script>
<script src="test_hashchange.js"></script>
</body>
</html>
14 changes: 14 additions & 0 deletions 14 test/test_hashchange_nohtml5.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit Example</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.14.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="http://code.jquery.com/qunit/qunit-1.14.0.js"></script>
<script src="test_hashchange.js"></script>
</body>
</html>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.