components#Note TypeScript Examples

The following examples show how to use components#Note. 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 5 votes vote down vote up
describe('Note', () => {
  it('should render correctly', () => {
    const wrapper = mount(<Note>note</Note>)
    expect(wrapper.html()).toMatchSnapshot()
    expect(() => wrapper.unmount()).not.toThrow()
  })

  it('should work with different types', () => {
    const wrapper = mount(
      <div>
        <Note type="secondary">secondary</Note>
        <Note type="success">success</Note>
        <Note type="warning">warning</Note>
        <Note type="error">error</Note>
      </div>,
    )
    expect(wrapper.html()).toMatchSnapshot()
    expect(() => wrapper.unmount()).not.toThrow()
  })

  it('custom labels should be rendered', async () => {
    const wrapper = mount(<Note label={false}>note</Note>)
    expect(wrapper.find('.label').length).toBe(0)

    wrapper.setProps({ label: 'test' })
    await updateWrapper(wrapper)
    expect(wrapper.find('.label').text().toLowerCase()).toContain('test')
  })

  it('should work with different styles', () => {
    const wrapper = mount(
      <div>
        <Note type="secondary">secondary</Note>
        <Note type="success" filled>
          success
        </Note>
        <Note filled>warning</Note>
      </div>,
    )
    expect(wrapper.html()).toMatchSnapshot()
    expect(() => wrapper.unmount()).not.toThrow()
  })
})