|
| 1 | +/* eslint-disable no-undef */ |
| 2 | +import React from 'react' |
| 3 | +// import renderer from 'react-test-renderer' |
| 4 | +import { EosloadingAnimated } from '../lib' |
| 5 | +import { render, cleanup } from '@testing-library/react' |
| 6 | +import '@testing-library/jest-dom/extend-expect' |
| 7 | + |
| 8 | +afterEach(cleanup) |
| 9 | + |
| 10 | +it('Animated SVG Size prop test', () => { |
| 11 | + const randomSize = Math.floor(Math.random()) + 1 |
| 12 | + const { getByTestId } = render( |
| 13 | + <EosloadingAnimated size={`${randomSize}`}/> |
| 14 | + ) |
| 15 | + expect(getByTestId('eos-svg-component')).toHaveStyle({ |
| 16 | + width: `${randomSize}`, |
| 17 | + height: `${randomSize}` |
| 18 | + }) |
| 19 | +}) |
| 20 | + |
| 21 | +it('Animated SVG Color prop test', () => { |
| 22 | + const { getByTestId } = render( |
| 23 | + <EosloadingAnimated color="blue"/> |
| 24 | + ) |
| 25 | + expect(getByTestId('eos-svg-component')).toHaveAttribute('fill', 'blue') |
| 26 | +}) |
| 27 | + |
| 28 | +it('Animated SVG Rotation prop test', () => { |
| 29 | + const randomDegree = Math.floor(Math.random() * 360) + 1 |
| 30 | + const { getByTestId } = render( |
| 31 | + <EosloadingAnimated rotate={`${randomDegree}`}/> |
| 32 | + ) |
| 33 | + expect(getByTestId('eos-svg-component')).toHaveAttribute('transform', `rotate(${randomDegree}) translate(0, 0) scale(1, 1)`) |
| 34 | +}) |
| 35 | + |
| 36 | +it('Animated SVG horizontalFlip prop test', () => { |
| 37 | + const { getByTestId } = render( |
| 38 | + <EosloadingAnimated horizontalFlip={true}/> |
| 39 | + ) |
| 40 | + expect(getByTestId('eos-svg-component')).toHaveAttribute('transform', 'rotate(0) translate(24, 0) scale(-1, 1)') |
| 41 | +}) |
| 42 | + |
| 43 | +it('Animated SVG verticalFlip prop test', () => { |
| 44 | + const { getByTestId } = render( |
| 45 | + <EosloadingAnimated verticalFlip={true}/> |
| 46 | + ) |
| 47 | + expect(getByTestId('eos-svg-component')).toHaveAttribute('transform', 'rotate(0) translate(0, 24) scale(1, -1)') |
| 48 | +}) |
0 commit comments