@@ -6,19 +6,28 @@ describe('isValidCustomProperty (default)', () => {
66 expect ( isValidCustomProperty ( '--Button-color' , 'Button' ) ) . toBe ( true )
77 expect ( isValidCustomProperty ( '--Button-Color' , 'Button' ) ) . toBe ( true )
88 expect ( isValidCustomProperty ( '--Button-123' , 'Button' ) ) . toBe ( true )
9- expect ( isValidCustomProperty ( '--Button' , 'Button' ) ) . toBe ( true )
109 expect (
1110 isValidCustomProperty ( '--UserProfile-avatar-size' , 'UserProfile' ) ,
1211 ) . toBe ( true )
1312 } )
1413
14+ test ( 'rejects bare component name without suffix' , ( ) => {
15+ expect ( isValidCustomProperty ( '--Button' , 'Button' ) ) . toBe ( false )
16+ expect ( isValidCustomProperty ( '--Button-' , 'Button' ) ) . toBe ( false )
17+ } )
18+
19+ test ( 'rejects component name not followed by hyphen' , ( ) => {
20+ expect ( isValidCustomProperty ( '--Buttonsdfs-color' , 'Button' ) ) . toBe ( false )
21+ expect ( isValidCustomProperty ( '--Buttonextra' , 'Button' ) ) . toBe ( false )
22+ } )
23+
1524 test ( 'rejects wrong component names' , ( ) => {
1625 expect ( isValidCustomProperty ( '--Wrong-color' , 'Button' ) ) . toBe ( false )
1726 expect ( isValidCustomProperty ( '--button-color' , 'Button' ) ) . toBe ( false )
1827 } )
1928} )
2029
21- describe ( 'isValidSuitCssProperty (strict SUIT CSS) ' , ( ) => {
30+ describe ( 'isValidSuitCssProperty' , ( ) => {
2231 test ( 'accepts basic valid patterns' , ( ) => {
2332 expect ( isValidSuitCssProperty ( '--Button-color' , 'Button' ) ) . toBe ( true )
2433 expect ( isValidSuitCssProperty ( '--Button-icon-size' , 'Button' ) ) . toBe ( true )
0 commit comments