Skip to content

Commit

Permalink
feat: support webp format (#343)
Browse files Browse the repository at this point in the history
add the `webp` property to the `mimes` object

re #326
  • Loading branch information
bubkoo authored Dec 5, 2022
1 parent d9971a7 commit 09d4810
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/mimes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const mimes: { [key: string]: string } = {
gif: 'image/gif',
tiff: 'image/tiff',
svg: 'image/svg+xml',
webp: 'image/webp',
}

function getExtension(url: string): string {
Expand Down
Binary file added test/resources/webp/image.webp
Binary file not shown.
3 changes: 3 additions & 0 deletions test/resources/webp/node.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
<img src="/base/test/resources/webp/image.webp" />
</div>
5 changes: 5 additions & 0 deletions test/resources/webp/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#dom-node {
width: 300px;
height: 300px;
background-color: white;
}
8 changes: 8 additions & 0 deletions test/spec/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ describe('basic usage', () => {
.catch(done)
})

it('should render webp images', (done) => {
bootstrap('webp/node.html', 'webp/style.css')
.then(delay(500))
.then(assertTextRendered(['PNG']))
.then(done)
.catch(done)
})

it('should render background images', (done) => {
bootstrap('css-bg/node.html', 'css-bg/style.css')
.then(assertTextRendered(['JPG']))
Expand Down

0 comments on commit 09d4810

Please sign in to comment.