Permalink
Browse files

Renamed static/js/issuer-frame dir to badge-accept, and corresponding…

… tests
  • Loading branch information...
1 parent f4599f8 commit 674dc9a9582a92970312b8e9da0832100b882876 @stenington stenington committed Aug 29, 2012
View
@@ -18,4 +18,4 @@ before_script:
script:
- npm test
- phantomjs static/test/phantom-qunit.js http://localhost:8888/test/
- - phantomjs static/test/phantom-qunit.js http://localhost:8888/test/issuer-frame/
+ - phantomjs static/test/phantom-qunit.js http://localhost:8888/test/badge-accept/
@@ -2,7 +2,7 @@
*
* When issuer frame is loaded in an iframe, this
* builds the child-side channel to bind OpenBadges.issue()
- * to the issue() defined in issuer-frame/main.js.
+ * to the issue() defined in main.js.
*/
function buildChannel() {
if (window.parent === window)
@@ -55,7 +55,7 @@ var Session = function Session(spec) {
Session.trigger("login-complete");
});
login.fail(function(data) {
- if (data.userAbort)
+ if (data.userAbort)
Session.trigger("login-abort");
else
Session.trigger("login-error");
@@ -85,7 +85,7 @@ var Session = function Session(spec) {
/* Badge - represents a badge in the acceptance workflow
* Takes an assertion url
* Optionally takes build and issue methods in a spec object
- * These should return Deferreds (or plain objects, which count
+ * These should return Deferreds (or plain objects, which count
* as a resolved Deferred)
* `build` attempts to build a full badge out of the assertion url
* `issue` attempts to issue the badge
@@ -111,7 +111,7 @@ var Badge = function Badge(assertionUrl, spec) {
this.assertionUrl = assertionUrl;
- /* If the badge is rejected, error contains the url, reason,
+ /* If the badge is rejected, error contains the url, reason,
and any additional data for the failure. */
this.fail(function(reason, data) {
this.error = _.extend({url: assertionUrl, reason: reason}, data);
@@ -233,7 +233,7 @@ var App = function App(assertionUrls, spec) {
return build;
};
- /* Default issue implementation is the "real" one used by
+ /* Default issue implementation is the "real" one used by
the issuer frame. */
var issue = spec.issue || function(assertionUrl) {
var issue = jQuery.Deferred();
@@ -268,7 +268,7 @@ var App = function App(assertionUrls, spec) {
issue: issue
});
- /* Pass along badge state changes, as well as
+ /* Pass along badge state changes, as well as
calling out failures. */
b.on('state-change', function(to) {
if (to === 'failed') {
@@ -281,7 +281,7 @@ var App = function App(assertionUrls, spec) {
});
var App = {
-
+
/* Begins processing all the badges and emitting events. */
start: function() {
if (assertionUrls.length === 0) {
@@ -308,36 +308,36 @@ var App = function App(assertionUrls, spec) {
/* Helper to get all badges in given states. */
function getAllIn() {
var states = Array.prototype.slice.apply(arguments);
- var results = _.filter(badges, function(badge) {
- return badge.inState.apply(badge, states);
+ var results = _.filter(badges, function(badge) {
+ return badge.inState.apply(badge, states);
});
return results;
}
/* Checks for notification that all badges have built or failed. */
function checkAllBuilt() {
- var building = _.find(badges, function(badge) {
- return badge.inState('pendingBuild');
+ var building = _.find(badges, function(badge) {
+ return badge.inState('pendingBuild');
});
if (!building) {
- var built = _.filter(badges, function(badge) {
- return badge.inState('built');
+ var built = _.filter(badges, function(badge) {
+ return badge.inState('built');
});
var failures = getAllIn('failed');
App.off('state-change', checkAllBuilt);
App.trigger('badges-ready', failures, built);
}
}
- /* Checks for notification that all badges have been issued,
+ /* Checks for notification that all badges have been issued,
rejected or failed. */
function checkAllIssued() {
- var nonFinal = _.find(badges, function(badge) {
- return !badge.inState('issued', 'failed', 'complete');
+ var nonFinal = _.find(badges, function(badge) {
+ return !badge.inState('issued', 'failed', 'complete');
});
if (!nonFinal) {
- var issuedCount = _.reduce(badges, function(memo, badge) {
- return badge.inState('issued', 'complete') ? memo + 1 : memo;
+ var issuedCount = _.reduce(badges, function(memo, badge) {
+ return badge.inState('issued', 'complete') ? memo + 1 : memo;
}, 0);
App.trigger('badges-issued', issuedCount);
}
@@ -349,8 +349,8 @@ var App = function App(assertionUrls, spec) {
if (complete)
return;
- var pending = _.find(badges, function(badge) {
- return !badge.inState('failed', 'complete');
+ var pending = _.find(badges, function(badge) {
+ return !badge.inState('failed', 'complete');
});
if(!pending) {
complete = true;
File renamed without changes.
@@ -14,5 +14,5 @@ <h2 id="qunit-userAgent"></h2>
<script src="../../js/jquery.min.js"></script>
<script src="../../js/underscore-min.js"></script>
<script src="../../js/backbone-min.js"></script>
-<script src="../../js/issuer-frame/issuer-frame.js"></script>
+<script src="../../js/badge-accept/issuer-frame.js"></script>
<script src="component-tests.js"></script>
@@ -351,7 +351,7 @@ function succeed(){
return {};
}
-/* Returns a method that will simulate build or issue failure on
+/* Returns a method that will simulate build or issue failure on
a single assertion url.
*/
function failOne(url, reason){
@@ -14,5 +14,5 @@ <h2 id="qunit-userAgent"></h2>
<script src="../../js/jquery.min.js"></script>
<script src="../../js/underscore-min.js"></script>
<script src="../../js/backbone-min.js"></script>
-<script src="../../js/issuer-frame/issuer-frame.js"></script>
+<script src="../../js/badge-accept/issuer-frame.js"></script>
<script src="functional-tests.js"></script>
@@ -181,7 +181,7 @@ asyncTest('Test', function(){
var app = App(ASSERTION_URLS);
app.on('badges-ready', function(failed, ready){
- deepEqual(_.map(failed, function(badge){ return badge.assertionUrl; }),
+ deepEqual(_.map(failed, function(badge){ return badge.assertionUrl; }),
[
'http://foo.org/nonexistent.json',
'http://bar.org/oldbadge.json',
@@ -219,15 +219,15 @@ asyncTest('Test', function(){
app.on('badges-complete', function(failed, successes, total){
equal(total, ASSERTION_URLS.length, 'all badges complete');
- deepEqual(_.map(failed, function(badge){ return badge.assertionUrl; }),
+ deepEqual(_.map(failed, function(badge){ return badge.assertionUrl; }),
[
'http://foo.org/nonexistent.json',
'http://bar.org/oldbadge.json',
'http://foo.org/notowner.json',
'http://foo.org/explodeonissue.json'
], 'expected failures'
);
- deepEqual(_.map(successes, function(badge){ return badge.assertionUrl; }),
+ deepEqual(_.map(successes, function(badge){ return badge.assertionUrl; }),
[
'http://foo.org/newbadge.json',
'http://foo.org/another_newbadge.json'
@@ -14,6 +14,6 @@ <h2 id="qunit-userAgent"></h2>
<script src="../../js/jquery.min.js"></script>
<script src="../../js/underscore-min.js"></script>
<script src="../../js/backbone-min.js"></script>
-<script src="../../js/issuer-frame/issuer-frame.js"></script>
+<script src="../../js/badge-accept/issuer-frame.js"></script>
<script src="component-tests.js"></script>
<script src="functional-tests.js"></script>
@@ -129,10 +129,10 @@
<script src="/js/jschannel.js"></script>
<script src="/js/underscore.js"></script>
<script src="/js/backbone.js"></script>
-<script src="/js/issuer-frame/issuer-frame.js"></script>
-<script src="/js/issuer-frame/main.js"></script>
+<script src="/js/badge-accept/issuer-frame.js"></script>
+<script src="/js/badge-accept/main.js"></script>
{{#framed}}
- <script src="/js/issuer-frame/build-channel.js"></script>
+ <script src="/js/badge-accept/build-channel.js"></script>
<script>
$(window).ready(function(){
var channel = buildChannel();

0 comments on commit 674dc9a

Please sign in to comment.