components#Capacity TypeScript Examples

The following examples show how to use components#Capacity. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.test.tsx    From geist-ui with MIT License 6 votes vote down vote up
describe('Capacity', () => {
  it('should render value correctly', () => {
    const wrapper = mount(<Capacity value={50} />)
    expect(() => wrapper.unmount()).not.toThrow()
  })

  it('should render title correctly', () => {
    const wrapper = mount(<Capacity value={50} />)
    const el = wrapper.find('.capacity').first()
    const title = el.getDOMNode().getAttribute('title')
    expect(title).toEqual('50%')
  })

  it('should render different widths based on limit-value', () => {
    const wrapper = render(
      <div>
        <Capacity value={20} />
        <Capacity value={20} limit={50} />
        <Capacity value={20} limit={30} />
      </div>,
    )

    expect(wrapper).toMatchSnapshot()
  })

  it('should override background color', () => {
    const capacity = render(<Capacity value={50} color="white" />)
    expect(capacity).toMatchSnapshot()
  })
})