[Pkg-javascript-commits] [ltx] 347/469: add test for toJSON

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:03:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository ltx.

commit b196df8a05171c1284da13c492c8181c46362bb7
Author: ▟ ▖▟ ▖ <dodo.the.last at gmail.com>
Date:   Thu Sep 18 00:34:23 2014 +0200

    add test for toJSON
---
 test/element-test.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/test/element-test.js b/test/element-test.js
index e904ac8..7647d4b 100644
--- a/test/element-test.js
+++ b/test/element-test.js
@@ -63,6 +63,16 @@ vows.describe('ltx').addBatch({
         'serialize with integer text': function() {
             var e = new ltx.Element('e').t(1000)
             assert.equal(e.getText(), 1000)
+        },
+        'serialize to json': function() {
+            var e = new ltx.Element('e', { foo: 23, bar: 0, nil:null }).c('f').t(1000).up()
+            assert.deepEqual(e.toJSON(), {
+                name: 'e',
+                attrs: { foo: 23, bar: 0, nil:null },
+                children: [
+                    { name: 'f', attrs: {}, children: [1000] }
+                ]
+            })
         }
     },
     'remove': {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git



More information about the Pkg-javascript-commits mailing list