summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_filetype.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/test_filetype.vim')
-rw-r--r--src/testdir/test_filetype.vim41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index 2a9e6b4580..379f6a1fa0 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -334,7 +334,8 @@ def s:GetFilenameChecks(): dict<list<string>>
hoon: ['file.hoon'],
hostconf: ['/etc/host.conf', 'any/etc/host.conf'],
hostsaccess: ['/etc/hosts.allow', '/etc/hosts.deny', 'any/etc/hosts.allow', 'any/etc/hosts.deny'],
- html: ['file.html', 'file.htm', 'file.cshtml', 'file.component.html'],
+ html: ['file.html', 'file.htm', 'file.cshtml'],
+ htmlangular: ['file.component.html'],
htmlm4: ['file.html.m4'],
httest: ['file.htt', 'file.htb'],
hurl: ['file.hurl'],
@@ -1046,7 +1047,8 @@ func Test_emptybuf_ftdetect()
call assert_equal('', &filetype)
filetype detect
call assert_equal('sh', &filetype)
- close!
+ " close the swapfile
+ bw!
endfunc
" Test for ':filetype indent on' and ':filetype indent off' commands
@@ -1570,6 +1572,41 @@ func Test_hook_file()
filetype off
endfunc
+func Test_html_file()
+ filetype on
+
+ " HTML Angular
+ let content = ['@for (item of items; track item.name) {', ' <li> {{ item.name }}</li>', '} @empty {', ' <li> There are no items.</li>', '}']
+ call writefile(content, 'Xfile.html', 'D')
+ split Xfile.html
+ call assert_equal('htmlangular', &filetype)
+ bwipe!
+
+ " Django Template
+ let content = ['{% if foobar %}',
+ \ ' <ul>',
+ \ ' {% for question in list %}',
+ \ ' <li><a href="/polls/{{ question.id }}/">{{ question.question_text }}</a></li>',
+ \ ' {% endfor %}',
+ \ ' </ul>',
+ \ '{% else %}',
+ \ ' <p>No polls are available.</p>',
+ \ '{% endif %}']
+ call writefile(content, 'Xfile.html', 'D')
+ split Xfile.html
+ call assert_equal('htmldjango', &filetype)
+ bwipe!
+
+ " regular HTML
+ let content = ['<!DOCTYPE html>', '<html>', ' <head>Foobar</head>', ' <body>Content', ' </body>', '</html>']
+ call writefile(content, 'Xfile.html', 'D')
+ split Xfile.html
+ call assert_equal('html', &filetype)
+ bwipe!
+
+ filetype off
+endfunc
+
func Test_m_file()
filetype on