mirror of
https://github.com/zhigang1992/react-content-loader.git
synced 2026-04-15 07:28:27 +08:00
25 lines
857 B
JavaScript
25 lines
857 B
JavaScript
import React from 'react'
|
|
|
|
import {mount, render} from 'enzyme'
|
|
import {expect} from 'chai'
|
|
import sinon from 'sinon'
|
|
|
|
import ContentLoader from '../src/index'
|
|
import Wrap, { generateId } from '../src/Wrap'
|
|
|
|
describe('<Wrap /> Check id`s to render the SVG', () => {
|
|
|
|
it('is mask with the same `idClip`', () => {
|
|
const wrapper = mount(<Wrap />)
|
|
let idClip = wrapper.render().find('clipPath')[0].attribs.id
|
|
expect(wrapper.render().find('rect[clip-path]')[0].attribs['clip-path']).to.have.equal(`url(#${idClip})`)
|
|
})
|
|
|
|
it('is linearGradient with the same `idClip`', () => {
|
|
const wrapper = mount(<Wrap />)
|
|
let idGradient = wrapper.render().find('linearGradient')[0].attribs.id
|
|
expect(wrapper.render().find('rect[clip-path]')[0].attribs['style']).to.have.equal(`fill: url(#${idGradient});`)
|
|
})
|
|
|
|
})
|