diff --git a/lib/fileprocessor.js b/lib/fileprocessor.js index 00fff6b..46edb7e 100644 --- a/lib/fileprocessor.js +++ b/lib/fileprocessor.js @@ -73,7 +73,7 @@ var _defaultPatterns = { 'Update the HTML with the new image filenames for src links' ], [ - /<(?:img|source)[^\>]*[^\>\S]+srcset=['"]([^"'\s]+)(?:\s\d[mx])["']/gm, + /<(?:img|source)[^\>]*[^\>\S]+srcset=['"]([^"'\s]+)\s*?(?:\s\d*?[w])?(?:\s\d*?[x])?\s*?["']/gm, 'Update the HTML with the new image filenames for srcset links' ], [ diff --git a/test/test-fileprocessor.js b/test/test-fileprocessor.js index f6d3a8d..e948757 100644 --- a/test/test-fileprocessor.js +++ b/test/test-fileprocessor.js @@ -429,15 +429,53 @@ describe('FileProcessor', function () { }); it('should replace img reference in srcset', function () { + var content = ''; + var replaced = fp.replaceWithRevved(content, ['app']); + assert.equal(replaced, ''); + }); + + it('should replace img reference in srcset with pixel density descriptor', function () { var content = ''; var replaced = fp.replaceWithRevved(content, ['app']); assert.equal(replaced, ''); + }); - content = ''; - replaced = fp.replaceWithRevved(content, ['app']); + it('should replace img reference in srcset with width descriptor', function () { + var content = ''; + var replaced = fp.replaceWithRevved(content, ['app']); + assert.equal(replaced, ''); + }); + + it('should replace img reference in srcset with pixel density descriptor and with width descriptor', function () { + var content = ''; + var replaced = fp.replaceWithRevved(content, ['app']); + assert.equal(replaced, ''); + }); + + it('should replace source reference in srcset', function () { + var content = ''; + var replaced = fp.replaceWithRevved(content, ['app']); + assert.equal(replaced, ''); + }); + + it('should replace source reference in srcset with pixel density descriptor', function () { + var content = ''; + var replaced = fp.replaceWithRevved(content, ['app']); assert.equal(replaced, ''); }); + it('should replace source reference in srcset with width descriptor', function () { + var content = ''; + var replaced = fp.replaceWithRevved(content, ['app']); + assert.equal(replaced, ''); + }); + + it('should replace source reference in srcset with pixel density descriptor and with width descriptor', function () { + var content = ''; + var replaced = fp.replaceWithRevved(content, ['app']); + assert.equal(replaced, ''); + }); + it('should replace svg src reference with revved version for img tag', function () { var content = ''; var replaced = fp.replaceWithRevved(content, ['app']);