{{ message }}
+{{ message.toUpperCase() }}
+{{ greeting }}
+ + + + + diff --git a/test/cases/context.vim b/test/cases/context.vim new file mode 100644 index 0000000..4257389 --- /dev/null +++ b/test/cases/context.vim @@ -0,0 +1,27 @@ +" OnChangeVueSyntax() is called when syntax under cursor changes. It's +" defined before the plugin is loaded +let g:vim_vue_plugin_config = { + \'syntax': { + \ 'template': ['html'], + \ 'script': ['javascript', 'typescript'], + \ 'style': ['css', 'scss'], + \}, + \} +let g:test_changes = [] + +function! OnChangeVueSyntax(syntax) + call add(g:test_changes, a:syntax) +endfunction + +function! Check() + for lnum in [2, 3, 6, 6, 10, 2] + call cursor(lnum, 1) + doautocmd CursorMoved + endfor + call ExpectEqual(g:test_changes, ['html', 'typescript', 'scss', 'html'], + \ 'syntax changes') + call ExpectEqual(GetVueSyntax(), 'html', 'GetVueSyntax()') + call ExpectTag(6, 'script') + call ExpectTag(10, 'style') +endfunction +let g:test_flatten = 1 diff --git a/test/cases/context.vue b/test/cases/context.vue new file mode 100644 index 0000000..08d2b42 --- /dev/null +++ b/test/cases/context.vue @@ -0,0 +1,11 @@ + + + + + + + diff --git a/test/cases/example.vim b/test/cases/example.vim new file mode 100644 index 0000000..f6edbd6 --- /dev/null +++ b/test/cases/example.vim @@ -0,0 +1,40 @@ +" Uses syntax plugins in test/deps +let g:vim_vue_plugin_config = { + \'syntax': { + \ 'template': ['html', 'pug'], + \ 'script': ['javascript', 'typescript', 'coffee'], + \ 'style': ['css', 'scss', 'sass', 'less', 'stylus'], + \ 'docs': 'markdown', + \ 'i18n': ['json', 'yaml'], + \ 'route': 'json', + \}, + \'attribute': 1, + \'keyword': 1, + \'foldexpr': 1, + \'full_syntax': ['scss', 'less'], + \} + +" Block tag, syntax by lang="..." or the first in config, and block group +" with css prefix for emmet-vim +function! Check() + call ExpectBlock('div.set', 'template', 'pug', 'pugTemplateBlock') + call ExpectBlock('', 'template', 'html', 'htmlTemplateBlock') + call ExpectBlock('export default', 'script', 'javascript', 'javascriptScriptBlock') + call ExpectBlock('import Vue', 'script', 'typescript', 'typescriptScriptBlock') + call ExpectBlock('# Assignment', 'script', 'coffee', 'coffeeScriptBlock') + call ExpectBlock('p {', 'style', 'css', 'cssStyleBlock') + call ExpectBlock('$a: 100px', 'style', 'scss', 'cssScssStyleBlock') + call ExpectBlock('$w: 128px', 'style', 'sass', 'sassStyleBlock') + call ExpectBlock('@list: 10 12', 'style', 'less', 'cssLessStyleBlock') + call ExpectBlock("@import 'vendor'", 'style', 'stylus', 'cssStylusStyleBlock') + call ExpectBlock('"requiresAuth"', 'route', 'json', 'jsonRouteBlock') + call ExpectBlock('# This is', 'docs', 'markdown', 'markdownDocsBlock') + call ExpectBlock('en:', 'i18n', 'yaml', 'yamlI18nBlock') + call ExpectBlock('"en"', 'i18n', 'json', 'jsonI18nBlock') + + " Syntax from a sync point, as after jumping to the end + silent edit! + normal! G + call search('"en"', 'bW') + call ExpectEqual(GetVueSyntax(), 'json', 'syntax at the end after reload') +endfunction diff --git a/test/cases/example.vue b/test/cases/example.vue new file mode 100644 index 0000000..fce9e3e --- /dev/null +++ b/test/cases/example.vue @@ -0,0 +1,160 @@ + + div.set + span(id="123") + + + + + + + + +{{ greeting }}
+ + + + + + + + + + + + + + + + + + +{{ greeting }}
+ + + + + diff --git a/test/cases/indent.vim b/test/cases/indent.vim new file mode 100644 index 0000000..5caa8f8 --- /dev/null +++ b/test/cases/indent.vim @@ -0,0 +1,10 @@ +let g:vim_vue_plugin_config = { + \'syntax': { + \ 'template': ['html'], + \ 'script': ['javascript'], + \ 'style': ['css', 'sass', 'scss'], + \ 'codepen-additional': ['javascript', 'json'], + \}, + \'initial_indent': ['script', 'style', 'codepen-additional'], + \} +let g:test_flatten = 1 diff --git a/test/cases/indent.vue b/test/cases/indent.vue new file mode 100644 index 0000000..52a4b8e --- /dev/null +++ b/test/cases/indent.vue @@ -0,0 +1,27 @@ + +{{ greeting }}
+ + + + + + +