File tree Expand file tree Collapse file tree
docs/angular.io-package/rendering Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- module . exports = function ( encodeCodeBlock ) {
1+ module . exports = function ( ) {
22 return {
33 name : 'trimBlankLines' ,
44 process : function ( str ) {
55 var lines = str . split ( / \r ? \n / ) ;
6- while ( lines [ 0 ] === '' ) {
6+ while ( lines . length && ( lines [ 0 ] . trim ( ) === '' ) ) {
77 lines . shift ( ) ;
88 }
99 return lines . join ( '\n' ) ;
Original file line number Diff line number Diff line change 1+ var factory = require ( './trimBlankLines' ) ;
2+
3+ describe ( 'trimBlankLines filter' , function ( ) {
4+ var filter ;
5+
6+ beforeEach ( function ( ) {
7+ filter = factory ( ) ;
8+ } ) ;
9+
10+ it ( 'should be called "trimBlankLines"' , function ( ) {
11+ expect ( filter . name ) . toEqual ( 'trimBlankLines' ) ;
12+ } ) ;
13+
14+ it ( 'should remove all empty lines from the start of the string' , function ( ) {
15+ expect ( filter . process ( '\n\n\nsome text\n\nmore text\n\n' ) )
16+ . toEqual ( 'some text\n\nmore text\n\n' ) ;
17+ } ) ;
18+ } ) ;
You canβt perform that action at this time.
0 commit comments