File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ export interface UseLogReturn {
7676export interface _PrintConfig < T > {
7777 value : T
7878 prevValue ?: T
79- label : string
79+ label ? : string
8080 type ?: _PrintTypes
8181 styles ?: Styles
8282 componentName : string
Original file line number Diff line number Diff line change @@ -175,5 +175,14 @@ describe('utils', () => {
175175 expect ( consoleWarn ) . toHaveBeenCalled ( )
176176 expect ( consoleGroupEnd ) . toHaveBeenCalled ( )
177177 } )
178+
179+ it ( 'prints without label' , ( ) => {
180+ print ( {
181+ ...printProps ,
182+ label : undefined ,
183+ } )
184+
185+ expect ( consoleLog ) . toHaveBeenCalledWith ( ' Test Value' )
186+ } )
178187 } )
179188} )
Original file line number Diff line number Diff line change @@ -69,10 +69,8 @@ export function print<T>({
6969 method : keyof _SupportedConsole ,
7070 ) : _SupportedConsole [ keyof _SupportedConsole ] => getPrinter ( printer , method )
7171
72- const groupMethod = flags . isCollapsed ? 'groupCollapsed' : 'group'
73-
7472 if ( flags . isGrouped ) {
75- getCurrentPrinter ( groupMethod ) (
73+ getCurrentPrinter ( flags . isCollapsed ? 'groupCollapsed' : 'group' ) (
7674 getGroupLabel ( type , componentName ) ,
7775 componentCSS ,
7876 subValueCSS ,
@@ -86,7 +84,11 @@ export function print<T>({
8684 )
8785 getCurrentPrinter ( logLevel ) ( ` Current value: %c${ String ( value ) } ` , changeCSS )
8886 } else {
89- getCurrentPrinter ( logLevel ) ( `${ label . padStart ( 14 , ' ' ) } : ${ String ( value ) } ` )
87+ getCurrentPrinter ( logLevel ) (
88+ `${ label ? `${ label . padStart ( 14 , ' ' ) } : ` : '' . padStart ( 16 , ' ' ) } ${ String (
89+ value ,
90+ ) } `,
91+ )
9092 }
9193
9294 if ( flags . isGrouped ) getCurrentPrinter ( 'groupEnd' ) ( )
You can’t perform that action at this time.
0 commit comments