diff --git a/tests/filter-tests.js b/tests/filter-tests.js index 4fa5571..ac82f82 100644 --- a/tests/filter-tests.js +++ b/tests/filter-tests.js @@ -103,6 +103,20 @@ describe('broccoli-asset-rev', function() { }); }); + it.only('rewrites template literals with prepends correctly', function(){ + var sourcePath = 'tests/fixtures/template-literal'; + + var node = AssetRev(sourcePath + '/input', { + extensions: ['js', 'json', 'css', 'png', 'jpg', 'gif', 'map'], + prepend: 'https://static.assets.com/ember/' + }); + + builder = new broccoli.Builder(node); + return builder.build().then(function(graph) { + confirmOutput(graph.directory, sourcePath + '/output'); + }); + }); + it("doesn't fingerprint rails-style manifest if excluded", function () { var sourcePath = 'tests/fixtures/basic'; diff --git a/tests/fixtures/template-literal/input/assets/application.js b/tests/fixtures/template-literal/input/assets/application.js new file mode 100644 index 0000000..82bf8fb --- /dev/null +++ b/tests/fixtures/template-literal/input/assets/application.js @@ -0,0 +1,5 @@ +class Application { + foo() { + return bar(`${this.path}/application.js`); + } +} \ No newline at end of file diff --git a/tests/fixtures/template-literal/input/images/icons/favicon.png b/tests/fixtures/template-literal/input/images/icons/favicon.png new file mode 100644 index 0000000..3db835b Binary files /dev/null and b/tests/fixtures/template-literal/input/images/icons/favicon.png differ diff --git a/tests/fixtures/template-literal/input/images/sample.png b/tests/fixtures/template-literal/input/images/sample.png new file mode 100644 index 0000000..cdfaf5e Binary files /dev/null and b/tests/fixtures/template-literal/input/images/sample.png differ diff --git a/tests/fixtures/template-literal/input/index.html b/tests/fixtures/template-literal/input/index.html new file mode 100644 index 0000000..8713e94 --- /dev/null +++ b/tests/fixtures/template-literal/input/index.html @@ -0,0 +1,15 @@ + + + + + + Application + + + + + + + + + diff --git a/tests/fixtures/template-literal/input/styles.css b/tests/fixtures/template-literal/input/styles.css new file mode 100644 index 0000000..6b1dcc8 --- /dev/null +++ b/tests/fixtures/template-literal/input/styles.css @@ -0,0 +1,11 @@ +.sample-img { + width: 50px; + height: 50px; + background-image: url(images/sample.png); +} + +.sample-img2 { + width: 50px; + height: 50px; + background-image: url('images/sample.png'); +} diff --git a/tests/fixtures/template-literal/output/assets/application-974fd9b673bf8809fe7b5cf3898a6bbf.js b/tests/fixtures/template-literal/output/assets/application-974fd9b673bf8809fe7b5cf3898a6bbf.js new file mode 100644 index 0000000..1e162c8 --- /dev/null +++ b/tests/fixtures/template-literal/output/assets/application-974fd9b673bf8809fe7b5cf3898a6bbf.js @@ -0,0 +1,5 @@ +class Application { + foo() { + return bar(`https://static.intercomassets.com/ember/${this.path}/application-974fd9b673bf8809fe7b5cf3898a6bbf.js`); + } +} \ No newline at end of file diff --git a/tests/fixtures/template-literal/output/images/icons/favicon-9243e67fccd0c5e08a3d2c158af6500d.png b/tests/fixtures/template-literal/output/images/icons/favicon-9243e67fccd0c5e08a3d2c158af6500d.png new file mode 100644 index 0000000..3db835b Binary files /dev/null and b/tests/fixtures/template-literal/output/images/icons/favicon-9243e67fccd0c5e08a3d2c158af6500d.png differ diff --git a/tests/fixtures/template-literal/output/images/sample-1f6b78f1b4667adc7e397f7bf94041ab.png b/tests/fixtures/template-literal/output/images/sample-1f6b78f1b4667adc7e397f7bf94041ab.png new file mode 100644 index 0000000..cdfaf5e Binary files /dev/null and b/tests/fixtures/template-literal/output/images/sample-1f6b78f1b4667adc7e397f7bf94041ab.png differ diff --git a/tests/fixtures/template-literal/output/index.html b/tests/fixtures/template-literal/output/index.html new file mode 100644 index 0000000..3d5ef6f --- /dev/null +++ b/tests/fixtures/template-literal/output/index.html @@ -0,0 +1,15 @@ + + + + + + Application + + + + + + + + + diff --git a/tests/fixtures/template-literal/output/styles-65152d913114634ea19a82c7990d08f3.css b/tests/fixtures/template-literal/output/styles-65152d913114634ea19a82c7990d08f3.css new file mode 100644 index 0000000..a40610c --- /dev/null +++ b/tests/fixtures/template-literal/output/styles-65152d913114634ea19a82c7990d08f3.css @@ -0,0 +1,11 @@ +.sample-img { + width: 50px; + height: 50px; + background-image: url(images/sample-1f6b78f1b4667adc7e397f7bf94041ab.png); +} + +.sample-img2 { + width: 50px; + height: 50px; + background-image: url('images/sample-1f6b78f1b4667adc7e397f7bf94041ab.png'); +}