Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function generateLayoutInternal(options, callback) {
if (
options.extractMetadata &&
options.format &&
(img.svg.includes('mapbox-stretch') || img.svg.includes('mapbox-text-placeholder'))
(img.svg.includes('mapbox-stretch') || img.svg.includes('mapbox-text-placeholder') || img.svg.includes('mapbox-content'))
) {
const metaOps = { svg: img.svg, pixelRatio: options.pixelRatio };
extractMetadata(metaOps, (err, metadataProps) => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions test/generate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,29 @@ test('generateLayout with both placeholder and stretch zone', function (t) {
t.end();
});
});

test('generateLayout with only content', function (t) {
var fixtures = [
{
id: 'au-national-route-5-only-content',
svg: fs.readFileSync('./test/fixture/svg-metadata/au-national-route-5-only-content.svg')
}
];
spritezero.generateLayout({ imgs: fixtures, pixelRatio: 1, format: true }, function (err, formatted) {
t.ifError(err);
t.deepEqual(
formatted,
{
'au-national-route-5-only-content': {
width: 38,
height: 20,
x: 0,
y: 0,
pixelRatio: 1,
content: [3, 7, 23, 18],
}
}
);
t.end();
});
});