Skip to content

Commit 9b63e67

Browse files
committed
test: for issue #5
1 parent c586153 commit 9b63e67

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!doctype html>
2+
<html>
3+
<body>
4+
<picture><source type="image/webp" srcset="photo-lg.webp 1000w, photo-md.webp 500w, photo-sm.webp 250w, photo.webp"><img srcset="photo-lg.jpg 1000w, photo-md.jpg 500w, photo-sm.jpg 250w" src="photo.png"></picture>
5+
</body>
6+
</html>

test/fixtures/multisrcset.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!doctype html>
2+
<html>
3+
<body>
4+
<img srcset="photo-lg.jpg 1000w, photo-md.jpg 500w, photo-sm.jpg 250w" src="photo.png">
5+
</body>
6+
</html>

test/test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,17 @@ test('Default behaviour', (t) => {
2727
return compare(t, 'no-extension')
2828
})
2929

30+
test('Multi srcset', (t) => {
31+
return compare(t, 'multisrcset', {
32+
replaceExtension: true
33+
})
34+
})
35+
3036
function compare (t, name, options) {
3137
const html = readFileSync(path.join(fixtures, `${name}.html`), 'utf8')
3238
const expected = readFileSync(path.join(fixtures, `${name}.expected.html`), 'utf8')
3339

3440
return posthtml([plugin(options)])
3541
.process(html)
36-
.then((res) => t.truthy(res.html === expected))
42+
.then((res) => t.deepEqual(res.html, expected))
3743
}

0 commit comments

Comments
 (0)