Skip to content

Commit

Permalink
Adding tests for #31
Browse files Browse the repository at this point in the history
  • Loading branch information
wavesoft committed Oct 21, 2019
1 parent 0338a94 commit 0f43748
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/__tests__/dotdom-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ describe('.dom', function () {
});
});

it('should accept integers as children', function () {
const vdom = dd.H('div', null, 1, 2);

expect(vdom.$).toEqual('div');
expect(vdom.a).toEqual({
c: [ 1, 2 ]
});
});

});

describe('Proxy', function () {
Expand Down Expand Up @@ -200,6 +209,17 @@ describe('.dom', function () {
);
});

it('should render integer children', function () {
const dom = document.createElement('div');
const vdom = dd.H('div', null, [1, 2, 3]);

dd.R(vdom, dom)

expect(dom.innerHTML).toEqual(
'<div>123</div>'
);
});

it('should render combined dom and text nodes', function () {
const dom = document.createElement('div');
const vdom = dd.H('div', dd.H('a'), 'foo', dd.H('b'));
Expand Down

0 comments on commit 0f43748

Please sign in to comment.