Sha256: 3a56f1b2350ef9931e3892c4e249337d204f1ffaac48bb411517edeb774b7a5b

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 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("PercentFormatter", function() {
  beforeEach(function() {
    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

3 entries across 3 versions & 1 rubygems

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