1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | "use strict" ;
|
28 |
|
29 |
|
30 |
|
31 | var termkit = require( '../lib/termkit.js' ) ;
|
32 | var term = termkit.terminal ;
|
33 |
|
34 |
|
35 |
|
36 | describe( "Find" , () => {
|
37 | it( "how to test a terminal lib with Tea-Time..." ) ;
|
38 | } ) ;
|
39 |
|
40 |
|
41 |
|
42 | describe( "String width" , () => {
|
43 |
|
44 | it( ".markupWidth()" , () => {
|
45 | expect( termkit.markupWidth( '^CBook^Ymark^Rs' ) ).to.be( 9 ) ;
|
46 | } ) ;
|
47 |
|
48 | it( ".truncateString()" , () => {
|
49 | expect( termkit.truncateString( '$za' , 2 ) ).to.be( '$z' ) ;
|
50 | expect( termkit.truncateString( '$za' , 3 ) ).to.be( '$za' ) ;
|
51 | expect( termkit.truncateString( '$za' , 4 ) ).to.be( '$za' ) ;
|
52 | expect( termkit.truncateString( 'aé@à' , 2 ) ).to.be( 'aé' ) ;
|
53 | expect( termkit.truncateString( 'aé@à' , 3 ) ).to.be( 'aé' ) ;
|
54 | expect( termkit.truncateString( 'aé@à' , 4 ) ).to.be( 'aé@' ) ;
|
55 | expect( termkit.truncateString( 'aé@à' , 5 ) ).to.be( 'aé@à' ) ;
|
56 | expect( termkit.truncateString( 'aé@à' , 6 ) ).to.be( 'aé@à' ) ;
|
57 | expect( termkit.truncateString( 'aé汉字à' , 2 ) ).to.be( 'aé' ) ;
|
58 | expect( termkit.truncateString( 'aé汉字à' , 3 ) ).to.be( 'aé' ) ;
|
59 | expect( termkit.truncateString( 'aé汉字à' , 4 ) ).to.be( 'aé汉' ) ;
|
60 | expect( termkit.truncateString( 'aé汉字à' , 5 ) ).to.be( 'aé汉' ) ;
|
61 | expect( termkit.truncateString( 'aé汉字à' , 6 ) ).to.be( 'aé汉字' ) ;
|
62 | expect( termkit.truncateString( 'aé汉字à' , 7 ) ).to.be( 'aé汉字à' ) ;
|
63 | expect( termkit.truncateString( 'aé汉字à' , 8 ) ).to.be( 'aé汉字à' ) ;
|
64 |
|
65 | expect( termkit.truncateString( 'aé汉\x1b[1m\x1b[1m字à' , 3 ) ).to.be( 'aé' ) ;
|
66 | expect( termkit.truncateString( 'aé汉\x1b[1m\x1b[1m字à' , 4 ) ).to.be( 'aé汉' ) ;
|
67 | expect( termkit.truncateString( 'aé汉\x1b[1m\x1b[1m字à' , 5 ) ).to.be( 'aé汉\x1b[1m\x1b[1m' ) ;
|
68 | expect( termkit.truncateString( 'aé汉\x1b[1m\x1b[1m字à' , 6 ) ).to.be( 'aé汉\x1b[1m\x1b[1m字' ) ;
|
69 | } ) ;
|
70 | } ) ;
|
71 |
|
72 |
|
73 |
|
74 | describe( "Misc" , () => {
|
75 | it( "Auto-instance" , () => {
|
76 | expect( term ).to.be.an( termkit.Terminal ) ;
|
77 | } ) ;
|
78 | } ) ;
|
79 |
|