require 'spec_helper' describe "html" do let(:filename) { 'test.html' } after :each do vim.command('silent! unlet g:splitjoin_html_attributes_bracket_on_new_line') vim.command('silent! unlet g:splitjoin_html_attributes_hanging') end def simple_test(joined_html, split_html) set_file_contents joined_html split remove_indentation assert_file_contents split_html vim.normal 'gg' join remove_indentation assert_file_contents joined_html end specify "tags in other content" do set_file_contents 'One
Two
Three' vim.search 'div' split remove_indentation assert_file_contents <<~EOF One
Two
Three EOF vim.search 'div' join remove_indentation assert_file_contents 'One
Two
Three' end specify "tags" do joined_html = '
bar
' split_html = <<~EOF
bar
EOF simple_test(joined_html, split_html) end specify "attributes" do joined_html = '
' split_html = <<~EOF
EOF simple_test(joined_html, split_html) end specify "attributes in self-closing tags" do joined_html = '
' split_html = <<~EOF
EOF simple_test(joined_html, split_html) end specify "attributes in self-closing tags with bracket on new line" do vim.command('let g:splitjoin_html_attributes_bracket_on_new_line = 1') joined_html = '
' split_html = <<~EOF
EOF simple_test(joined_html, split_html) end specify "attributes with bracket on new line" do vim.command('let g:splitjoin_html_attributes_bracket_on_new_line = 1') joined_html = <<~EOF
EOF split_html = <<~EOF
EOF simple_test(joined_html, split_html) end specify "hanging attributes" do vim.command('let g:splitjoin_html_attributes_hanging = 1') joined_html = <<~EOF EOF split_html = <<~EOF EOF simple_test(joined_html, split_html) end specify "brackets within strings" do joined_html = <<~EOF