File tree Expand file tree Collapse file tree 3 files changed +51
-1
lines changed Expand file tree Collapse file tree 3 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
77
88## [ Unreleased]  
9+ ### Fixed  
10+ -  Text with numbers is no longer right aligned ([ #405  ] ( https://github.com/cucumber/react-components/pull/405 ) )
11+ 
912### Added  
1013-  Include duration for each test step ([ #396  ] ( https://github.com/cucumber/react-components/pull/396 ) )
1114-  Include pass rate in execution summary ([ #397  ] ( https://github.com/cucumber/react-components/pull/397 ) )
Original file line number Diff line number Diff line change 1+ import  {  expect  }  from  'chai' 
2+ 
3+ import  isNumber  from  './isNumber.js' 
4+ 
5+ describe ( 'isNumber is true' ,  ( )  =>  { 
6+ 
7+   const  numbers  =  [ 
8+     '1' , 
9+     '-1' , 
10+     '10' , 
11+     '1.0' , 
12+     '.0' , 
13+     '1,0' , 
14+     '1 000,00' , 
15+     '127.0.0.0' , 
16+     '10E-05' , 
17+     '10E+05' , 
18+   ] 
19+ 
20+   numbers . forEach ( value  =>  { 
21+     it ( `${ value }  ,  ( )  =>  { 
22+       expect ( isNumber ( value ) ) . to . be . true 
23+     } ) 
24+   } ) 
25+ } ) 
26+ describe ( 'isNumber is false' ,  ( )  =>  { 
27+ 
28+   const  nonNumbers  =  [ 
29+     'hello' , 
30+     'hello world' , 
31+     '-' , 
32+     '+' , 
33+     '1.' , 
34+     '1,' , 
35+     'Ramayan 3392 A.D.' , 
36+     'E+10' , 
37+   ] 
38+ 
39+   nonNumbers . forEach ( value  =>  { 
40+     it ( `${ value }  ,  ( )  =>  { 
41+       expect ( isNumber ( value ) ) . to . be . false 
42+     } ) 
43+   } ) 
44+ 
45+ 
46+ } ) 
Original file line number Diff line number Diff line change 11// Lifted from cucumber-expressions/javascript/src/ParameterTypeRegistry#FLOAT_REGEXP 
2- const  numberPattern  =  / (? = .* \d .* ) [ - + ] ? \d * (?: \. (? = \d .* ) ) ? \d * (?: \d + [ E ] [ + - ] ? \d + ) ? / 
2+ // Modified to allow spaces, commas and periods as decimal- and/or as thousand-separators  
3+ const  numberPattern  =  / ^ (? = .* \d .* ) [ - + ] ? \d * (?: [ . ,   ] (? = \d .* ) \d * ) * (?: \d + E [ + - ] ? \d + ) ? $ / 
34
45export  default  function  isNumber ( s : string ) : boolean  { 
56  return  ! ! s . match ( numberPattern ) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments