File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
test/unit/features/options Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ function assertProp (
91
91
return
92
92
}
93
93
let type = prop . type
94
- let valid = ! type
94
+ let valid = ! type || type === true
95
95
const expectedTypes = [ ]
96
96
if ( type ) {
97
97
if ( ! Array . isArray ( type ) ) {
Original file line number Diff line number Diff line change @@ -244,6 +244,19 @@ describe('Options props', () => {
244
244
expect ( console . error . calls . count ( ) ) . toBe ( 2 )
245
245
expect ( 'Expected Boolean' ) . toHaveBeenWarned ( )
246
246
} )
247
+
248
+ it ( 'optional prop of any type (type: true or prop: true)' , ( ) => {
249
+ makeInstance ( 1 , true )
250
+ expect ( console . error . calls . count ( ) ) . toBe ( 0 )
251
+ makeInstance ( 'any' , true )
252
+ expect ( console . error . calls . count ( ) ) . toBe ( 0 )
253
+ makeInstance ( { } , true )
254
+ expect ( console . error . calls . count ( ) ) . toBe ( 0 )
255
+ makeInstance ( undefined , true )
256
+ expect ( console . error . calls . count ( ) ) . toBe ( 0 )
257
+ makeInstance ( null , true )
258
+ expect ( console . error . calls . count ( ) ) . toBe ( 0 )
259
+ } )
247
260
} )
248
261
249
262
it ( 'should warn data fields already defined as a prop' , ( ) => {
You can’t perform that action at this time.
0 commit comments