Skip to content

Commit 54966ba

Browse files
committed
test: add missing tests
1 parent fdf7b88 commit 54966ba

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

tests/CIcon.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import expect from 'expect'
2+
import React from 'react'
3+
import {renderToStaticMarkup as render} from 'react-dom/server'
4+
5+
import {CIcon} from 'src/'
6+
7+
describe('CIcon', () => {
8+
it('renders svg with class="c-icon"', () => {
9+
expect(render(<CIcon></CIcon>))
10+
.toContain('class="c-icon')
11+
})
12+
it('renders svg with class="c-icon-xl"', () => {
13+
expect(render(<CIcon size={'xl'}></CIcon>))
14+
.toContain(' c-icon-xl')
15+
})
16+
it('renders <i> with name object', () => {
17+
expect(render(<CIcon name={{name: 'test', type: 'class', className: 'c-icon'}} size={'sm'}></CIcon>))
18+
.toContain('<i class="c-icon c-icon-sm"></i>')
19+
})
20+
it('renders <span> with name object', () => {
21+
expect(render(<CIcon tag={'span'} name={{name: 'test', type: 'class', className: 'c-icon'}} size={'lg'}></CIcon>))
22+
.toContain('<span class="c-icon c-icon-lg"></span>')
23+
})
24+
})

tests/CIconRaw.test.js

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)