@@ -2,6 +2,7 @@ import React from 'react';
2
2
import ReactTestUtils from 'react/lib/ReactTestUtils' ;
3
3
import BootstrapMixin from '../src/BootstrapMixin' ;
4
4
import styleMaps from '../src/styleMaps' ;
5
+ import { shouldWarn } from './helpers' ;
5
6
6
7
let Component ;
7
8
@@ -197,14 +198,28 @@ describe('BootstrapMixin', function () {
197
198
assert . equal ( instance . prefixClass ( 'title' ) , 'btn-title' ) ;
198
199
} ) ;
199
200
200
- it ( 'should return "btn btn-wacky"' , function ( ) {
201
- styleMaps . addStyle ( 'wacky' ) ;
202
- let instance = ReactTestUtils . renderIntoDocument (
203
- < Component bsClass = 'button' bsStyle = 'wacky' >
204
- content
205
- </ Component >
206
- ) ;
207
- assert . deepEqual ( instance . getBsClassSet ( ) , { 'btn' : true , 'btn-wacky' : true } ) ;
201
+ describe ( 'Custom styles' , function ( ) {
202
+ it ( 'should validate OK custom styles added via "addStyle()"' , function ( ) {
203
+
204
+ styleMaps . addStyle ( 'wacky' ) ;
205
+
206
+ let instance = ReactTestUtils . renderIntoDocument (
207
+ < Component bsClass = 'button' bsStyle = 'wacky' >
208
+ content
209
+ </ Component >
210
+ ) ;
211
+ assert . deepEqual ( instance . getBsClassSet ( ) , { 'btn' : true , 'btn-wacky' : true } ) ;
212
+ } ) ;
213
+
214
+ it ( 'should allow custom styles as is but with validation warning' , function ( ) {
215
+ let instance = ReactTestUtils . renderIntoDocument (
216
+ < Component bsClass = 'button' bsStyle = 'my-custom-class' >
217
+ content
218
+ </ Component >
219
+ ) ;
220
+ assert . deepEqual ( instance . getBsClassSet ( ) , { 'btn' : true , 'my-custom-class' : true } ) ;
221
+ shouldWarn ( 'Invalid prop `bsStyle` of value `my-custom-class`' ) ;
222
+ } ) ;
208
223
} ) ;
209
224
} ) ;
210
225
} ) ;
0 commit comments