mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 17:30:59 +01:00
Merge pull request #1954 from sveltejs/gh-1873
preserve attributes during preprocess
This commit is contained in:
commit
09b21fdba3
@ -60,7 +60,7 @@ export default async function preprocess(
|
||||
attributes: parseAttributes(attributes),
|
||||
filename: options.filename,
|
||||
}));
|
||||
return processed ? `<${type}>${processed.code}</${type}>` : match;
|
||||
return processed ? `<${type}${attributes}>${processed.code}</${type}>` : match;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -151,6 +151,10 @@ describe('preprocess', () => {
|
||||
<style type='text/scss' data-foo="bar" bool></style>
|
||||
`;
|
||||
|
||||
const expected = `
|
||||
<style type='text/scss' data-foo="bar" bool>PROCESSED</style>
|
||||
`;
|
||||
|
||||
return svelte.preprocess(source, {
|
||||
style: ({ attributes }) => {
|
||||
assert.deepEqual(attributes, {
|
||||
@ -158,7 +162,10 @@ describe('preprocess', () => {
|
||||
'data-foo': 'bar',
|
||||
bool: true
|
||||
});
|
||||
return { code: 'PROCESSED' };
|
||||
}
|
||||
}).then(processed => {
|
||||
assert.equal(processed.toString(), expected);
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user