Skip to content

Commit 4067c51

Browse files
committed
add tests to support built in and third party iterable
1 parent 9be3c67 commit 4067c51

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"eslint": "^3.0.0",
8080
"eslint-plugin-react": "^6.0.0",
8181
"gzip-size-cli": "^1.0.0",
82+
"immutable": "^3.8.1",
8283
"isparta-loader": "^2.0.0",
8384
"jscodeshift": "^0.3.25",
8485
"karma": "^1.1.0",

‎test/shared/h.js‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { h } from '../../src/preact';
22
import { VNode } from '../../src/vnode';
33
import { expect } from 'chai';
4+
import { fromJS } from 'immutable';
45

56
/*eslint-env browser, mocha */
67

@@ -86,7 +87,27 @@ describe('h(jsx)', () => {
8687
]);
8788
});
8889

89-
it('should handle multiple element children, given as an iterable', () => {
90+
it('should handle multiple element children, given as an List from Immutable.js', () => {
91+
let r = h(
92+
'foo',
93+
null,
94+
fromJS([
95+
h('bar'),
96+
h('baz', null, h('test'))
97+
])
98+
);
99+
100+
expect(r).to.be.an('object')
101+
.with.property('children')
102+
.that.deep.equals([
103+
buildVNode('bar'),
104+
buildVNode('baz', undefined, [
105+
buildVNode('test')
106+
])
107+
]);
108+
});
109+
110+
it('should handle multiple element children, given as a built in iterable', () => {
90111
let r = h(
91112
'foo',
92113
null,

0 commit comments

Comments
 (0)