File tree Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -305,5 +305,20 @@ describe("Ansi", () => {
305
305
'<code><span class="ansi-green-fg">this is a link: <a href="https://nteract.io/" target="_blank">https://nteract.io/</a></span></code>'
306
306
) ;
307
307
} ) ;
308
+
309
+ test ( "can add text decoration styles" , ( ) => {
310
+ const el = shallow (
311
+ React . createElement (
312
+ Ansi ,
313
+ { } ,
314
+ `hello ${ GREEN_FG } ${ BOLD } world${ RESET } !`
315
+ )
316
+ ) ;
317
+ expect ( el ) . not . toBeNull ( ) ;
318
+ expect ( el . text ( ) ) . toBe ( "hello world!" ) ;
319
+ expect ( el . html ( ) ) . toBe (
320
+ '<code><span>hello </span><span style="color:rgb(0, 187, 0);font-weight:bold">world</span><span>!</span></code>'
321
+ ) ;
322
+ } ) ;
308
323
} ) ;
309
324
} ) ;
Original file line number Diff line number Diff line change @@ -51,29 +51,15 @@ function createClass(bundle: AnserJsonEntry): string | null {
51
51
return classNames ;
52
52
}
53
53
54
- interface Colors {
55
- color ?: string ;
56
- backgroundColor ?: string ;
57
- }
58
-
59
- interface Styles extends Colors {
60
- fontWeight ?: string ;
61
- opacity ?: string ;
62
- fontStyle ?: string ;
63
- visibility ?: string ;
64
- textDecoration ?: string ;
65
- }
66
-
67
-
68
54
/**
69
55
* Create the style attribute.
70
56
* @name createStyle
71
57
* @function
72
58
* @param {AnserJsonEntry } bundle
73
59
* @return {Object } returns the style object
74
60
*/
75
- function createStyle ( bundle : AnserJsonEntry ) : Colors {
76
- const style : Styles = { } ;
61
+ function createStyle ( bundle : AnserJsonEntry ) : React . CSSProperties {
62
+ const style : React . CSSProperties = { } ;
77
63
if ( bundle . bg ) {
78
64
style . backgroundColor = `rgb(${ bundle . bg } )` ;
79
65
}
You can’t perform that action at this time.
0 commit comments