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", () => {
305305 '<code><span class="ansi-green-fg">this is a link: <a href="https://nteract.io/" target="_blank">https://nteract.io/</a></span></code>'
306306 ) ;
307307 } ) ;
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+ } ) ;
308323 } ) ;
309324} ) ;
Original file line number Diff line number Diff line change @@ -51,29 +51,15 @@ function createClass(bundle: AnserJsonEntry): string | null {
5151 return classNames ;
5252}
5353
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-
6854/**
6955 * Create the style attribute.
7056 * @name createStyle
7157 * @function
7258 * @param {AnserJsonEntry } bundle
7359 * @return {Object } returns the style object
7460 */
75- function createStyle ( bundle : AnserJsonEntry ) : Colors {
76- const style : Styles = { } ;
61+ function createStyle ( bundle : AnserJsonEntry ) : React . CSSProperties {
62+ const style : React . CSSProperties = { } ;
7763 if ( bundle . bg ) {
7864 style . backgroundColor = `rgb(${ bundle . bg } )` ;
7965 }
You can’t perform that action at this time.
0 commit comments