Sha256: 08b434520156aa7d097623cd2a53e5614d141f00af262162fdcac9260cb87b3d
Contents?: true
Size: 911 Bytes
Versions: 4
Compression:
Stored size: 911 Bytes
Contents
// Copyright 2012 Twitter, Inc // http://www.apache.org/licenses/LICENSE-2.0 var TwitterCldr = require('../../../lib/assets/javascripts/twitter_cldr/core.js'); var data = require('../../../lib/assets/javascripts/twitter_cldr/en.js'); describe("PercentFormatter", function() { var formatter; beforeEach(function() { TwitterCldr.set_data(data); formatter = new TwitterCldr.PercentFormatter(); }); it("should format the number correctly", function() { expect(formatter.format(12)).toEqual("12%"); }); it("should format negative numbers correctly", function() { expect(formatter.format(-12)).toEqual("-12%"); }); it("should respect the precision option", function() { expect(formatter.format(-12, {precision: 3})).toEqual("-12.000%"); }); it("should allow a precision of zero", function() { expect(formatter.format(12.3, {precision: 0})).toEqual("12%"); }); });
Version data entries
4 entries across 4 versions & 1 rubygems