@@ -21,6 +21,13 @@ describe('Ansi', () => {
21
21
expect ( el . html ( ) ) . to . equal ( '<code><span>hello </span><span style="color:rgb(0, 187, 0);">world</span></code>' ) ;
22
22
} ) ;
23
23
24
+ it ( 'can have className' , ( ) => {
25
+ const el = enzyme . shallow ( React . createElement ( Ansi , { className : 'my-class' } , `hello world` ) ) ;
26
+ expect ( el ) . to . not . be . null ;
27
+ expect ( el . text ( ) ) . to . equal ( 'hello world' ) ;
28
+ expect ( el . html ( ) ) . to . equal ( '<code class="my-class"><span>hello world</span></code>' ) ;
29
+ } ) ;
30
+
24
31
it ( 'can nest' , ( ) => {
25
32
const el = enzyme . shallow ( React . createElement ( Ansi , null , `hello ${ GREEN_FG } wo${ YELLOW_BG } rl${ RESET } d` ) ) ;
26
33
expect ( el ) . to . not . be . null ;
@@ -33,20 +40,20 @@ describe('Ansi', () => {
33
40
expect ( el ) . to . not . be . null ;
34
41
expect ( el . text ( ) ) . to . equal ( 'that sentence\nwill make you pause' ) ;
35
42
} ) ;
36
-
43
+
37
44
it ( 'can linkify' , ( ) => {
38
45
const el = enzyme . shallow ( React . createElement ( Ansi , { linkify : true } , 'this is a link: https://nteract.io/' ) ) ;
39
46
expect ( el ) . to . not . be . null ;
40
47
expect ( el . text ( ) ) . to . equal ( 'this is a link: https://nteract.io/' ) ;
41
48
expect ( el . html ( ) ) . to . equal ( '<code><span>this is a link: <a href="https://nteract.io/" target="_blank">https://nteract.io/</a></span></code>' ) ;
42
49
} ) ;
43
-
50
+
44
51
it ( 'can distinguish URL-ish text' , ( ) => {
45
52
const el = enzyme . shallow ( React . createElement ( Ansi , { linkify : true } , '<transport.model.TransportInfo' ) ) ;
46
53
expect ( el ) . to . not . be . null ;
47
54
expect ( el . text ( ) ) . to . equal ( '<transport.model.TransportInfo' ) ;
48
55
} ) ;
49
-
56
+
50
57
it ( 'can distinguish URL-ish text' , ( ) => {
51
58
const el = enzyme . shallow ( React . createElement ( Ansi , { linkify : true } , "<module 'something' from '/usr/local/lib/python2.7/dist-packages/something/__init__.pyc'>" ) ) ;
52
59
expect ( el ) . to . not . be . null ;
0 commit comments