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.

54 lines (52 loc) 1.56 kB
import React from 'react'; import { Radio } from '.'; import createSnapshot from '../../test/create-snapshot'; import render from '../../test/render'; var onChange = function onChange() {}; describe('<Radio />', function () { it('renders <Radio /> correctly with default props', function () { var snapshot = createSnapshot(React.createElement(Radio, { name: "test", checked: false, onChange: onChange })); expect(snapshot).toMatchSnapshot(); }); it('renders <Radio /> correctly with checked prop', function () { var snapshot = createSnapshot(React.createElement(Radio, { name: "test", checked: true, onChange: onChange })); expect(snapshot).toMatchSnapshot(); }); it('renders <Radio /> correctly with isValid=false', function () { var snapshot = createSnapshot(React.createElement(Radio, { name: "test", isValid: false, onChange: onChange })); expect(snapshot).toMatchSnapshot(); }); it('renders <Radio /> without overriding styles', function () { var snapshot = createSnapshot(React.createElement(Radio, { name: "test", checked: false, extend: { display: 'none' }, onChange: onChange })); expect(snapshot).toMatchSnapshot(); }); it('correctly implements ref prop', function () { var mockRef = React.createRef(); render(React.createElement(Radio, { ref: mockRef, name: "test", checked: true, onChange: onChange })); expect(mockRef.current).not.toBe(null); }); });