-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Javascript not quite working through the template.
- Loading branch information
tfarrell-vz
committed
Oct 20, 2014
1 parent
1fe5ddb
commit 8116a17
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/*global $ */ | ||
|
||
var initialize = function (navigator) { | ||
$('#id_login').on('click', function() { | ||
navigator.id.request(); | ||
}); | ||
}; | ||
|
||
window.Superlists = { | ||
Accounts: { | ||
initialize: initialize | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Javascript tests</title> | ||
<link rel="stylesheet" href="../../../superlists/static/tests/qunit.css"> | ||
</head> | ||
|
||
<body> | ||
<div id="qunit"></div> | ||
<div id="qunit-fixture"> | ||
<a id="id_login">Sign in</a> | ||
</div> | ||
|
||
<script src="http://code.jquery.com/jquery.min.js"></script> | ||
<script src="../../../superlists/static/tests/qunit.js"></script> | ||
<script src="../accounts.js"></script> | ||
<script> | ||
/*global $, test, equal, sinon, Superlists */ | ||
|
||
test("initialize binds sign in button to navigator.id.request", function() { | ||
var requestWasCalled = false; | ||
var mockRequestFunction = function() { requestWasCalled = true; }; | ||
var mockNavigator = { | ||
id: { | ||
request: mockRequestFunction | ||
} | ||
}; | ||
|
||
Superlists.Accounts.initialize(mockNavigator); | ||
equal(requestWasCalled, false, 'check request not called before click'); | ||
$('#id_login').trigger('click'); | ||
equal(requestWasCalled, true, 'check request called after click'); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters