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.

43 lines 1.61 kB
import React from 'react'; import { Click } from '.'; import createSnapshot from '../../test/create-snapshot'; import render from '../../test/render'; describe('<Click /> snapshot tests', function () { it('renders <Click /> correctly with default props', function () { var snapshot = createSnapshot(React.createElement(Click, null, "Children")); expect(snapshot).toMatchSnapshot(); }); it('renders <Click /> correctly with disabled=true', function () { var snapshot = createSnapshot(React.createElement(Click, { disabled: true }, "Children")); expect(snapshot).toMatchSnapshot(); }); it('renders <Click /> correctly with disabled=true and href passed', function () { var snapshot = createSnapshot(React.createElement(Click, { disabled: true, href: "#" }, "Children")); expect(snapshot).toMatchSnapshot(); }); it('renders <Click /> with correct type, when it is a button and no type is specified', function () { var snapshot = createSnapshot(React.createElement(Click, { as: "button" }, "Children")); expect(snapshot).toMatchSnapshot(); }); it('renders <Click /> with correct type, when it is a button and type is specified', function () { var snapshot = createSnapshot(React.createElement(Click, { as: "button", type: "foo" }, "Children")); expect(snapshot).toMatchSnapshot(); }); it('correctly implements ref prop', function () { var mockRef = React.createRef(); render(React.createElement(Click, { ref: mockRef }, "Hi")); expect(mockRef.current).not.toBe(null); }); });