Sha256: ec88ab3daacd29c45654a532740c2b4d0e38d2034dda4bdeebff927309fb8be0
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
// Copyright 2012 Twitter, Inc // http://www.apache.org/licenses/LICENSE-2.0 //= require '../../../build/twitter_cldr_en.js' describe("CurrencyFormatter", function() { describe("#format", function() { beforeEach(function() { formatter = new TwitterCldr.CurrencyFormatter(); }); it("should use a dollar sign when no other currency symbol is given (and default to a precision of 2)", function() { expect(formatter.format(12)).toEqual("$12.00"); }); it("handles negative numbers", function() { // yes, the parentheses really are part of the format, don't worry about it expect(formatter.format(-12)).toEqual("-($12.00)"); }); it("should use the specified currency symbol when specified", function() { // S/. is the symbol for the Peruvian Nuevo Sol, just in case you were curious expect(formatter.format(12, {currency: "S/."})).toEqual("S/.12.00"); }); it("should use the currency symbol for the corresponding currency code", function() { expect(formatter.format(12, {currency: "PEN"})).toEqual("S/.12.00"); }); it("overrides the default precision", function() { expect(formatter.format(12, {precision: 3})).toEqual("$12.000"); }); }); });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twitter_cldr-1.8.0 | js/spec/js/numbers/currency_spec.js |
twitter_cldr-1.7.0 | js/spec/js/numbers/currency_spec.js |