it('should render the model into a virtual DOM table', () => { let model = new CSVModel({ content: CSV_DATA }); let table = new TestTable(); table.model = model; let rendered = realize(table.render() as VNode); let rows = rendered.getElementsByTagName('tr'); let cols = rendered.getElementsByTagName('th'); expect(rows).to.have.length(DISPLAY_LIMIT); expect(cols).to.have.length(4); model.dispose(); table.dispose(); });
it('should connect a node to a command', () => { let called = false; let command = 'commandlinker:connect-node'; let commands =new CommandRegistry(); let linker = new CommandLinker({ commands }); let node: HTMLElement; let vnode: VNode; let disposable = commands.addCommand(command, { execute: () => { called = true; } }); let attrs: IElementAttrs = {}; vnode = h.div(linker.populateVNodeAttrs(attrs, command, null)); node = realize(vnode); document.body.appendChild(node); expect(called).to.be(false); simulate(node, 'click'); expect(called).to.be(true); document.body.removeChild(node); linker.dispose(); disposable.dispose(); });