diff options
author | Filipe Kiss <hello@filipekiss.com.br> | 2018-08-22 18:37:39 -0300 |
---|---|---|
committer | Filipe Kiss <hello@filipekiss.com.br> | 2018-08-22 19:00:42 -0300 |
commit | b78ee188987f9a28a6ef0df08271f43133eeb238 (patch) | |
tree | 6c5123f435ab33ed59dc57b17fa82249a57b9d52 /test/command_callback | |
parent | 4cd20b821fd10a3b047d1ec9ff5647ce334381bf (diff) | |
download | ale-b78ee188987f9a28a6ef0df08271f43133eeb238.zip |
:umbrella: Add html stylelint test
Diffstat (limited to 'test/command_callback')
-rw-r--r-- | test/command_callback/test_html_stylelint_command_callback.vader | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/command_callback/test_html_stylelint_command_callback.vader b/test/command_callback/test_html_stylelint_command_callback.vader new file mode 100644 index 00000000..49d7d143 --- /dev/null +++ b/test/command_callback/test_html_stylelint_command_callback.vader @@ -0,0 +1,60 @@ +Before: + Save g:ale_html_stylelint_executable + Save g:ale_html_stylelint_use_global + Save g:ale_html_stylelint_options + + unlet! b:executable + + unlet! g:ale_html_stylelint_executable + unlet! g:ale_html_stylelint_use_global + unlet! g:ale_html_stylelint_options + + call ale#test#SetDirectory('/testplugin/test/command_callback') + call ale#test#SetFilename('testfile.html') + + runtime ale_linters/html/stylelint.vim + +After: + Restore + + unlet! b:executable + unlet! b:ale_html_stylelint_executable + unlet! b:ale_html_stylelint_use_global + unlet! b:ale_html_stylelint_options + + call ale#test#SetFilename('test.txt') + + call ale#test#RestoreDirectory() + call ale#linter#Reset() + +Execute(node_modules directories should be discovered): + call ale#test#SetFilename('stylelint_paths/nested/testfile.html') + + let b:executable = ale#path#Simplify( + \ g:dir + \ . '/stylelint_paths/node_modules/.bin/stylelint' + \) + + AssertEqual b:executable, ale_linters#html#stylelint#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape(b:executable) . ' --stdin-filename %s', + \ ale_linters#html#stylelint#GetCommand(bufnr('')) + +Execute(The global override should work): + let b:ale_html_stylelint_executable = 'foobar' + let b:ale_html_stylelint_use_global = 1 + + call ale#test#SetFilename('stylelint_paths/nested/testfile.html') + + AssertEqual 'foobar', ale_linters#html#stylelint#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape('foobar') . ' --stdin-filename %s', + \ ale_linters#html#stylelint#GetCommand(bufnr('')) + +Execute(Extra options should be configurable): + let b:ale_html_stylelint_options = '--whatever' + + AssertEqual 'stylelint', ale_linters#html#stylelint#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape('stylelint') . ' --whatever --stdin-filename %s', + \ ale_linters#html#stylelint#GetCommand(bufnr('')) |