Sha256: 92e9e411078bc91c62d977467f2e679ec45ce175cc450e1592485359651fcf28

Contents?: true

Size: 1.29 KB

Versions: 5

Compression:

Stored size: 1.29 KB

Contents

describe '#commas', ->

  it 'should insert commas into long numbers', ->
    # zero
    Morris.commas(0).should.equal("0")

    # positive integers
    Morris.commas(1).should.equal("1")
    Morris.commas(12).should.equal("12")
    Morris.commas(123).should.equal("123")
    Morris.commas(1234).should.equal("1,234")
    Morris.commas(12345).should.equal("12,345")
    Morris.commas(123456).should.equal("123,456")
    Morris.commas(1234567).should.equal("1,234,567")

    # negative integers
    Morris.commas(-1).should.equal("-1")
    Morris.commas(-12).should.equal("-12")
    Morris.commas(-123).should.equal("-123")
    Morris.commas(-1234).should.equal("-1,234")
    Morris.commas(-12345).should.equal("-12,345")
    Morris.commas(-123456).should.equal("-123,456")
    Morris.commas(-1234567).should.equal("-1,234,567")

    # positive decimals
    Morris.commas(1.2).should.equal("1.2")
    Morris.commas(12.34).should.equal("12.34")
    Morris.commas(123.456).should.equal("123.456")
    Morris.commas(1234.56).should.equal("1,234.56")

    # negative decimals
    Morris.commas(-1.2).should.equal("-1.2")
    Morris.commas(-12.34).should.equal("-12.34")
    Morris.commas(-123.456).should.equal("-123.456")
    Morris.commas(-1234.56).should.equal("-1,234.56")

    # null
    Morris.commas(null).should.equal('-')

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
radius-rails-3.1.4 app/assets/components/morris.js/spec/lib/commas_spec.coffee
rails_modular_admin-1.0.0 app/assets/node_modules/morris.js/spec/lib/commas_spec.coffee
rails_modular_admin-0.4.0 app/assets/node_modules/morris.js/spec/lib/commas_spec.coffee
jinda_lte-0.0.1 lib/generators/jinda_lte/templates/app/assets/jinda_assets/bower_components/morris.js/spec/lib/commas_spec.coffee
jinda_bsb-0.0.1 lib/generators/jinda_bsb/templates/app/assets/jinda_assets/plugins/morrisjs/spec/lib/commas_spec.coffee