test.beforeEach(t => { let root = document.getElementById('root'); if (!root) { root = document.createElement('div'); root.id = 'root'; document.body.appendChild(root); } t.context.root = root; });
test('render div with children', t => { const root = t.context.root; const element = ( <div> <b /> <a href="foo" /> </div> ); render(element, root); t.is(root.innerHTML, '<div><b></b><a href="foo"></a></div>'); });
render(props, {}) { const loading = props.caldavSaveSettingsStatus === RequestStatus.Getting || props.caldavGetSettingsStatus === RequestStatus.Getting || props.caldavCleanUpStatus === RequestStatus.Getting || props.caldavSyncStatus === RequestStatus.Getting; return <CaldavPage {...props} loading={loading} dictionary={this.context.intl.dictionary.integration.caldav} />; }
context('handleApiKeyAdd', () => { it('should add the new key', () => { const props = generateProps() const settings = shallow(<GeneralSettings {...props} />) settings.instance().handleApiKeyAdd() assert.deepEqual(settings.state('apiKeys').length, props.settings.apiKeys.length + 1) assert.deepEqual(settings.state('apiKeys')[props.settings.apiKeys.length].status, apiKeyStatuses.toBeCreated) }) })
/** * {{> seeNumberOfVisibleElements }} * */ async seeNumberOfVisibleElements(locator, num) { const count = (await findElements.call(this, this.context, locator)).filterVisible().count; return this.t .expect(count).eql(num) .catch(mapError); }
function callHook (dir, hook, vnode, oldVnode, isDestroy) { const fn = dir.def && dir.def[hook] if (fn) { try { fn(vnode.elm, dir, vnode, oldVnode, isDestroy) } catch (e) { handleError(e, vnode.context, `directive ${dir.name} ${hook} hook`) } } }
getRawValueFramebuffer(width, height) { if (!this.rawValueFramebuffers[width]) { this.rawValueFramebuffers[width] = {}; } if (!this.rawValueFramebuffers[width][height]) { const framebuffer = this.context.createFramebuffer(); framebuffer.width = width; framebuffer.height = height; this.rawValueFramebuffers[width][height] = framebuffer; } return this.rawValueFramebuffers[width][height]; }
/** * {{> waitForText }} */ async waitForText(text, sec = null, context = null) { if (!context) { context = this.context; } const el = global.element(guessLocator(context) || global.by.css(context)); const aSec = sec || this.options.waitForTimeout; return this.browser.wait(EC.textToBePresentInElement(el, text), aSec * 1000); }
/** * @desc Return WebGlUniformLocation for various variables * related to webGl program, such as user-defined variables, * as well as, dimension sizes, etc. */ getUniformLocation(name) { if (this.programUniformLocationCache.hasOwnProperty(name)) { return this.programUniformLocationCache[name]; } return this.programUniformLocationCache[name] = this.context.getUniformLocation(this.program, name); }
test('implicit connection configuration is reset', async (t) => { const pool = createPool(t.context.dsn, { maximumPoolSize: 1, }); const originalStatementTimeout = await pool.oneFirst(sql`SHOW statement_timeout`); t.not(originalStatementTimeout, '50ms'); await pool.query(sql`SET statement_timeout=50`); const statementTimeout = await pool.oneFirst(sql`SHOW statement_timeout`); t.not(statementTimeout, '50ms'); await pool.end(); });
initExtensions() { this.extensions = { STACKGL_resize_drawingbuffer: this.context.getExtension('STACKGL_resize_drawingbuffer'), STACKGL_destroy_context: this.context.getExtension('STACKGL_destroy_context'), OES_texture_float: this.context.getExtension('OES_texture_float'), OES_texture_float_linear: this.context.getExtension('OES_texture_float_linear'), OES_element_index_uint: this.context.getExtension('OES_element_index_uint'), WEBGL_draw_buffers: this.context.getExtension('WEBGL_draw_buffers'), }; }
test('render jsx div', t => { const root = t.context.root; const element = <div>Foo</div>; render(element, root); t.is(root.innerHTML, '<div>Foo</div>'); render(element, root); t.is(root.innerHTML, '<div>Foo</div>'); });
test.beforeEach(t => { let root = document.getElementById('root'); if (!root) { root = document.createElement('div'); root.id = 'root'; document.body.appendChild(root); } t.context.root = root; });
render(props, {}) { const loading = props.caldavSaveSettingsStatus === RequestStatus.Getting || props.caldavGetSettingsStatus === RequestStatus.Getting || props.caldavCleanUpStatus === RequestStatus.Getting || props.caldavSyncStatus === RequestStatus.Getting; return <CaldavPage {...props} loading={loading} dictionary={this.context.intl.dictionary.integration.caldav} />; }