@@ -37,13 +37,34 @@ describe('buildStabilityOverview', () => {
3737 assert . equal ( findChild ( table , 'tbody' ) . children . length , 2 ) ;
3838 } ) ;
3939
40- it ( 'formats the stability cell as `(index) < first sentence>` ' , ( ) => {
40+ it ( 'formats the stability cell with a colored badge and first sentence' , ( ) => {
4141 const table = buildStabilityOverview ( [ fakeHead ( 'fs' , 'fs' , 1 ) ] ) ;
4242
4343 const row = findChild ( table , 'tbody' ) . children [ 0 ] ;
4444 const stabilityCell = row . children [ 1 ] ;
45+ const badge = stabilityCell . children [ 0 ] ;
4546
46- assert . equal ( stabilityCell . children [ 0 ] . value , '(1) fs stable' ) ;
47+ assert . equal ( badge . name , 'Badge' ) ;
48+ assert . deepEqual (
49+ badge . attributes . map ( ( { name, value } ) => [ name , value ] ) ,
50+ [
51+ [ 'size' , 'small' ] ,
52+ [ 'kind' , 'warning' ] ,
53+ [ 'aria-label' , 'Stability: 1' ] ,
54+ ]
55+ ) ;
56+ assert . equal ( badge . children [ 0 ] . value , '1' ) ;
57+ assert . equal ( stabilityCell . children [ 1 ] . value , ' fs stable' ) ;
58+ } ) ;
59+
60+ it ( 'uses a default badge for stable entries' , ( ) => {
61+ const table = buildStabilityOverview ( [ fakeHead ( 'fs' , 'fs' , 2 ) ] ) ;
62+
63+ const row = findChild ( table , 'tbody' ) . children [ 0 ] ;
64+ const badge = row . children [ 1 ] . children [ 0 ] ;
65+ const kind = badge . attributes . find ( attr => attr . name === 'kind' ) ;
66+
67+ assert . equal ( kind . value , 'default' ) ;
4768 } ) ;
4869
4970 it ( 'builds a relative link to the module HTML page' , ( ) => {
0 commit comments