This repository was archived by the owner on Sep 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ BASIC TEMPLATE
Original file line number Diff line number Diff line change @@ -128,5 +128,34 @@ describe('gulp-handlebars', function() {
128128 hbsStream . write ( basicTemplate ) ;
129129 hbsStream . end ( ) ;
130130 } ) ;
131+
132+ it ( 'should allow custom compiler' , function ( done ) {
133+ var compiler = function ( contents , compilerOptions ) {
134+ return contents . toUpperCase ( ) ;
135+ } ;
136+ var stream = handlebarsPlugin ( {
137+ compiler : compiler
138+ } ) ;
139+ var basicTemplate = getFixture ( 'Basic.hbs' ) ;
140+
141+ stream . on ( 'data' , function ( newFile ) {
142+ should . exist ( newFile ) ;
143+ should . exist ( newFile . contents ) ;
144+
145+ // @TODO : it should call `fileMatchesExpected` function
146+ // But I got an error of expected: "BASIC TEMPLATE\n", actual: "BASIC TEMPLATE"
147+ // so that I manually adding the newLine character.
148+ // I think it related to plain text in the 'Basic_htmlbars.js'
149+ var expected = getExpectedString ( 'Basic_htmlbars.js' ) ;
150+ var tested = String ( newFile . contents ) + '\n' ;
151+ tested . should . equal ( expected ) ;
152+ // fileMatchesExpected(newFile, 'Basic_htmlbars.js', 'Basic.js');
153+
154+ done ( ) ;
155+ } ) ;
156+ stream . write ( basicTemplate ) ;
157+ stream . end ( ) ;
158+ } ) ;
159+
131160 } ) ;
132161} ) ;
You can’t perform that action at this time.
0 commit comments