Skip to content

Commit

Permalink
Add regression test for #901
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Jul 15, 2018
1 parent 67549eb commit b6451ad
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/transforms/subsetFonts.js
Expand Up @@ -2810,6 +2810,24 @@ describe('transforms/subsetFonts', function() {
});
});

it('should not break when the original @font-face declarations have unicode-range and the first source does not include the characters we need', async function() {
httpception();

const assetGraph = new AssetGraph({
root: pathModule.resolve(
__dirname,
'../../testdata/transforms/subsetFonts/woff2-original/'
)
});
await assetGraph.loadAssets('index.html');
await assetGraph.populate({
followRelations: {
crossorigin: false
}
});
await assetGraph.subsetFonts();
});

it('should emit a warning when subsetting invalid fonts', function() {
httpception();

Expand Down
Binary file not shown.
Binary file not shown.
34 changes: 34 additions & 0 deletions testdata/transforms/subsetFonts/woff2-original/index.html
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html><head>
<style>
/* latin-ext */
@font-face {
font-family: 'Roboto Slab';
font-style: normal;
font-weight: 300;
src: local('Roboto Slab Light'), local('RobotoSlab-Light'),
url(BngRUXZYTXPIvIBgJJSb6u9mxLCIwR2oefDofMY.woff2)
format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto Slab';
font-style: normal;
font-weight: 300;
src: local('Roboto Slab Light'), local('RobotoSlab-Light'),
url(BngRUXZYTXPIvIBgJJSb6u9mxLCGwR2oefDo.woff2)
format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}
* {
font-family: Roboto Slab;
}
</style>
</head>
<body>
<p>Hello, world!</p>
</body></html>

0 comments on commit b6451ad

Please sign in to comment.