summaryrefslogtreecommitdiff
path: root/test/fixers
diff options
context:
space:
mode:
authorPeter Renström <renstrom.peter@gmail.com>2017-09-06 16:21:26 +0200
committerw0rp <w0rp@users.noreply.github.com>2017-09-06 15:21:26 +0100
commit03f1c1e81bdf1fd41b535f6a0260d47ba1bf60dc (patch)
tree372ace207ef4b89d9b61b5d0d364dc3e01fd9dfb /test/fixers
parentc277cdef8cb24512583093d7a9b7d68a14e6d82b (diff)
downloadale-03f1c1e81bdf1fd41b535f6a0260d47ba1bf60dc.zip
Add 'prettier' fixer support to TypeScript, CSS, SCSS and JSON (#910)
* Add prettier fixer support for typescript * Add prettier fixer support for css and scss * Add prettier fixer support for json * Use getbufvar() to get &filetype
Diffstat (limited to 'test/fixers')
-rw-r--r--test/fixers/test_prettier_fixer_callback.vader60
1 files changed, 59 insertions, 1 deletions
diff --git a/test/fixers/test_prettier_fixer_callback.vader b/test/fixers/test_prettier_fixer_callback.vader
index 1eb24dae..a684ad02 100644
--- a/test/fixers/test_prettier_fixer_callback.vader
+++ b/test/fixers/test_prettier_fixer_callback.vader
@@ -24,6 +24,7 @@ Execute(The prettier callback should return the correct default values):
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' %t'
+ \ . ' --parser babylon'
\ . ' --write',
\ },
\ ale#fixers#prettier#Fix(bufnr(''))
@@ -37,6 +38,7 @@ Execute(The prettier callback should include configuration files when the option
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' %t'
+ \ . ' --parser babylon'
\ . ' --config ' . ale#Escape(simplify(g:dir . '/../prettier-test-files/with_config/.prettierrc'))
\ . ' --write',
\ },
@@ -51,8 +53,64 @@ Execute(The prettier callback should include custom prettier options):
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' %t'
- \ . ' --no-semi'
+ \ . ' --no-semi --parser babylon'
\ . ' --config ' . ale#Escape(simplify(g:dir . '/../prettier-test-files/with_config/.prettierrc'))
\ . ' --write',
\ },
\ ale#fixers#prettier#Fix(bufnr(''))
+
+Execute(Append '--parser typescript' for filetype=typescript):
+ set filetype=typescript
+ call ale#test#SetFilename('../prettier-test-files/testfile.ts')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
+ \ . ' %t'
+ \ . ' --parser typescript'
+ \ . ' --write',
+ \ },
+ \ ale#fixers#prettier#Fix(bufnr(''))
+
+Execute(Append '--parser json' for filetype=json):
+ set filetype=json
+ call ale#test#SetFilename('../prettier-test-files/testfile.json')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
+ \ . ' %t'
+ \ . ' --parser json'
+ \ . ' --write',
+ \ },
+ \ ale#fixers#prettier#Fix(bufnr(''))
+
+Execute(Append '--parser postcss' for filetype=scss):
+ set filetype=scss
+ call ale#test#SetFilename('../prettier-test-files/testfile.scss')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
+ \ . ' %t'
+ \ . ' --parser postcss'
+ \ . ' --write',
+ \ },
+ \ ale#fixers#prettier#Fix(bufnr(''))
+
+Execute(Append '--parser postcss' for filetype=css):
+ set filetype=css
+ call ale#test#SetFilename('../prettier-test-files/testfile.css')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape(g:ale_javascript_prettier_executable)
+ \ . ' %t'
+ \ . ' --parser postcss'
+ \ . ' --write',
+ \ },
+ \ ale#fixers#prettier#Fix(bufnr(''))