UNPKG

@zohodesk/svg

Version:

This Bundle Contains EmptyState Images.

116 lines 3.29 kB
import React from 'react'; import SVG from "../SVG"; import { render } from "@testing-library/react"; describe('SVG componet', () => { test('sholud render the basic strucutr of svg', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, null)); expect(asFragment()).toMatchSnapshot(); }); const palette = ['default', 'dark', 'danger']; test.each(palette)('Should render palette of svg - %s', palette => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { palette: palette })); expect(asFragment()).toMatchSnapshot(); }); const size = ['small', 'large']; test.each(size)('Should render size of svg - %s', size => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { size: size })); expect(asFragment()).toMatchSnapshot(); }); test('sholud render alignHorizontal is false in svg', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { alignHorizontal: false })); expect(asFragment()).toMatchSnapshot(); }); test('sholud render alignHorizontal is false in svg', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { isSymbol: true, alignHorizontal: false })); expect(asFragment()).toMatchSnapshot(); }); test('sholud render isFluid is true in svg ', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { isFluid: true })); expect(asFragment()).toMatchSnapshot(); }); test('sholud render isFluid is true in svg with symbol', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { isSymbol: true, isFluid: true })); expect(asFragment()).toMatchSnapshot(); }); test('sholud render isRender is false in svg', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { isSymbol: true, isRender: false })); expect(asFragment()).toMatchSnapshot(); }); test('sholud render isSymbol is true in svg', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { isSymbol: true }, " Snapshot ")); expect(asFragment()).toMatchSnapshot(); }); test('sholud render Name in svg', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { isSymbol: true, name: "Snapshot" })); expect(asFragment()).toMatchSnapshot(); }); test('sholud render viewBox in svg', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { viewBox: "0 0 500 500" })); expect(asFragment()).toMatchSnapshot(); }); test('sholud render className in svg', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { className: "Snapshot" })); expect(asFragment()).toMatchSnapshot(); }); test('should render styleName in SVG', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(SVG, { styleName: { height: '100px', width: '100px' } }, " Snapshot")); expect(asFragment()).toMatchSnapshot(); }); });