Sha256: b2286ad1378541fa63658ce93b1f3a9d49f3bad3a894780b556a0c4d4a700d3d

Contents?: true

Size: 861 Bytes

Versions: 3

Compression:

Stored size: 861 Bytes

Contents

// Copyright 2012 Twitter, Inc
// http://www.apache.org/licenses/LICENSE-2.0

var TwitterCldr = require('../../../lib/assets/javascripts/twitter_cldr/en.js');

describe("DecimalFormatter", function() {
  beforeEach(function() {
    formatter = new TwitterCldr.DecimalFormatter();
  });

  describe("#format", function() {
    it("should format positive decimals correctly", function() {
      expect(formatter.format(12.1)).toEqual("12.1");
    });

    it("should format negative decimals correctly", function() {
      expect(formatter.format(-12.1)).toEqual("-12.1");
    });

    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

3 entries across 3 versions & 1 rubygems

Version Path
twitter_cldr_js-2.4.0 spec/js/numbers/decimal.spec.js
twitter_cldr_js-2.3.2 spec/js/numbers/decimal.spec.js
twitter_cldr_js-2.3.1 spec/js/numbers/decimal.spec.js