Fix self-closing style tags in vue (#4108)

This commit is contained in:
Lucas Duailibe authored and GitHub committed 2018-03-06 13:06:09 -03:00
commit f6f6f2e2ea
3 files changed
+36 -1

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ const hardline = docBuilders.hardline;
function embed(path, print, textToDoc, options) {
const node = path.getValue();
const parent = path.getParentNode();
if (!parent || parent.tag !== "root") {
if (!parent || parent.tag !== "root" || node.unary) {
return null;
}
@@ -340,6 +340,36 @@ foo();
`;
exports[`self_closing_style.vue 1`] = `
<template>
<span :class="$style.root"><slot /></span>
</template>
<style src="./style.css" module />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<template>
<span :class="$style.root"><slot /></span>
</template>
<style src="./style.css" module />
`;
exports[`self_closing_style.vue 2`] = `
<template>
<span :class="$style.root"><slot /></span>
</template>
<style src="./style.css" module />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<template>
<span :class="$style.root"><slot /></span>
</template>
<style src="./style.css" module />
`;
exports[`test.vue 1`] = `
<script>
</script>
@@ -0,0 +1,5 @@
<template>
<span :class="$style.root"><slot /></span>
</template>
<style src="./style.css" module />