Sha256: f31ac2fa6fdde5ea36d44619b8a00c62b59f2482120486ec52a1657dbaa45cb2
Contents?: true
Size: 1.89 KB
Versions: 1
Compression:
Stored size: 1.89 KB
Contents
import { RenderingTestCase, moduleFor, strip } from 'internal-test-helpers'; import { renderSettled } from '@ember/-internals/glimmer'; import { all } from 'rsvp'; import { run, schedule } from '@ember/runloop'; moduleFor( 'renderSettled', class extends RenderingTestCase { ['@test resolves when no rendering is happening'](assert) { return renderSettled().then(() => { assert.ok(true, 'resolved even without rendering'); }); } ['@test resolves renderers exist but no runloops are triggered'](assert) { this.render(strip`{{foo}}`, { foo: 'bar' }); return renderSettled().then(() => { assert.ok(true, 'resolved even without runloops'); }); } ['@test does not create extraneous promises'](assert) { let first = renderSettled(); let second = renderSettled(); assert.strictEqual(first, second); return all([first, second]); } ['@test resolves when rendering has completed (after property update)']() { this.render(strip`{{foo}}`, { foo: 'bar' }); this.assertText('bar'); this.component.set('foo', 'baz'); this.assertText('bar'); return renderSettled().then(() => { this.assertText('baz'); }); } ['@test resolves in run loop when renderer has settled'](assert) { assert.expect(3); this.render(strip`{{foo}}`, { foo: 'bar' }); this.assertText('bar'); let promise; return run(() => { schedule('actions', null, () => { this.component.set('foo', 'set in actions'); promise = renderSettled().then(() => { this.assertText('set in afterRender'); }); schedule('afterRender', null, () => { this.component.set('foo', 'set in afterRender'); }); }); // still not updated here this.assertText('bar'); return promise; }); } } );
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.6.0.0 | dist/es/@ember/-internals/glimmer/tests/integration/render-settled-test.js |