diff --git a/src/index.js b/src/index.js index 166ed014..ab05adb1 100644 --- a/src/index.js +++ b/src/index.js @@ -181,7 +181,10 @@ export class Tonic extends window.HTMLElement { return this._prop(o) } case '[object Object]': - case '[object Function]': return this._prop(o) + case '[object Function]': + case '[object Set]': + case '[object Map]': + case '[object WeakMap]': return this._prop(o) case '[object NamedNodeMap]': return this._prop(Tonic._normalizeAttrs(o)) case '[object Number]': return `${o}__float` diff --git a/test/index.js b/test/index.js index 4cab4ba9..e35fddff 100644 --- a/test/index.js +++ b/test/index.js @@ -236,7 +236,10 @@ test('pass props', async t => { id="y" data=${test} number=${42.42} - fn=${() => 'hello, world'}> + fn=${() => 'hello, world'} + set=${new Set(['foo'])} + map=${new Map([['bar', 'bar']])} + weakmap=${new WeakMap([[document, 'baz']])}> ` } @@ -256,6 +259,9 @@ test('pass props', async t => { const props = bb.props t.equal(props.fn(), 'hello, world', 'passed a function') t.equal(props.number, 42.42, 'float parsed properly') + t.equal(props.set.has('foo'), true, 'set parsed properly') + t.equal(props.map.get('bar'), 'bar', 'map parsed properly') + t.equal(props.weakmap.get(document), 'baz', 'weak map parsed properly') } const div1 = document.getElementsByTagName('div')[0]