@@ -3,15 +3,15 @@ import MockGridModel from './MockGridModel';
33
44describe ( 'tokensForCell' , ( ) => {
55 it ( 'should return tokens for a cell' , ( ) => {
6- const model = new MockGridModel ( { editedData : [ [ 'google.com' ] ] } ) ;
6+ const model = new MockGridModel ( { editedData : [ [ 'https:// google.com' ] ] } ) ;
77 const expectedValue : LinkToken [ ] = [
88 {
99 type : 'url' ,
10- value : 'google.com' ,
10+ value : 'https:// google.com' ,
1111 isLink : true ,
12- href : 'http ://google.com' ,
12+ href : 'https ://google.com' ,
1313 start : 0 ,
14- end : 10 ,
14+ end : 18 ,
1515 } ,
1616 ] ;
1717
@@ -21,41 +21,34 @@ describe('tokensForCell', () => {
2121 } ) ;
2222
2323 it ( 'should return multiple tokens for a cell' , ( ) => {
24- const text = 'google.com youtube.com blah@gmail.com' ;
24+ const text = 'https:// google.com youtube.com blah@gmail.com' ;
2525 const model = new MockGridModel ( { editedData : [ [ text ] ] } ) ;
2626 const expectedValue : LinkToken [ ] = [
2727 {
2828 type : 'url' ,
29- value : 'google.com' ,
29+ value : 'https:// google.com' ,
3030 isLink : true ,
31- href : 'http ://google.com' ,
31+ href : 'https ://google.com' ,
3232 start : 0 ,
33- end : 10 ,
34- } ,
35- {
36- type : 'url' ,
37- value : 'youtube.com' ,
38- isLink : true ,
39- href : 'http://youtube.com' ,
40- start : 11 ,
41- end : 22 ,
33+ end : 18 ,
4234 } ,
35+
4336 {
4437 type : 'email' ,
4538 value : 'blah@gmail.com' ,
4639 isLink : true ,
4740 href : 'mailto:blah@gmail.com' ,
48- start : 23 ,
49- end : 37 ,
41+ start : 31 ,
42+ end : 45 ,
5043 } ,
5144 ] ;
5245
5346 const tokens = model . tokensForCell ( 0 , 0 , text . length ) ;
54- expect ( tokens ) . toHaveLength ( 3 ) ;
47+ expect ( tokens ) . toHaveLength ( 2 ) ;
5548 expect ( tokens ) . toEqual ( expectedValue ) ;
5649 } ) ;
5750
58- it ( 'should an empty array for a cell with no tokens' , ( ) => {
51+ it ( 'should return an empty array for a cell with no tokens' , ( ) => {
5952 const text = 'google youtube' ;
6053 const model = new MockGridModel ( { editedData : [ [ text ] ] } ) ;
6154 const expectedValue : LinkToken [ ] = [ ] ;
0 commit comments