var vows = require('vows')
  , assert = require('assert')
  , Element = require('../lib/element').Element

vows.describe('unicode').addBatch({
    'unicode forming': {
        'issue-29': function() {
            var text = 'Hello ɝ'
            var element = new Element('iq')
            element.t(text)
            assert.equal(element.toString(), '<iq>' + text + '</iq>')
        },
        'issue-29 test #2': function() {
           var text = '니코드<'
           var element = new Element(
               'message', { to: 'you@server.com', type: 'chat' }
           )
               .c('body').t('니코드<'.toString('utf8'))
           assert.equal(element.getChildText('body'), text)
        }
    }
}).export(module)

@@ -675,24 +675,594 @@
 dy'), text)%0A
+        %7D,%0A        'issue-29 test write': function() %7B%0A            var text = '%EC%9C%A0%EB%8B%88%EC%BD%94%EB%93%9C'%0A            var result = '%3C0message0 0to0=%220-1@chat.fb.com0%220 0type0=%220chat0%220%3E0%3C0body0%3E'.split(0)%0A            result.push(text)%0A            result = result.concat('%3C/0body0%3E0%3C/0message0%3E'.split(0))%0A            var element = new Element('message', %7Bto:'-1@chat.fb.com', type:'chat'%7D)%0A            element.c('body').t(text.toString('utf8'))%0A            element.write(function(c) %7B%0A                assert.equal(result.shift(), c)%0A            %7D)%0A            assert.equal(result.length, 0)%0A
         %7D%0A  

update #29 test with data from node-xmp/node-xmpp#198