Skip to content
This repository was archived by the owner on May 15, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/html2js.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var createHtml2JsPreprocessor = function(logger, basePath) {

var htmlPath = file.originalPath.replace(basePath + '/', '');

file.path = file.path + '.js';
file.path = file.originalPath + '.js';
done(util.format(TEMPLATE, htmlPath, escapeContent(content)));
};
};
Expand Down
15 changes: 15 additions & 0 deletions test/html2js.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ describe 'preprocessors html2js', ->
expect(file.path).to.equal '/base/path/file.html.js'
done()

it 'should change path to *.js only once', (done) ->
# Test case for bug where processing the same file
# twice results in the path changing to *.js.js .
# Multiple processing can occur when you edit the underlying
# .html file multiple times while using karma to proxy the
# files for your dev environment.
file = new File '/base/path/file.html'

process '', file, (processedContent) ->
expect(file.path).to.equal '/base/path/file.html.js'

process '', file, (processedContent) ->
expect(file.path).to.equal '/base/path/file.html.js'
done()


it 'should preserve new lines', (done) ->
file = new File '/base/path/file.html'
Expand Down