Sha256: 3745b2d99c20c7c1d646af89de86025efd8ab1288b22322dabb082f53a6a3724

Contents?: true

Size: 998 Bytes

Versions: 27

Compression:

Stored size: 998 Bytes

Contents

import React from 'react'
import { render, screen } from '../utilities/test-utils'
import Currency from './_currency'

test('abbreviate prop returns proper abbreviated amount', () => {
  render(
    <>
      <Currency
          abbreviate
          amount="3200"
          data={{ testid: 'test-thousands' }}
      />
      <Currency
          abbreviate
          amount="3,200,000"
          data={{ testid: 'test-millions' }}
      />
      <Currency
          abbreviate
          amount="3200000000"
          data={{ testid: 'test-billions' }}
      />
      <Currency
          abbreviate
          amount="3,200,000,000,000"
          data={{ testid: 'test-trillions' }}
      />
    </>
  )

  expect(screen.getByTestId('test-thousands')).toHaveTextContent('$3.2K')
  expect(screen.getByTestId('test-millions')).toHaveTextContent('$3.2M')
  expect(screen.getByTestId('test-billions')).toHaveTextContent('$3.2B')
  expect(screen.getByTestId('test-trillions')).toHaveTextContent('$3.2T')
})

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
playbook_ui-11.0.1 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-11.0.0 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-11.0.0.pre.alpha.2 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-11.0.0.pre.alpha.1 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.26.1 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.27.0.pre.lazysizes1 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.27.0.pre.datepicker1 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.26.0 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.26.0.pre.alpha5 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.26.0.pre.rc1 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.26.0.pre.alpha.sticky1 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.26.0.pre.alpha.display1 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.26.0.pre.alpha3 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.25.1 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.26.0.pre.alpha1 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.25.0 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.25.0.pre.alpha3 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.25.0.pre.treeshaking1 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.24.0 app/pb_kits/playbook/pb_currency/currency.test.js
playbook_ui-10.24.0.pre.alpha1 app/pb_kits/playbook/pb_currency/currency.test.js