Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Migrate format tests to Scripts API (#3133)
- Loading branch information
1 parent
0364210
commit b188686
Showing
84 changed files
with
623 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<script setup lang="ts"> | ||
import { ref } from "vue"; | ||
const count = ref(0); | ||
</script> | ||
<template> | ||
<button @click="count++">{{ count }}</button> | ||
</template> | ||
`.trim(), | ||
settings: { | ||
'typescript.format.semicolons': 'insert' | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<template> | ||
<div v-for="i in list">{{ i }}</div> | ||
</template> | ||
`.trim(), | ||
settings: { | ||
'javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis': true | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<template> | ||
<div> | ||
<div> | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
export { } | ||
</script> | ||
<style> | ||
.foo { | ||
color: #000; | ||
} | ||
</style> | ||
`.trim(), | ||
output: ` | ||
<template> | ||
<div> | ||
<div> | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
export { } | ||
</script> | ||
<style> | ||
.foo { | ||
color: #000; | ||
} | ||
</style> | ||
`.trim(), | ||
settings: { | ||
'volar.format.initialIndent': { | ||
html: false, | ||
javascript: true, | ||
css: true | ||
} | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<script> | ||
function foo(params) { | ||
console.log('foo'); | ||
} | ||
</script> | ||
`.trim(), | ||
output: ` | ||
<script> | ||
function foo(params) { | ||
console.log('foo'); | ||
} | ||
</script> | ||
`.trim(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<template> | ||
<span :class="['class1','class2',{'class3':!modelValue}]">{{ | ||
$i18n('i18n-key')}}</span> | ||
</template> | ||
`.trim(), | ||
output: ` | ||
<template> | ||
<span :class="['class1', 'class2', { 'class3': !modelValue }]">{{ | ||
$i18n('i18n-key') }}</span> | ||
</template> | ||
`.trim(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<template></template> | ||
<style> | ||
a { | ||
background: v-bind(' props.background|| "var(--primary-lighter)"'); | ||
} | ||
</style> | ||
`.trim(), | ||
output: ` | ||
<template></template> | ||
<style> | ||
a { | ||
background: v-bind('props.background || "var(--primary-lighter)"'); | ||
} | ||
</style> | ||
`.trim(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<template> | ||
{{a?b:c}} | ||
</template> | ||
`.trim(), | ||
output: ` | ||
<template> | ||
{{ a ? b : c }} | ||
</template> | ||
`.trim(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<template> | ||
{{title}} | ||
</template> | ||
`.trim(), | ||
output: ` | ||
<template> | ||
{{ title }} | ||
</template> | ||
`.trim(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<script> | ||
export { } | ||
</script> | ||
`.trim().replace('\n', '\r\n'), // CRLF | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<template> | ||
<!-- hello --> | ||
<img alt="Vue logo" src="./assets/logo.png" /> | ||
<HelloWorld msg="Hello Vue 3 + TypeScript + Vite" /> | ||
</template> | ||
`.trim(), | ||
output: ` | ||
<template> | ||
<!-- hello --> | ||
<img alt="Vue logo" src="./assets/logo.png" /> | ||
<HelloWorld msg="Hello Vue 3 + TypeScript + Vite" /> | ||
</template> | ||
`.trim(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<template> | ||
<div> | ||
<div> | ||
</div> | ||
</div> | ||
</template> | ||
`.trim(), | ||
output: ` | ||
<template> | ||
<div> | ||
<div> | ||
</div> | ||
</div> | ||
</template> | ||
`.trim(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'typescript', | ||
input: ` export { };`, | ||
output: `export { };`, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { defineFormatTest } from '../utils/format'; | ||
|
||
defineFormatTest({ | ||
title: '#' + __filename.split('.')[0], | ||
languageId: 'vue', | ||
input: ` | ||
<script setup lang="ts"></script> | ||
<template> | ||
<!-- | ||
hey | ||
--> | ||
</template> | ||
`.trim(), | ||
}); |
Oops, something went wrong.