Cleanup debuggers and DISABLED const
MODIFY
addon/capabilities.js
addon/capabilities.js
@@ -3,6 +3,8 @@ const CAPABILITIES = {
requestIdleCallback: requestIdleCallback,
};
+export const DISABLED = true;
+
/**
* @type {Capabilities}
*/
@@ -15,7 +17,6 @@ class Capabilities {
}
this.reset();
- this.DISABLED = true;
}
static get instance() {

MODIFY
tests/unit/capabilities-test.js
tests/unit/capabilities-test.js
import { module, test } from 'qunit';
-import Capabilities from 'ember-app-scheduler/capabilities';
+import Capabilities, { DISABLED } from 'ember-app-scheduler/capabilities';
const CAPABILITIES = Capabilities.instance;
module('Unit | Capabilities', function(hooks) {
hooks.beforeEach(function() {
- debugger;
CAPABILITIES.reset();
});
test('capabilities is initialized correctly', function(assert) {
assert.expect(2);
- debugger;
+
assert.ok(CAPABILITIES.requestAnimationFrameEnabled);
assert.ok(CAPABILITIES.requestIdleCallbackEnabled);
});
@@ -19,14 +18,8 @@ module('Unit | Capabilities', function(hooks) {
test('capabilities can be overridden correctly', function(assert) {
assert.expect(2);
- CAPABILITIES.overrideCapability(
- 'requestAnimationFrame',
- CAPABILITIES.DISABLED
- );
- CAPABILITIES.overrideCapability(
- 'requestIdleCallback',
- CAPABILITIES.DISABLED
- );
+ CAPABILITIES.overrideCapability('requestAnimationFrame', DISABLED);
+ CAPABILITIES.overrideCapability('requestIdleCallback', DISABLED);
assert.equal(CAPABILITIES.requestAnimationFrameEnabled, false);
assert.equal(CAPABILITIES.requestIdleCallbackEnabled, false);

MODIFY
tests/unit/scheduler-test.js
tests/unit/scheduler-test.js
@@ -11,7 +11,7 @@ import {
USE_REQUEST_IDLE_CALLBACK,
SIMPLE_CALLBACK,
} from 'ember-app-scheduler/scheduler';
-import Capabilities from 'ember-app-scheduler/capabilities';
+import Capabilities, { DISABLED } from 'ember-app-scheduler/capabilities';
const CAPABILITIES = Capabilities.instance;
const REQUEST_ANIMATION_FRAME = requestAnimationFrame;
@@ -42,10 +42,7 @@ module('Unit | Scheduler', function(hooks) {
test('whenRouteIdle resolves when transition ended when requestAnimationFrame not available', async function(assert) {
assert.expect(1);
- CAPABILITIES.overrideCapability(
- 'requestAnimationFrame',
- CAPABILITIES.DISABLED
- );
+ CAPABILITIES.overrideCapability('requestAnimationFrame', DISABLED);
window.requestAnimationFrame = () =>
assert.ok(false, 'requestAnimationFrame was used');
beginTransition();
@@ -63,11 +60,8 @@ module('Unit | Scheduler', function(hooks) {
test('whenRouteIdle resolves using requestAnimationFrame when transition ended when requestIdleCallback not available', async function(assert) {
assert.expect(1);
- debugger;
- CAPABILITIES.overrideCapability(
- 'requestIdleCallback',
- CAPABILITIES.DISABLED
- );
+
+ CAPABILITIES.overrideCapability('requestIdleCallback', DISABLED);
window.requestAnimationFrame = () =>
assert.ok(true, 'requestAnimationFrame was used');
beginTransition();
@@ -113,10 +107,7 @@ module('Unit | Scheduler', function(hooks) {
});
test('_getScheduleFn falls back to requestAnimationFrame if requestIdleCallback not available', function(assert) {
- CAPABILITIES.overrideCapability(
- 'requestIdleCallback',
- CAPABILITIES.DISABLED
- );
+ CAPABILITIES.overrideCapability('requestIdleCallback', DISABLED);
assert.equal(
_getScheduleFn(USE_REQUEST_IDLE_CALLBACK),
@@ -125,14 +116,8 @@ module('Unit | Scheduler', function(hooks) {
});
test('_getScheduleFn returns simple callback if requestAnimationFrame not available', function(assert) {
- CAPABILITIES.overrideCapability(
- 'requestAnimationFrame',
- CAPABILITIES.DISABLED
- );
- CAPABILITIES.overrideCapability(
- 'requestIdleCallback',
- CAPABILITIES.DISABLED
- );
+ CAPABILITIES.overrideCapability('requestAnimationFrame', DISABLED);
+ CAPABILITIES.overrideCapability('requestIdleCallback', DISABLED);
assert.equal(_getScheduleFn(), SIMPLE_CALLBACK);
});

Cleanup debuggers and DISABLED const