[ci] format
This commit is contained in:
parent
86635e035b
commit
ab3aa3099b
2 changed files with 8 additions and 8 deletions
|
@ -183,15 +183,15 @@ export async function renderComponent(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Component && (Component as any).isAstroComponentFactory) {
|
if (Component && (Component as any).isAstroComponentFactory) {
|
||||||
async function * renderAstroComponentInline(): AsyncGenerator<string, void, undefined> {
|
async function* renderAstroComponentInline(): AsyncGenerator<string, void, undefined> {
|
||||||
let iterable = await renderToIterable(result, Component as any, _props, slots);
|
let iterable = await renderToIterable(result, Component as any, _props, slots);
|
||||||
// If this component added any define:vars styles and the head has already been
|
// If this component added any define:vars styles and the head has already been
|
||||||
// sent out, we need to include those inline.
|
// sent out, we need to include those inline.
|
||||||
if(result.styles.size && alreadyHeadRenderedResults.has(result)) {
|
if (result.styles.size && alreadyHeadRenderedResults.has(result)) {
|
||||||
let styles = Array.from(result.styles);
|
let styles = Array.from(result.styles);
|
||||||
result.styles.clear();
|
result.styles.clear();
|
||||||
for(const style of styles) {
|
for (const style of styles) {
|
||||||
if('define:vars' in style.props) {
|
if ('define:vars' in style.props) {
|
||||||
// We only want to render the property value and not the full stylesheet
|
// We only want to render the property value and not the full stylesheet
|
||||||
// which is bundled in the head.
|
// which is bundled in the head.
|
||||||
style.children = '';
|
style.children = '';
|
||||||
|
@ -199,7 +199,7 @@ export async function renderComponent(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
yield * iterable;
|
yield* iterable;
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderAstroComponentInline();
|
return renderAstroComponentInline();
|
||||||
|
|
|
@ -36,9 +36,9 @@ describe('Directives', async () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
const scopedTitleClass = $('.title')
|
const scopedTitleClass = $('.title')
|
||||||
.attr('class')
|
.attr('class')
|
||||||
.split(' ')
|
.split(' ')
|
||||||
.find((name) => /^astro-[A-Za-z0-9-]+/.test(name));
|
.find((name) => /^astro-[A-Za-z0-9-]+/.test(name));
|
||||||
|
|
||||||
expect($($('style').get(1)).toString().replace(/\s+/g, '')).to.equal(
|
expect($($('style').get(1)).toString().replace(/\s+/g, '')).to.equal(
|
||||||
`<style>.${scopedTitleClass}{--textColor:red;}</style>`
|
`<style>.${scopedTitleClass}{--textColor:red;}</style>`
|
||||||
|
|
Loading…
Add table
Reference in a new issue