Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLEANUP beta] #12627

Merged
merged 1 commit into from
Nov 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/ember-debug/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ setDebugFunction('deprecate', _deprecate);
setDebugFunction('warn', _warn);

/**
Will call `Ember.warn()` if ENABLE_ALL_FEATURES, ENABLE_OPTIONAL_FEATURES, or
Will call `Ember.warn()` if ENABLE_OPTIONAL_FEATURES or
any specific FEATURES flag is truthy.

This method is called automatically in debug canary builds.
Expand All @@ -175,7 +175,6 @@ setDebugFunction('warn', _warn);
*/
export function _warnIfUsingStrippedFeatureFlags(FEATURES, featuresWereStripped) {
if (featuresWereStripped) {
warn('Ember.ENV.ENABLE_ALL_FEATURES is only available in canary builds.', !Ember.ENV.ENABLE_ALL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' });
warn('Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.', !Ember.ENV.ENABLE_OPTIONAL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' });

for (var key in FEATURES) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Ember from 'ember-metal/core';
import { getDebugFunction, setDebugFunction } from 'ember-metal/debug';
import { _warnIfUsingStrippedFeatureFlags } from 'ember-debug';

var oldWarn, oldRunInDebug, origEnvFeatures, origEnableAll, origEnableOptional;
var oldWarn, oldRunInDebug, origEnvFeatures, origEnableOptional;

function confirmWarns(expectedMsg) {
var featuresWereStripped = true;
Expand Down Expand Up @@ -31,33 +31,20 @@ QUnit.module('ember-debug - _warnIfUsingStrippedFeatureFlags', {
oldWarn = getDebugFunction('warn');
oldRunInDebug = getDebugFunction('runInDebug');
origEnvFeatures = Ember.ENV.FEATURES;
origEnableAll = Ember.ENV.ENABLE_ALL_FEATURES;
origEnableOptional = Ember.ENV.ENABLE_OPTIONAL_FEATURES;
},

teardown() {
setDebugFunction('warn', oldWarn);
setDebugFunction('runInDebug', oldRunInDebug);
Ember.ENV.FEATURES = origEnvFeatures;
Ember.ENV.ENABLE_ALL_FEATURES = origEnableAll;
Ember.ENV.ENABLE_OPTIONAL_FEATURES = origEnableOptional;
}
});

QUnit.test('Setting Ember.ENV.ENABLE_ALL_FEATURES truthy in non-canary, debug build causes a warning', function() {
expect(1);

Ember.ENV.ENABLE_ALL_FEATURES = true;
Ember.ENV.ENABLE_OPTIONAL_FEATURES = false;
Ember.ENV.FEATURES = {};

confirmWarns('Ember.ENV.ENABLE_ALL_FEATURES is only available in canary builds.');
});

QUnit.test('Setting Ember.ENV.ENABLE_OPTIONAL_FEATURES truthy in non-canary, debug build causes a warning', function() {
expect(1);

Ember.ENV.ENABLE_ALL_FEATURES = false;
Ember.ENV.ENABLE_OPTIONAL_FEATURES = true;
Ember.ENV.FEATURES = {};

Expand All @@ -67,7 +54,6 @@ QUnit.test('Setting Ember.ENV.ENABLE_OPTIONAL_FEATURES truthy in non-canary, deb
QUnit.test('Enabling a FEATURES flag in non-canary, debug build causes a warning', function() {
expect(1);

Ember.ENV.ENABLE_ALL_FEATURES = false;
Ember.ENV.ENABLE_OPTIONAL_FEATURES = false;
Ember.ENV.FEATURES = {
'fred': true,
Expand Down
21 changes: 5 additions & 16 deletions packages/ember-metal/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ if (Ember.ENV) {
Ember.ENV = {};
}

Ember.config = Ember.config || {};

// We disable the RANGE API by default for performance reasons
if ('undefined' === typeof Ember.ENV.DISABLE_RANGE_API) {
Ember.ENV.DISABLE_RANGE_API = true;
// ENABLE_ALL_FEATURES was documented, but you can't actually enable non optional features.
if (Ember.ENV.ENABLE_ALL_FEATURES) {
Ember.ENV.ENABLE_OPTIONAL_FEATURES = Ember.ENV.ENABLE_ALL_FEATURES;
}

Ember.config = Ember.config || {};

// ..........................................................
// BOOTSTRAP
//
Expand Down Expand Up @@ -136,17 +136,6 @@ if (typeof Ember.EXTEND_PROTOTYPES === 'undefined') {
*/
Ember.LOG_STACKTRACE_ON_DEPRECATION = (Ember.ENV.LOG_STACKTRACE_ON_DEPRECATION !== false);

/**
The `SHIM_ES5` property, when true, tells Ember to add ECMAScript 5 Array
shims to older browsers.

@property SHIM_ES5
@type Boolean
@default Ember.EXTEND_PROTOTYPES
@public
*/
Ember.SHIM_ES5 = (Ember.ENV.SHIM_ES5 === false) ? false : Ember.EXTEND_PROTOTYPES;

/**
The `LOG_VERSION` property, when true, tells Ember to log versions of all
dependent libraries in use.
Expand Down
5 changes: 1 addition & 4 deletions packages/ember-metal/lib/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export var FEATURES = assign(DEFAULT_FEATURES, Ember.ENV.FEATURES); // jshint ig

You can define the following configuration options:

* `EmberENV.ENABLE_ALL_FEATURES` - force all features to be enabled.
* `EmberENV.ENABLE_OPTIONAL_FEATURES` - enable any features that have not been explicitly
enabled/disabled.

Expand All @@ -36,9 +35,7 @@ export var FEATURES = assign(DEFAULT_FEATURES, Ember.ENV.FEATURES); // jshint ig
export default function isEnabled(feature) {
var featureValue = FEATURES[feature];

if (Ember.ENV.ENABLE_ALL_FEATURES) {
return true;
} else if (featureValue === true || featureValue === false || featureValue === undefined) {
if (featureValue === true || featureValue === false || featureValue === undefined) {
return featureValue;
} else if (Ember.ENV.ENABLE_OPTIONAL_FEATURES) {
return true;
Expand Down
15 changes: 1 addition & 14 deletions packages/ember-metal/tests/features_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import Ember from 'ember-metal/core';
import isEnabled, { FEATURES } from 'ember-metal/features';
import assign from 'ember-metal/assign';

var origFeatures, origEnableAll, origEnableOptional;
var origFeatures, origEnableOptional;

QUnit.module('isEnabled', {
setup() {
origFeatures = assign({}, FEATURES);
origEnableAll = Ember.ENV.ENABLE_ALL_FEATURES;
origEnableOptional = Ember.ENV.ENABLE_OPTIONAL_FEATURES;
},

Expand All @@ -17,21 +16,10 @@ QUnit.module('isEnabled', {
}
assign(FEATURES, origFeatures);

Ember.ENV.ENABLE_ALL_FEATURES = origEnableAll;
Ember.ENV.ENABLE_OPTIONAL_FEATURES = origEnableOptional;
}
});

QUnit.test('ENV.ENABLE_ALL_FEATURES', function() {
Ember.ENV.ENABLE_ALL_FEATURES = true;
FEATURES['fred'] = false;
FEATURES['wilma'] = null;

equal(isEnabled('fred'), true, 'overrides features set to false');
equal(isEnabled('wilma'), true, 'enables optional features');
equal(isEnabled('betty'), true, 'enables non-specified features');
});

QUnit.test('ENV.ENABLE_OPTIONAL_FEATURES', function() {
Ember.ENV.ENABLE_OPTIONAL_FEATURES = true;
FEATURES['fred'] = false;
Expand All @@ -45,7 +33,6 @@ QUnit.test('ENV.ENABLE_OPTIONAL_FEATURES', function() {
});

QUnit.test('isEnabled without ENV options', function() {
Ember.ENV.ENABLE_ALL_FEATURES = false;
Ember.ENV.ENABLE_OPTIONAL_FEATURES = false;

FEATURES['fred'] = false;
Expand Down
9 changes: 1 addition & 8 deletions packages/ember-views/lib/views/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Ember.ContainerView circular dependency
// Ember.ENV
import Ember from 'ember-metal/core';
import { deprecate, warn } from 'ember-metal/debug';
import { deprecate } from 'ember-metal/debug';

import 'ember-views/system/ext'; // for the side effect of extending Ember.run.queues

Expand All @@ -28,13 +28,6 @@ import { deprecateProperty } from 'ember-metal/deprecate_property';
@submodule ember-views
*/

warn(
'The VIEW_PRESERVES_CONTEXT flag has been removed and the functionality can no longer be disabled.',
Ember.ENV.VIEW_PRESERVES_CONTEXT !== false,
{
id: 'ember-views.view-preserves-context-flag',
until: '2.0.0'
});
/**
`Ember.View` is the class in Ember responsible for encapsulating templates of
HTML content, combining templates with data to render as sections of a page's
Expand Down