Sha256: 12542bf698adb91ced01b943f711afdf98fa3c47571bb536f9352c80ee7079e5

Contents?: true

Size: 789 Bytes

Versions: 3

Compression:

Stored size: 789 Bytes

Contents

import { run, schedule } from '..';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

moduleFor(
  'system/run_loop/sync_test',
  class extends AbstractTestCase {
    ['@test sync() will immediately flush the sync queue only'](assert) {
      let cnt = 0;

      run(() => {
        function cntup() {
          cnt++;
        }

        function syncfunc() {
          if (++cnt < 5) {
            expectDeprecation(() => {
              schedule('sync', syncfunc);
            }, `Scheduling into the 'sync' run loop queue is deprecated.`);
          }
          schedule('actions', cntup);
        }

        syncfunc();

        assert.equal(cnt, 1, 'should not run action yet');
      });

      assert.equal(cnt, 10, 'should flush actions now too');
    }
  }
);

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/runloop/tests/sync_test.js
discourse-ember-source-3.5.1.1 dist/es/@ember/runloop/tests/sync_test.js
discourse-ember-source-3.5.1.0 dist/dist/es/@ember/runloop/tests/sync_test.js