Describe html
Describe expand abbreviation
It expands div
Assert Equals(ExpandWord('div', 'html'), "
\n")
End
It expands div with id
Assert Equals(ExpandWord('div#wrapper', 'html'), "\n")
End
It expands div with class
Assert Equals(ExpandWord('div.box', 'html'), "\n")
End
It expands a with title attribute
Assert Equals(ExpandWord('a[title=TITLE]', 'html'), "\n")
End
It expands div with id and class
Assert Equals(ExpandWord('div#wrapper.box', 'html'), "\n")
End
It expands div with id and multiple classes
Assert Equals(ExpandWord('div#wrapper.box.current', 'html'), "\n")
End
It expands div with id, classes and attributes
Assert Equals(ExpandWord('div#wrapper.box.current[title=TITLE rel]', 'html'), "\n")
End
It expands sibling divs
Assert Equals(ExpandWord('div#main+div#sub', 'html'), "\n\n")
End
It expands child div
Assert Equals(ExpandWord('div#main>div#sub', 'html'), "
\n\t\n
\n")
End
It expands html:xt complex
Assert Equals(ExpandWord('html:xt>div#header>div#logo+ul#nav>li.item-$*5>a', 'html'), "\n\n\n\t\n\t\n\n\n\t
\n\t\t\n\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t
\n\t
\n\t\n\n")
End
It expands ol with li multiplier
Assert Equals(ExpandWord('ol>li*2', 'html'), "\n\t\n\t\n\n")
End
It expands a with default attribute
Assert Equals(ExpandWord('a', 'html'), "\n")
End
It expands obj alias
Assert Equals(ExpandWord('obj', 'html'), "\n")
End
It expands cc:ie6 complex
Assert Equals(ExpandWord('cc:ie6>p+blockquote#sample$.so.many.classes*2', 'html'), "")
End
It expands html:4t complex
Assert Equals(ExpandWord('html:4t>div#wrapper>div#header+div#contents+div#footer', 'html'), "\n\n\n\t\n\t\n\n\n\t
\n\t\t\n\t\t\n\t\t\n\t
\n\t\n\n")
End
It expands a with href, class and id
Assert Equals(ExpandWord('a[href=http://www.google.com/].foo#hoge', 'html'), "\n")
End
It expands a with href and text
Assert Equals(ExpandWord('a[href=http://www.google.com/]{Google}', 'html'), "Google\n")
End
It expands text only
Assert Equals(ExpandWord('{Emmet}', 'html'), 'Emmet')
End
It expands a+b
Assert Equals(ExpandWord('a+b', 'html'), "\n\n")
End
It climbs up with <
Assert Equals(ExpandWord('a>b>i\n")
End
It climbs up with ^
Assert Equals(ExpandWord('a>b>i^b', 'html'), "\n")
End
It climbs up double with <<
Assert Equals(ExpandWord('a>b>i<\n\n")
End
It climbs up double with ^^
Assert Equals(ExpandWord('a>b>i^^b', 'html'), "\n\n")
End
It climbs up blockquote with <<
Assert Equals(ExpandWord('blockquote>b>i<\n\t\n\n\n")
End
It climbs up blockquote with ^^
Assert Equals(ExpandWord('blockquote>b>i^^b', 'html'), "
\n\t\n
\n\n")
End
It expands multiple attributes
Assert Equals(ExpandWord('a[href=foo][class=bar]', 'html'), "\n")
End
It expands complex attrs with multiplier
Assert Equals(ExpandWord('a[a=b][b=c=d][e]{foo}*2', 'html'), "foo\nfoo\n")
End
It expands attrs multiplier text after
Assert Equals(ExpandWord('a[a=b][b=c=d][e]*2{foo}', 'html'), "\n\nfoo")
End
It expands multiplier text tag
Assert Equals(ExpandWord('a*2{foo}a', 'html'), "\n\nfoo\n")
End
It expands text multiplier child
Assert Equals(ExpandWord('a{foo}*2>b', 'html'), "foo\nfoo\n")
End
It expands multiplier text child
Assert Equals(ExpandWord('a*2{foo}>b', 'html'), "\n\nfoo")
End
It expands table complex
Assert Equals(ExpandWord('table>tr>td.name#foo+td*3', 'html'), "
\n\t
\n\t\t
\n\t\t
\n\t\t
\n\t\t
\n\t
\n
\n")
End
It expands sibling ids
Assert Equals(ExpandWord('div#header+div#footer', 'html'), "\n\n")
End
It expands implicit div sibling
Assert Equals(ExpandWord('#header+div#footer', 'html'), "\n\n")
End
It climbs up with text using <
Assert Equals(ExpandWord('#header>ul>li
\n\t
\n\t\t\n\t
\n\t
Footer
\n\n")
End
It climbs up with text using ^
Assert Equals(ExpandWord('#header>ul>li^p{Footer}', 'html'), "
\n\t
\n\t\t\n\t
\n\t
Footer
\n
\n")
End
It expands dollar padding
Assert Equals(ExpandWord('a#foo$$$*3', 'html'), "\n\n\n")
End
It expands ul expando
Assert Equals(ExpandWord('ul+', 'html'), "
\n\t\n
\n")
End
It expands table expando
Assert Equals(ExpandWord('table+', 'html'), "
\n\t
\n\t\t
\n\t
\n
\n")
End
It climbs header to content with <
Assert Equals(ExpandWord('#header>li<#content', 'html'), "
\n\t\n
\n\n")
End
It climbs header to content with ^
Assert Equals(ExpandWord('#header>li^#content', 'html'), "
\n\t\n
\n\n")
End
It climbs group with <
Assert Equals(ExpandWord('(#header>li)<#content', 'html'), "
\n\t\n
\n\n")
End
It climbs group with ^
Assert Equals(ExpandWord('(#header>li)^#content', 'html'), "
\n\t\n
\n\n")
End
It climbs double to div with <<
Assert Equals(ExpandWord('a>b>i<
\n\n")
End
It climbs double to div with ^^
Assert Equals(ExpandWord('a>b>i^^div', 'html'), "\n\n")
End
It expands group siblings
Assert Equals(ExpandWord('(#header>h1)+#content+#footer', 'html'), "
\n\t\n
\n\n\n")
End
It expands complex nested groups
Assert Equals(ExpandWord('(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)', 'html'), "
\n\t\n
\n
\n\t
\n\t\t\n\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t
\n\t\n
\n\n")
End
It expands nested multiplier groups
Assert Equals(ExpandWord('(div>(ul*2)*2)+(#utilities)', 'html'), "
\n\t
\n\t
\n\t
\n\t
\n
\n\n")
End
It expands table multiplier group
Assert Equals(ExpandWord('table>(tr>td*3)*4', 'html'), "
\n\t
\n\t\t
\n\t\t
\n\t\t
\n\t
\n\t
\n\t\t
\n\t\t
\n\t\t
\n\t
\n\t
\n\t\t
\n\t\t
\n\t\t
\n\t
\n\t
\n\t\t
\n\t\t
\n\t\t
\n\t
\n
\n")
End
It expands deep nested multiplier groups
Assert Equals(ExpandWord('(((a#foo+a#bar)*2)*3)', 'html'), "\n\n\n\n\n\n\n\n\n\n\n\n")
End
It expands multiplier with child
Assert Equals(ExpandWord('div#box$*3>h3+p*2', 'html'), "
\n\t\n\t\n\t\n
\n
\n\t\n\t\n\t\n
\n
\n\t\n\t\n\t\n
\n")
End
It expands dollar multi class
Assert Equals(ExpandWord('div#box.foo$$$.bar$$$*3', 'html'), "\n\n\n")
End
It applies escape filter
Assert Equals(ExpandWord('div#box$*3>h3+p.bar*2|e', 'html'), "<div id=\"box1\">\n\t<h3></h3>\n\t<p class=\"bar\"></p>\n\t<p class=\"bar\"></p>\n</div>\n<div id=\"box2\">\n\t<h3></h3>\n\t<p class=\"bar\"></p>\n\t<p class=\"bar\"></p>\n</div>\n<div id=\"box3\">\n\t<h3></h3>\n\t<p class=\"bar\"></p>\n\t<p class=\"bar\"></p>\n</div>\n")
End
It applies comment filter
Assert Equals(ExpandWord('div>div#page>p.title+p|c', 'html'), "
\n\t\n\t
\n\t\t\n\t\t\n\t\t\n\t\t\n\t
\n\t\n
\n")
End
It applies single line filter
Assert Equals(ExpandWord('kbd*2|s', 'html'), '')
End
It expands link:css
Assert Equals(ExpandWord('link:css', 'html'), "\n")
End
It expands attribute with quote
Assert Equals(ExpandWord("a[title=\"Hello', world\" rel]", 'html'), "\n")
End
It expands child with text
Assert Equals(ExpandWord('div>a#foo{bar}', 'html'), "
\n")
End
It expands class with text
Assert Equals(ExpandWord('.content{Hello!}', 'html'), "
Hello!
\n")
End
It expands logo group siblings
Assert Equals(ExpandWord('div.logo+(div#navigation)+(div#links)', 'html'), "\n\n\n")
End
It expands mixed text and tags
Assert Equals(ExpandWord('h1{header}+{Text}+a[href=http://link.org]{linktext}+{again some text}+a[href=http://anoterlink.org]{click me!}+{some final text}', 'html'), "
header
\nTextlinktext\nagain some textclick me!\nsome final text")
End
It expands ampersand text
Assert Equals(ExpandWord('a{&}+div{&&}', 'html'), "&\n
&&
\n")
End
It expands span after tag in buffer
let res = ExpandInBuffer('span$$$$\,$$$$', 'html', '')
Assert Equals(res, '')
End
It expands span after text in buffer
let res = ExpandInBuffer('foo span$$$$\,$$$$', 'html', 'foo ')
Assert Equals(res, 'foo ')
End
It expands span between text in buffer
let res = ExpandInBuffer('foo span$$$$\,$$$$ bar', 'html', 'foo bar')
Assert Equals(res, 'foo bar')
End
It wraps visual word (skip: ex mode)
if mode() ==# 'c'
Skip not supported in ex mode
endif
let res = ExpandInBuffer("foo $$$$\\ve\\,p\\$$$$bar baz", 'html', 'foo
bar
baz')
Assert Equals(res, 'foo
bar
baz')
End
It wraps visual multi word (skip: ex mode)
if mode() ==# 'c'
Skip not supported in ex mode
endif
let res = ExpandInBuffer("foo $$$$\\vee\\,p\\$$$$bar baz", 'html', 'foo
bar baz
')
Assert Equals(res, 'foo
bar baz
')
End
It expands complex nested in buffer
let res = ExpandInBuffer("f div.boxes>article.box2>header>(hgroup>h2{aaa}+h3{bbb})+p{ccc}$$$$", 'html', "f
\n\t\n\t\t\n\t\t\t\n\t\t\t\t
aaa
\n\t\t\t\t
bbb
\n\t\t\t\n\t\t\t
ccc
\n\t\t\n\t\n
")
Assert Equals(res, "f
\n\t\n\t\t\n\t\t\t\n\t\t\t\t
aaa
\n\t\t\t\t
bbb
\n\t\t\t\n\t\t\t
ccc
\n\t\t\n\t\n
")
End
It expands complex boxes
Assert Equals(ExpandWord("div.boxes>(div.box2>section>h2{a}+p{b})+(div.box1>section>h2{c}+p{d}+p{e}+(bq>h2{f}+h3{g})+p{h})", 'html'), "
\n\t
\n\t\t\n\t\t\t
a
\n\t\t\t
b
\n\t\t\n\t
\n\t
\n\t\t\n\t\t\t
c
\n\t\t\t
d
\n\t\t\t
e
\n\t\t\t
\n\t\t\t\t
f
\n\t\t\t\t
g
\n\t\t\t
\n\t\t\t
h
\n\t\t\n\t
\n
\n")
End
It expands label input group
Assert Equals(ExpandWord('(div>(label+input))+div', 'html'), "
\n\t\n\t\n
\n\n")
End
It wraps visual lines with multiplier (skip: ex mode)
if mode() ==# 'c'
Skip not supported in ex mode
endif
let res = ExpandInBuffer("test1\ntest2\ntest3$$$$\\ggVG\\,ul>li>span*>a\\$$$$", 'html', "
")
End
It wraps visual lines with input (skip: ex mode)
if mode() ==# 'c'
Skip not supported in ex mode
endif
let res = ExpandInBuffer("test1\ntest2\ntest3$$$$\\ggVG\\,input[type=input value=$#]*\\$$$$", 'html', "\n\n")
Assert Equals(res, "\n\n")
End
It wraps visual lines with div id (skip: ex mode)
if mode() ==# 'c'
Skip not supported in ex mode
endif
let res = ExpandInBuffer("test1\ntest2\ntest3$$$$\\ggVG\\,div[id=$#]*\\$$$$", 'html', "\n\n")
Assert Equals(res, "\n\n")
End
It expands nested id dollar
Assert Equals(ExpandWord('div#id-$*5>div#id2-$', 'html'), "
\n\t\n
\n
\n\t\n
\n
\n\t\n
\n
\n\t\n
\n
\n\t\n
\n")
End
It expands implicit child attr
Assert Equals(ExpandWord('.foo>[bar=2]>.baz', 'html'), "
\n\t
\n\t\t\n\t
\n
\n")
End
It expands text dollar
Assert Equals(ExpandWord('{test case $ }*3', 'html'), 'test case 1 test case 2 test case 3 ')
End
It expands text dollar newline
Assert Equals(ExpandWord('{test case $${nr}}*3', 'html'), "test case 1\ntest case 2\ntest case 3\n")
End
It expands text escaped dollar
Assert Equals(ExpandWord('{test case \$ }*3', 'html'), 'test case $ test case $ test case $ ')
End
It expands text dollar padding
Assert Equals(ExpandWord('{test case $$$ }*3', 'html'), 'test case 001 test case 002 test case 003 ')
End
It expands title dollar hash
Assert Equals(ExpandWord('a[title=$#]{foo}', 'html'), "foo\n")
End
It expands span item dollar text
Assert Equals(ExpandWord('span.item$*2>{item $}', 'html'), "item 1\nitem 2\n")
End
It wraps visual indented block (skip: ex mode)
if mode() ==# 'c'
Skip not supported in ex mode
endif
let res = ExpandInBuffer("\t$$$$\\ggVG\\,div\\$$$$", 'html', "\t
\n\t\t\n\t
")
Assert Equals(res, "\t
\n\t\t\n\t
")
End
It expands inside tag
let res = ExpandInBuffer('a$$$$', 'html', '')
Assert Equals(res, '')
End
It applies BEM filter
Assert Equals(ExpandWord('form.search-form._wide>input.-query-string+input:s.-btn_large|bem', 'html'), "\n")
End
It expands fieldset legend label
Assert Equals(ExpandWord('form>fieldset>legend+(label>input[type="checkbox"])*3', 'html'), "\n")
End
End
Describe split join tag
It joins tag
let res = ExpandInBuffer("
\n\t$$$$\\j$$$$\n
", 'html', "
\n\t\n
")
Assert Equals(res, "
\n\t\n
")
End
It splits tag
let res = ExpandInBuffer("
\n\tj$$$$/>\n
", 'html', "
\n\t\n
")
Assert Equals(res, "
\n\t\n
")
End
It joins with complex attribute
let res = ExpandInBuffer("
500)\">test$$$$\\j$$$$/>\n
", 'html', '')
Assert Equals(res, '')
End
It splits custom tag
let res = ExpandInBuffer("
\n\tj$$$$/>\n
", 'html', "
\n\t\n
")
Assert Equals(res, "
\n\t\n
")
End
End
Describe toggle comment
It adds comment
let res = ExpandInBuffer("
\n\t$$$$\\/$$$$\n
", 'html', "
\n\t\n
")
Assert Equals(res, "
\n\t\n
")
End
It removes comment
let res = ExpandInBuffer("
\n\t\n
", 'html', "
\n\t\n
")
Assert Equals(res, "
\n\t\n
")
End
End
Describe image size
It gets remote png size
let res = ExpandInBuffer("img[src=http://mattn.kaoriya.net/images/logo.png]$$$$\\,\\i$$$$", 'html', '')
Assert Equals(res, '')
End
It handles missing local image
let res = ExpandInBuffer("img[src=/logo.png]$$$$\\,\\i$$$$", 'html', '')
Assert Equals(res, '')
End
It overwrites existing size
let res = ExpandInBuffer("img[src=http://mattn.kaoriya.net/images/logo.png width=foo height=bar]$$$$\\,\\i$$$$", 'html', '')
Assert Equals(res, '')
End
End
Describe move next prev
It moves to third attribute
let res = ExpandInBuffer("foo+bar+baz[dankogai=\"\"]$$$$\\,\\gg0\\n\\n\\n\\Byw:%d _\\p$$$$", 'html', 'dankogai')
Assert Equals(res, 'dankogai')
End
End
Describe contains dash in attributes
It expands foo-bar attribute
Assert Equals(ExpandWord('div[foo-bar="baz"]', 'html'), "\n")
End
End
Describe default attributes
It expands a href shorthand
Assert Equals(ExpandWord('p.title>a[/hoge/]', 'html'), "
\n")
End
It expands script src
Assert Equals(ExpandWord('script[jquery.js]', 'html'), "\n")
End
End
Describe multiple group
It expands outer inner
Assert Equals(ExpandWord('.outer$*3>.inner$*2', 'html'), "
\n\t\n\t\n
\n
\n\t\n\t\n
\n
\n\t\n\t\n
\n")
End
End
Describe group itemno
It expands dl dt dd
Assert Equals(ExpandWord('dl>(dt{$}+dd)*3', 'html'), "
\n\t
1
\n\t\n\t
2
\n\t\n\t
3
\n\t\n
\n")
End
It expands nested multiplier
Assert Equals(ExpandWord('(div[attr=$]*3)*3', 'html'), "\n\n\n\n\n\n\n\n\n")
End
End
Describe update tag
It adds class (skip: ex mode)
if mode() ==# 'c'
Skip not supported in ex mode
endif
let res = ExpandInBuffer("u.global\\$$$$3>", 'html', '')
Assert Equals(res, '')
End
It adds class preserving attribute (skip: ex mode)
if mode() ==# 'c'
Skip not supported in ex mode
endif
let res = ExpandInBuffer("", 'html', '')
Assert Equals(res, '')
End
End
Describe base value
It starts from zero
Assert Equals(ExpandWord('ul>li#id$@0*3', 'html'), "