A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue/commit/bf0efb02b1f52cceb0bad8588cf6c90e22349049 below:

false in vue-template-compiler (#7215) · vuejs/vue@bf0efb0 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+31

-1

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+31

-1

lines changed Original file line number Diff line number Diff line change

@@ -83,7 +83,10 @@ export function parseComponent (

83 83

function end (tag: string, start: number) {

84 84

if (depth === 1 && currentBlock) {

85 85

currentBlock.end = start

86 -

let text = deindent(content.slice(currentBlock.start, currentBlock.end))

86 +

let text = content.slice(currentBlock.start, currentBlock.end)

87 +

if (options.deindent !== false) {

88 +

text = deindent(text)

89 +

}

87 90

// pad content so that linters and pre-processors can output correct

88 91

// line numbers in errors and warnings

89 92

if (currentBlock.type !== 'template' && options.pad) {

Original file line number Diff line number Diff line change

@@ -55,6 +55,33 @@ describe('Single File Component parser', () => {

55 55

expect(res.template.content.trim()).toBe('<div><template v-if="ok">hi</template></div>')

56 56

})

57 57 58 +

it('deindent content', () => {

59 +

const content = `

60 +

<template>

61 +

<div></div>

62 +

</template>

63 +

<script>

64 +

export default {}

65 +

</script>

66 +

<style>

67 +

h1 { color: red }

68 +

</style>

69 +

`

70 +

const deindentDefault = parseComponent(content.trim(), { pad: false })

71 +

const deindentEnabled = parseComponent(content.trim(), { pad: false, deindent: true })

72 +

const deindentDisabled = parseComponent(content.trim(), { pad: false, deindent: false })

73 + 74 +

expect(deindentDefault.template.content).toBe('\n<div></div>\n')

75 +

expect(deindentDefault.script.content).toBe('\nexport default {}\n')

76 +

expect(deindentDefault.styles[0].content).toBe('\nh1 { color: red }\n')

77 +

expect(deindentEnabled.template.content).toBe('\n<div></div>\n')

78 +

expect(deindentEnabled.script.content).toBe('\nexport default {}\n')

79 +

expect(deindentEnabled.styles[0].content).toBe('\nh1 { color: red }\n')

80 +

expect(deindentDisabled.template.content).toBe('\n <div></div>\n ')

81 +

expect(deindentDisabled.script.content).toBe('\n export default {}\n ')

82 +

expect(deindentDisabled.styles[0].content).toBe('\n h1 { color: red }\n ')

83 +

})

84 + 58 85

it('pad content', () => {

59 86

const content = `

60 87

<template>

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4