const run = () => { cells = cells === full ? empty : full; m.render(root, [view()]); setTimeout(run, 2000); };
const run = function() { cells = cells === full ? empty : full m.render(root, [view()]) setTimeout(run, 2000) }
.then(svg => { m.render(document.body, m.trust(svg)); });
console.assert(vnode.children![0].tag === 'div'); } { const handler = m.withAttr("value", (value) => {}); handler({currentTarget: {value: 10}}); } { const params = m.parseQueryString("?a=1&b=2"); const query = m.buildQueryString({a: 1, b: 2}); } { const root = window.document.createElement("div"); m.render(root, m("div")); console.assert(root.childNodes.length === 1); } { const root = window.document.createElement("div"); m.mount(root, { view: () => m("div") }); console.assert(root.childNodes.length === 1); console.assert(root.firstChild!.nodeName === "DIV"); } { const root = window.document.createElement("div"); m.route(root, "/a", { "/a": { view: () => m("div") } });
function redraw() { m.render(mountPoint, Vnode(RouteComponent, undefined, undefined, undefined, undefined, undefined)); }
import { createEditor } from '../editor' import { createPopupmenu } from '../popupmenu' require('codemirror/addon/hint/show-hint.js') require('codemirror/addon/search/searchcursor.js') require('codemirror/addon/dialog/dialog.js') require('codemirror/keymap/sublime.js') require('codemirror/mode/sql/sql.js') require('../../modules/sql-hint') const pubsub = new EventEmitter() const editor = createEditor(m, pubsub, CodeMirror) const editorContainer = document.createElement('div') document.body.appendChild(editorContainer) m.render(editorContainer, editor.view()) describe('editor', () => { it('should set value', () => { editor.setValue('testing\nline2') expect(editor.getValue(' ')).to.equal('testing line2') }) it('should get the selected statement', () => { editor.setValue('line1\nline2') editor.setCursor({ line: 1, ch: 0, }) expect(editor.getCursorStatement(' ')).to.equal('line1 line2') editor.setValue('line1\n\nline2')