Add feature flags to test

This commit is contained in:
David Kaltschmidt
2016-11-15 11:50:16 +01:00
parent aa7b85b5f0
commit beed39f13e
2 changed files with 8 additions and 2 deletions

View File

@@ -133,6 +133,9 @@ describe('NodesLayout', () => {
};
beforeEach(() => {
// clear feature flags
window.localStorage.clear();
options = {
nodeCache: makeMap(),
edgeCache: makeMap()
@@ -416,6 +419,9 @@ describe('NodesLayout', () => {
});
it('adds a new node to existing layout in a line', () => {
// feature flag
window.localStorage.setItem('scope-experimental:layout-dance', true);
let result = NodesLayout.doLayout(
nodeSets.rank4.nodes,
nodeSets.rank4.edges,

View File

@@ -1,7 +1,7 @@
import { storageGet, storageSet } from './storage-utils';
// prefix for all feature flags
const STORAGE_KEY_PREFIX = 'scope-experimental-';
const STORAGE_KEY_PREFIX = 'scope-experimental:';
const getKey = key => `${STORAGE_KEY_PREFIX}${key}`;
@@ -9,7 +9,7 @@ const getKey = key => `${STORAGE_KEY_PREFIX}${key}`;
* Returns true if `feature` is enabled
*
* Features can be enabled either via calling `setFeature()` or by setting
* `localStorage.scope-experimental-featureName = true` in the console.
* `localStorage.scope-experimental:featureName = true` in the console.
* @param {String} feature Feature name, ideally one word or hyphenated
* @return {Boolean} True if feature is enabled
*/