@@ -78,16 +78,17 @@ describe("Test renderStatsCard", () => {
78
78
79
79
it ( "should render with custom width set" , ( ) => {
80
80
document . body . innerHTML = renderStatsCard ( stats ) ;
81
- expect ( document . querySelector ( "svg" ) ) . toHaveAttribute ( "width" , "495 " ) ;
81
+ expect ( document . querySelector ( "svg" ) ) . toHaveAttribute ( "width" , "450 " ) ;
82
82
83
- document . body . innerHTML = renderStatsCard ( stats , { card_width : 400 } ) ;
84
- expect ( document . querySelector ( "svg" ) ) . toHaveAttribute ( "width" , "400 " ) ;
83
+ document . body . innerHTML = renderStatsCard ( stats , { card_width : 500 } ) ;
84
+ expect ( document . querySelector ( "svg" ) ) . toHaveAttribute ( "width" , "500 " ) ;
85
85
} ) ;
86
86
87
87
it ( "should render with custom width set and limit minimum width" , ( ) => {
88
88
document . body . innerHTML = renderStatsCard ( stats , { card_width : 1 } ) ;
89
- expect ( document . querySelector ( "svg" ) ) . toHaveAttribute ( "width" , "340 " ) ;
89
+ expect ( document . querySelector ( "svg" ) ) . toHaveAttribute ( "width" , "420 " ) ;
90
90
91
+ // Test default minimum card width without rank circle.
91
92
document . body . innerHTML = renderStatsCard ( stats , {
92
93
card_width : 1 ,
93
94
hide_rank : true ,
@@ -97,29 +98,32 @@ describe("Test renderStatsCard", () => {
97
98
"305.81250000000006" ,
98
99
) ;
99
100
101
+ // Test minimum card width with rank and icons.
100
102
document . body . innerHTML = renderStatsCard ( stats , {
101
103
card_width : 1 ,
102
104
hide_rank : true ,
103
105
show_icons : true ,
104
106
} ) ;
105
107
expect ( document . querySelector ( "svg" ) ) . toHaveAttribute (
106
108
"width" ,
107
- "305 .81250000000006" ,
109
+ "322 .81250000000006" ,
108
110
) ;
109
111
112
+ // Test minimum card width with icons but without rank.
110
113
document . body . innerHTML = renderStatsCard ( stats , {
111
114
card_width : 1 ,
112
115
hide_rank : false ,
113
116
show_icons : true ,
114
117
} ) ;
115
- expect ( document . querySelector ( "svg" ) ) . toHaveAttribute ( "width" , "356 " ) ;
118
+ expect ( document . querySelector ( "svg" ) ) . toHaveAttribute ( "width" , "437 " ) ;
116
119
120
+ // Test minimum card width without icons or rank.
117
121
document . body . innerHTML = renderStatsCard ( stats , {
118
122
card_width : 1 ,
119
123
hide_rank : false ,
120
124
show_icons : false ,
121
125
} ) ;
122
- expect ( document . querySelector ( "svg" ) ) . toHaveAttribute ( "width" , "340 " ) ;
126
+ expect ( document . querySelector ( "svg" ) ) . toHaveAttribute ( "width" , "420 " ) ;
123
127
} ) ;
124
128
125
129
it ( "should render default colors properly" , ( ) => {
@@ -312,7 +316,7 @@ describe("Test renderStatsCard", () => {
312
316
313
317
expect (
314
318
document . body . getElementsByTagName ( "svg" ) [ 0 ] . getAttribute ( "width" ) ,
315
- ) . toBe ( "270 " ) ;
319
+ ) . toBe ( "287 " ) ;
316
320
} ) ;
317
321
318
322
it ( "should render translations" , ( ) => {
0 commit comments