Permalink
Browse files

add self closing test

  • Loading branch information...
1 parent a2fc415 commit 34fde4f246693d7f6904756fc17d0804e871cda5 @dodo committed Nov 9, 2013
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/test/xml.coffee
View
@@ -45,12 +45,26 @@ module.exports =
results = [
'<test>'
'<items>'
+
+
+ 'self closing': (æ) ->
+ xml = streamify new Builder
+ xml.stream.on 'data', (tag) -> æ.equal results.shift(), tag
+ xml.stream.on 'end', ->
+ æ.equal 0, results.length
+ æ.done()
+ results = [
+ '<test>'
+ '<items>'
'<item value="a"/>'
'<item value="b"/>'
'<item value="c"/>'
'</items>'
'</test>'
]
+ xml.register 'end', (tag, next) ->
+ tag.isempty = yes if tag.isselfclosing
+ next(tag)
xml
.tag('test')
.tag('items')

0 comments on commit 34fde4f

Please sign in to comment.