From f8aa228b2de1c0f7c2e6cb4ccbcc2245c5afe555 Mon Sep 17 00:00:00 2001 From: makmm Date: Sat, 6 Oct 2018 11:52:05 -0300 Subject: [PATCH] add as a valid element type to bundle in tags (w/ tests) (#2113) --- packages/core/parcel/src/assets/HTMLAsset.js | 2 +- packages/core/parcel/test/html.js | 17 +++++++++++++++++ .../test/integration/html-svg-image/file.svg | 3 +++ .../test/integration/html-svg-image/index.html | 4 ++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 packages/core/parcel/test/integration/html-svg-image/file.svg create mode 100644 packages/core/parcel/test/integration/html-svg-image/index.html diff --git a/packages/core/parcel/src/assets/HTMLAsset.js b/packages/core/parcel/src/assets/HTMLAsset.js index 0c655180b88..1e561c7436c 100644 --- a/packages/core/parcel/src/assets/HTMLAsset.js +++ b/packages/core/parcel/src/assets/HTMLAsset.js @@ -22,7 +22,7 @@ const ATTRS = { href: ['link', 'a', 'use'], srcset: ['img', 'source'], poster: ['video'], - 'xlink:href': ['use'], + 'xlink:href': ['use', 'image'], content: ['meta'], data: ['object'] }; diff --git a/packages/core/parcel/test/html.js b/packages/core/parcel/test/html.js index 90fac806d0d..aba09e19e87 100644 --- a/packages/core/parcel/test/html.js +++ b/packages/core/parcel/test/html.js @@ -608,6 +608,23 @@ describe('html', function() { }); }); + it('should bundle svg files using correctly', async function() { + let b = await bundle( + path.join(__dirname, '/integration/html-svg-image/index.html') + ); + + await assertBundleTree(b, { + name: 'index.html', + assets: ['index.html'], + childBundles: [ + { + type: 'svg', + assets: ['file.svg'] + } + ] + }); + }); + it('should support data attribute of object element', async function() { let b = await bundle( path.join(__dirname, '/integration/html-object/index.html') diff --git a/packages/core/parcel/test/integration/html-svg-image/file.svg b/packages/core/parcel/test/integration/html-svg-image/file.svg new file mode 100644 index 00000000000..5bf00e06842 --- /dev/null +++ b/packages/core/parcel/test/integration/html-svg-image/file.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/core/parcel/test/integration/html-svg-image/index.html b/packages/core/parcel/test/integration/html-svg-image/index.html new file mode 100644 index 00000000000..fd85d4253f0 --- /dev/null +++ b/packages/core/parcel/test/integration/html-svg-image/index.html @@ -0,0 +1,4 @@ + + + +