Skip to content

Commit

Permalink
Added in tests for the missing key callback
Browse files Browse the repository at this point in the history
  • Loading branch information
jMort committed Oct 26, 2012
1 parent 64d267f commit 2a09fd4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/tests.js
Expand Up @@ -93,6 +93,25 @@
it("should just pass through translations that are empty strings", function () {
expect( _('zero length translation') ).to.be('zero length translation' );
});

it("should call the callback function (if given) when a key is missing", function() {
var callbackCalled;
function missingKeyCallback(key) {
callbackCalled = true;
}

callbackCalled = false;
var jedWithCallback = new Jed({
"missing_key_callback" : missingKeyCallback
});
jedWithCallback.gettext('missing key');
expect(callbackCalled).to.be(true);

callbackCalled = false;
var jedWithoutCallback = new Jed({});
jedWithoutCallback.gettext('missing key');
expect(callbackCalled).to.be(false);
});
});
})();

Expand Down

0 comments on commit 2a09fd4

Please sign in to comment.