File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 77
88import { FontAwesomeIconProps } from '../../types/icon-props'
99import { IS_VERSION_7_OR_LATER } from '../constants'
10- import { getClassListFromProps } from '../get-class-list-from-props'
10+ import { getClassListFromProps , withPrefix } from '../get-class-list-from-props'
1111
1212describe ( 'get class list' , ( ) => {
1313 const props = {
@@ -168,3 +168,29 @@ describe('get class list', () => {
168168 } )
169169 } )
170170} )
171+
172+ describe ( 'withPrefix utility function' , ( ) => {
173+ const customPrefix = 'custom-prefix'
174+
175+ beforeEach ( ( ) => {
176+ config . cssPrefix = customPrefix
177+ } )
178+
179+ it ( 'should prefix a single class' , ( ) => {
180+ expect ( withPrefix ( 'fa-icon' ) ) . toBe ( 'custom-prefix-icon' )
181+ } )
182+
183+ it ( 'should prefix multiple space-separated classes' , ( ) => {
184+ expect ( withPrefix ( 'fa-icon fa-spin fa-lg' ) ) . toBe (
185+ 'custom-prefix-icon custom-prefix-spin custom-prefix-lg' ,
186+ )
187+ } )
188+
189+ it ( 'should return empty string when given empty string' , ( ) => {
190+ expect ( withPrefix ( '' ) ) . toBe ( '' )
191+ } )
192+
193+ it ( 'should do nothing and return same string when given only whitespace' , ( ) => {
194+ expect ( withPrefix ( ' ' ) ) . toBe ( ' ' )
195+ } )
196+ } )
You can’t perform that action at this time.
0 commit comments