0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
bluwy 2023-07-03 08:01:57 +00:00 committed by astrobot-houston
parent cdc28326cf
commit 3df71fd34f
2 changed files with 6 additions and 2 deletions

View file

@ -92,7 +92,9 @@ Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the
// support object styles for better JSX compat // support object styles for better JSX compat
if (key === 'style' && !(value instanceof HTMLString)) { if (key === 'style' && !(value instanceof HTMLString)) {
if (Array.isArray(value) && value.length === 2) { if (Array.isArray(value) && value.length === 2) {
return markHTMLString(` ${key}="${toAttributeString(`${toStyleString(value[0])};${value[1]}`, shouldEscape)}"`); return markHTMLString(
` ${key}="${toAttributeString(`${toStyleString(value[0])};${value[1]}`, shouldEscape)}"`
);
} }
if (typeof value === 'object') { if (typeof value === 'object') {
return markHTMLString(` ${key}="${toAttributeString(toStyleString(value), shouldEscape)}"`); return markHTMLString(` ${key}="${toAttributeString(toStyleString(value), shouldEscape)}"`);

View file

@ -61,7 +61,9 @@ describe('Directives', async () => {
expect($('style')).to.have.lengthOf(0); expect($('style')).to.have.lengthOf(0);
// Inject style attribute on top-level element in page // Inject style attribute on top-level element in page
expect($('#compound-style').attr('style').toString()).to.include('color:var(--fg);--fg: black;--bg: white;'); expect($('#compound-style').attr('style').toString()).to.include(
'color:var(--fg);--fg: black;--bg: white;'
);
}); });
it('set:html', async () => { it('set:html', async () => {