Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added in tests for the missing key callback

  • Loading branch information...
commit 2a09fd40d3790e340937f47db5451a5acea6d24c 1 parent 64d267f
@jMort jMort authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 test/tests.js
View
19 test/tests.js
@@ -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);
+ });
});
})();
Please sign in to comment.
Something went wrong with that request. Please try again.