@@ -106,7 +106,7 @@ pub fn code_extract(
106106 Err ( error) => Err ( JsValue :: from_str ( error. to_string ( ) . as_str ( ) ) ) ,
107107 }
108108}
109- fn object_to_typography ( obj : Object , level : u8 ) -> Result < Typography , JsValue > {
109+ pub fn object_to_typography ( obj : Object , level : u8 ) -> Result < Typography , JsValue > {
110110 Ok ( Typography :: new (
111111 Reflect :: get ( & obj, & JsValue :: from_str ( "fontFamily" ) ) ?
112112 . as_string ( )
@@ -260,51 +260,3 @@ pub fn get_theme_interface(
260260 ) )
261261 }
262262}
263-
264- #[ cfg( test) ]
265- mod tests {
266- use super :: * ;
267- use wasm_bindgen_test:: * ;
268-
269- #[ wasm_bindgen_test]
270- fn test_object_to_typography ( ) {
271- let obj = Object :: new ( ) ;
272- Reflect :: set (
273- & obj,
274- & JsValue :: from_str ( "fontFamily" ) ,
275- & JsValue :: from_str ( "Arial" ) ,
276- )
277- . unwrap ( ) ;
278- Reflect :: set (
279- & obj,
280- & JsValue :: from_str ( "fontSize" ) ,
281- & JsValue :: from_str ( "12px" ) ,
282- )
283- . unwrap ( ) ;
284- Reflect :: set (
285- & obj,
286- & JsValue :: from_str ( "fontWeight" ) ,
287- & JsValue :: from_str ( "bold" ) ,
288- )
289- . unwrap ( ) ;
290- Reflect :: set (
291- & obj,
292- & JsValue :: from_str ( "lineHeight" ) ,
293- & JsValue :: from_str ( "1.5" ) ,
294- )
295- . unwrap ( ) ;
296- Reflect :: set (
297- & obj,
298- & JsValue :: from_str ( "letterSpacing" ) ,
299- & JsValue :: from_str ( "1px" ) ,
300- )
301- . unwrap ( ) ;
302- let typography = object_to_typography ( obj, 0 ) . unwrap ( ) ;
303- assert_eq ! ( typography. font_family, "Arial" ) ;
304- assert_eq ! ( typography. font_size, "12px" ) ;
305- assert_eq ! ( typography. font_weight, "bold" ) ;
306- assert_eq ! ( typography. line_height, "1.5" ) ;
307- assert_eq ! ( typography. letter_spacing, "1px" ) ;
308- assert_eq ! ( typography. level, 0 ) ;
309- }
310- }
0 commit comments