Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e3c5a2c

Browse filesBrowse files
committed
test: update test
1 parent 6486494 commit e3c5a2c
Copy full SHA for e3c5a2c

File tree

2 files changed

+35
-51
lines changed
Filter options

2 files changed

+35
-51
lines changed

‎tests/CIcon.test.js

Copy file name to clipboard
+35-5Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,46 @@
11
import expect from 'expect'
22
import React from 'react'
3-
import {renderToStaticMarkup as render} from 'react-dom/server'
3+
import { renderToStaticMarkup as render } from 'react-dom/server'
44

5-
import {CIcon} from 'src/'
5+
import CIcon from 'src/'
6+
import {logo, logo as cilLogo} from './logo'
7+
React.icons = { logo, cilLogo }
68

79
describe('CIcon', () => {
810
it('renders svg with class="c-icon"', () => {
911
expect(render(<CIcon/>))
1012
.toContain('class="c-icon')
1113
})
12-
it('renders svg with class="c-icon-xl"', () => {
13-
expect(render(<CIcon size={'xl'}/>))
14-
.toContain(' c-icon-xl')
14+
it('renders svg with name', () => {
15+
expect(render(<CIcon name='logo'/>))
16+
.toContain(logo[1])
17+
})
18+
it('renders svg with name and className', () => {
19+
expect(render(<CIcon name={'logo'} className='test'/>))
20+
.toContain(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${logo[0]}" class="c-icon test" role="img">${logo[1]}</svg>`)
21+
})
22+
it('renders svg with content', () => {
23+
expect(render(<CIcon content='content'/>))
24+
.toContain('role="img">content</svg>')
25+
})
26+
it('renders svg with size', () => {
27+
expect(render(<CIcon size='xl'/>))
28+
.toContain('c-icon-xl')
29+
})
30+
it('renders svg with custom size', () => {
31+
expect(render(<CIcon size='custom'/>))
32+
.toContain('c-icon-custom-size')
33+
})
34+
it('renders svg with className', () => {
35+
expect(render(<CIcon className='c-icon-test'/>))
36+
.toContain('c-icon-test')
37+
})
38+
it('renders <img> with src', () => {
39+
expect(render(<CIcon src='src'/>))
40+
.toContain('<img src="src" role="img"/>')
41+
})
42+
it('renders <svg> with <use>', () => {
43+
expect(render(<CIcon use='xxx'/>))
44+
.toContain('<use href="xxx"></use></svg>')
1545
})
1646
})

‎tests/CIconRaw.test.js

Copy file name to clipboardExpand all lines: tests/CIconRaw.test.js
-46Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.