Skip to content

Commit

Permalink
Merge pull request #16797 from emberjs/allow-autorun
Browse files Browse the repository at this point in the history
Drop autorun assertion
  • Loading branch information
rwjblue authored Jul 13, 2018
2 parents 6ecd806 + cff0b10 commit 22c2826
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
17 changes: 1 addition & 16 deletions packages/@ember/runloop/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert, deprecate, isTesting } from '@ember/debug';
import { assert, deprecate } from '@ember/debug';
import { onErrorTarget } from 'ember-error-handling';
import { beginPropertyChanges, endPropertyChanges } from 'ember-metal';
import Backburner from 'backburner';
Expand Down Expand Up @@ -325,11 +325,6 @@ export function end() {
@public
*/
export function schedule(queue /*, target, method */) {
assert(
`You have turned on testing mode, which disabled the run-loop's autorun. ` +
`You will need to wrap any code with asynchronous side-effects in a run`,
currentRunLoop || !isTesting()
);
deprecate(`Scheduling into the '${queue}' run loop queue is deprecated.`, queue !== 'sync', {
id: 'ember-metal.run.sync',
until: '3.5.0',
Expand Down Expand Up @@ -398,11 +393,6 @@ export function later(/*target, method*/) {
@public
*/
export function once(...args) {
assert(
`You have turned on testing mode, which disabled the run-loop's autorun. ` +
`You will need to wrap any code with asynchronous side-effects in a run`,
currentRunLoop || !isTesting()
);
args.unshift('actions');
return backburner.scheduleOnce(...args);
}
Expand Down Expand Up @@ -480,11 +470,6 @@ export function once(...args) {
@public
*/
export function scheduleOnce(queue /*, target, method*/) {
assert(
`You have turned on testing mode, which disabled the run-loop's autorun. ` +
`You will need to wrap any code with asynchronous side-effects in a run`,
currentRunLoop || !isTesting()
);
deprecate(`Scheduling into the '${queue}' run loop queue is deprecated.`, queue !== 'sync', {
id: 'ember-metal.run.sync',
until: '3.5.0',
Expand Down
13 changes: 0 additions & 13 deletions packages/@ember/runloop/tests/schedule_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,5 @@ moduleFor(

assert.deepEqual(order, ['sync', 'actions', 'sync', 'actions', 'destroy']);
}

['@test makes sure it does not trigger an autorun during testing']() {
expectAssertion(
() => schedule('actions', () => {}),
/wrap any code with asynchronous side-effects in a run/
);

// make sure not just the first violation is asserted.
expectAssertion(
() => schedule('actions', () => {}),
/wrap any code with asynchronous side-effects in a run/
);
}
}
);

0 comments on commit 22c2826

Please sign in to comment.