@adobe/helix-importer 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/utils/DOMUtils.js +1 -1
- package/test/utils/DOMUtils.spec.js +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.6.0](https://github.com/adobe/helix-importer/compare/v1.5.0...v1.6.0) (2022-02-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* trigger release ([43154bc](https://github.com/adobe/helix-importer/commit/43154bc2f093868324f66d431b71eea5083543bb))
|
|
7
|
+
|
|
1
8
|
# [1.5.0](https://github.com/adobe/helix-importer/compare/v1.4.1...v1.5.0) (2022-02-24)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/utils/DOMUtils.js
CHANGED
|
@@ -241,7 +241,7 @@ export default class DOMUtils {
|
|
|
241
241
|
|
|
242
242
|
static getImgFromBackground(element, document) {
|
|
243
243
|
const url = element?.style?.['background-image'];
|
|
244
|
-
if (url) {
|
|
244
|
+
if (url && url.toLowerCase() !== 'none') {
|
|
245
245
|
const src = url.replace(/url\(/gm, '').replace(/'/gm, '').replace(/\)/gm, '');
|
|
246
246
|
const img = document.createElement('img');
|
|
247
247
|
img.src = src;
|
|
@@ -350,6 +350,8 @@ describe('DOMUtils#replaceBackgroundByImg', () => {
|
|
|
350
350
|
test(createElement('p', {}, {}, 'Some content'), '<p>Some content</p>');
|
|
351
351
|
|
|
352
352
|
test(createElement('img', { src: 'https://www.server.com/image.jpg', title: 'Some title' }, {}, ''), '<img src="https://www.server.com/image.jpg" title="Some title">');
|
|
353
|
+
|
|
354
|
+
test(createElement('p', {}, { 'background-image': 'none' }, 'Some content'), '<p style="background-image: none;">Some content</p>');
|
|
353
355
|
});
|
|
354
356
|
|
|
355
357
|
it('with background-image style', () => {
|
|
@@ -370,6 +372,8 @@ describe('DOMUtils#getImgFromBackground', () => {
|
|
|
370
372
|
test(createElement('p', {}, {}, 'Some content'), null);
|
|
371
373
|
|
|
372
374
|
test(createElement('img', { src: 'https://www.server.com/image.jpg', title: 'Some title' }, {}, ''), null);
|
|
375
|
+
|
|
376
|
+
test(createElement('p', {}, { 'background-image': 'none' }, 'Some content'), null);
|
|
373
377
|
});
|
|
374
378
|
|
|
375
379
|
it('with background-image style', () => {
|