diff --git a/src/generators/dom/visitors/Element/Element.ts b/src/generators/dom/visitors/Element/Element.ts index 114482f649..49eeab2bef 100644 --- a/src/generators/dom/visitors/Element/Element.ts +++ b/src/generators/dom/visitors/Element/Element.ts @@ -102,7 +102,7 @@ export default function visitElement( if (node._cssRefAttribute) { block.builders.hydrate.addLine( - `@setAttribute(${name}, "svelte-ref-${node._cssRefAttribute}", ");` + `@setAttribute(${name}, "svelte-ref-${node._cssRefAttribute}", "");` ) } } diff --git a/test/css/index.js b/test/css/index.js index 5832c4070c..65867b294a 100644 --- a/test/css/index.js +++ b/test/css/index.js @@ -1,6 +1,7 @@ import assert from 'assert'; import * as fs from 'fs'; -import { env, normalizeHtml, svelte } from '../helpers.js'; +import { parse } from 'acorn'; +import { addLineNumbers, env, normalizeHtml, svelte } from '../helpers.js'; function tryRequire(file) { try { @@ -22,6 +23,15 @@ function normalizeWarning(warning) { return warning; } +function checkCodeIsValid(code) { + try { + parse(code); + } catch (err) { + console.error(addLineNumbers(code)); + throw new Error(err.message); + } +} + describe('css', () => { fs.readdirSync('test/css/samples').forEach(dir => { if (dir[0] === '.') return; @@ -67,6 +77,10 @@ describe('css', () => { }) ); + // check the code is valid + checkCodeIsValid(dom.code); + checkCodeIsValid(ssr.code); + assert.equal(dom.css, ssr.css); assert.deepEqual( diff --git a/test/validator/index.js b/test/validator/index.js index 1c718fae80..176d060faf 100644 --- a/test/validator/index.js +++ b/test/validator/index.js @@ -2,7 +2,7 @@ import * as fs from "fs"; import assert from "assert"; import { svelte, tryToLoadJson } from "../helpers.js"; -describe.only("validate", () => { +describe("validate", () => { fs.readdirSync("test/validator/samples").forEach(dir => { if (dir[0] === ".") return;