UNPKG

vcc-ui

Version:

VCC UI is a collection of React UI Components that can be used for developing front-end applications at Volvo Car Corporation.

37 lines (35 loc) 1.17 kB
import React from 'react'; import { Checkbox } from '.'; import createSnapshot from '../../test/create-snapshot'; import render from '../../test/render'; var onChange = function onChange() {}; describe('<Checkbox />', function () { it('renders <Checkbox /> correctly with default props', function () { var snapshot = createSnapshot(React.createElement(Checkbox, { onChange: onChange })); expect(snapshot).toMatchSnapshot(); }); it('renders <Checkbox /> correctly with isValid=false', function () { var snapshot = createSnapshot(React.createElement(Checkbox, { isValid: false, onChange: onChange })); expect(snapshot).toMatchSnapshot(); }); it('renders <Checkbox /> correctly with checked prop', function () { var snapshot = createSnapshot(React.createElement(Checkbox, { checked: true, onChange: onChange })); expect(snapshot).toMatchSnapshot(); }); it('correctly implements ref prop', function () { var mockRef = React.createRef(); render(React.createElement(Checkbox, { ref: mockRef, onChange: onChange })); expect(mockRef.current).not.toBe(null); }); });