Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit3bb20a9

Browse files
committed
test: more coverage
1 parent735b5a0 commit3bb20a9

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

‎tests/CIcon.test.js‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ import React from 'react'
33
import{renderToStaticMarkupasrender}from'react-dom/server'
44

55
importCIconfrom'src/'
6+
importCIconRawfrom'src/'
67
import{logo,logoascilLogo}from'./logo'
7-
React.icons={ logo, cilLogo}
8+
import{cifAU}from'./cif-AU';
9+
React.icons={ logo, cilLogo, cifAU}
810

911
describe('CIcon',()=>{
12+
13+
// polyfill
14+
String.prototype.replaceAll=function(f,r){returnthis.split(f).join(r);}
15+
1016
it('renders svg with class="c-icon"',()=>{
1117
expect(render(<CIcon/>))
1218
.toContain('class="c-icon')
@@ -43,4 +49,24 @@ describe('CIcon', () => {
4349
expect(render(<CIconuse='xxx'/>))
4450
.toContain('<use href="xxx"></use></svg>')
4551
})
52+
it('renders with title',()=>{
53+
expect(render(<CIconname="cifAU"title="title"/>))
54+
.toContain(cifAU[1])
55+
})
56+
it('warns on CIconRaw',()=>{
57+
expect(render(<CIconRaw/>))
58+
.toContain('c-icon')
59+
})
60+
it('doesn`t warn on existing icon',()=>{
61+
expect(render(<CIconname='cifAU'/>))
62+
.toNotContain('undefined')
63+
})
64+
it('warns on non existing icon',()=>{
65+
expect(render(<CIconname='none'/>))
66+
.toContain('undefined')
67+
})
68+
it('converts toCamelCase',()=>{
69+
expect(render(<CIconname='cif-AU'/>))
70+
.toContain(cifAU[1])
71+
})
4672
})

‎tests/cif-AU.js‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp