@@ -377,74 +377,6 @@ describe('js-file', function() {
377377 } ) ;
378378 } ) ;
379379
380- describe ( 'getFirstTokenOnLine' , function ( ) {
381- it ( 'should return first line token' , function ( ) {
382- var file = createJsFile ( 'x += 1;\ny += 4;' ) ;
383- var xToken = file . getFirstTokenOnLine ( 1 ) ;
384- expect ( xToken . type ) . to . equal ( 'Identifier' ) ;
385- expect ( xToken . value ) . to . equal ( 'x' ) ;
386- var yToken = file . getFirstTokenOnLine ( 2 ) ;
387- expect ( yToken . type ) . to . equal ( 'Identifier' ) ;
388- expect ( yToken . value ) . to . equal ( 'y' ) ;
389- } ) ;
390-
391- it ( 'should return whitespace token' , function ( ) {
392- expect ( createJsFile ( '\n\n ' ) . getFirstTokenOnLine ( 1 , {
393- includeWhitespace : true
394- } ) . type ) . to . equal ( 'Whitespace' ) ;
395- } ) ;
396-
397- it ( 'should return first line token if token is indented' , function ( ) {
398- var file = createJsFile ( '\t\tx += 1;\n\t\ty += 4;' ) ;
399- var xToken = file . getFirstTokenOnLine ( 1 ) ;
400- expect ( xToken . type ) . to . equal ( 'Identifier' ) ;
401- expect ( xToken . value ) . to . equal ( 'x' ) ;
402- var yToken = file . getFirstTokenOnLine ( 2 ) ;
403- expect ( yToken . type ) . to . equal ( 'Identifier' ) ;
404- expect ( yToken . value ) . to . equal ( 'y' ) ;
405- } ) ;
406-
407- it ( 'should return null if no token was found' , function ( ) {
408- var file = createJsFile ( '\t\tx += 1;\n\n' ) ;
409- var yToken = file . getFirstTokenOnLine ( 2 ) ;
410- expect ( yToken ) . to . equal ( null ) ;
411- } ) ;
412-
413- it ( 'should return null if only comment was found' , function ( ) {
414- var file = createJsFile ( '\t\tx += 1;\n/*123*/\n' ) ;
415- var yToken = file . getFirstTokenOnLine ( 2 ) ;
416- expect ( yToken ) . to . equal ( null ) ;
417- } ) ;
418-
419- it ( 'should return first line token ignoring comments' , function ( ) {
420- var file = createJsFile ( '\t/* 123 */\tx += 1;\n\t/* 321 */\ty += 4;' ) ;
421- var xToken = file . getFirstTokenOnLine ( 1 ) ;
422- expect ( xToken . type ) . to . equal ( 'Identifier' ) ;
423- expect ( xToken . value ) . to . equal ( 'x' ) ;
424- var yToken = file . getFirstTokenOnLine ( 2 ) ;
425- expect ( yToken . type ) . to . equal ( 'Identifier' ) ;
426- expect ( yToken . value ) . to . equal ( 'y' ) ;
427- } ) ;
428-
429- it ( 'should return first line token including comments' , function ( ) {
430- var file = createJsFile ( '\t/*123*/\tx += 1;\n\t/*321*/\ty += 4;' ) ;
431- var commentToken1 = file . getFirstTokenOnLine ( 1 , { includeComments : true } ) ;
432- expect ( ! ! commentToken1 . isComment ) . to . equal ( true ) ;
433- expect ( commentToken1 . type ) . to . equal ( 'CommentBlock' ) ;
434- expect ( commentToken1 . value ) . to . equal ( '123' ) ;
435- var commentToken2 = file . getFirstTokenOnLine ( 2 , { includeComments : true } ) ;
436- expect ( ! ! commentToken2 . isComment ) . to . equal ( true ) ;
437- expect ( commentToken2 . type ) . to . equal ( 'CommentBlock' ) ;
438- expect ( commentToken2 . value ) . to . equal ( '321' ) ;
439- } ) ;
440-
441- it ( 'should return null if no token was found including comments' , function ( ) {
442- var file = createJsFile ( '\t\tx += 1;\n\n' ) ;
443- var yToken = file . getFirstTokenOnLine ( 2 , { includeComments : true } ) ;
444- expect ( yToken ) . to . equal ( null ) ;
445- } ) ;
446- } ) ;
447-
448380 describe ( 'getLastTokenOnLine' , function ( ) {
449381 it ( 'should return last line token' , function ( ) {
450382 var file = createJsFile ( 'x = 1;\nif (x) {}\n' ) ;
0 commit comments