diff --git a/package.json b/package.json index 949b8a8..111bdb9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "kingly", "sideEffects": false, - "version": "0.24.0", + "version": "0.24.1", "description": "Extended Hierarchical State Transducer library", "repository": { "type": "git", diff --git a/src/helpers.js b/src/helpers.js index 67a8a4e..af0ac7c 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -376,7 +376,7 @@ export function computeHistoryMaps(control_states) { const {getLabel, isLeafLabel} = objectTreeLenses; const traverse = { strategy: PRE_ORDER, - seed: {stateList: [], stateAncestors: {[DEEP]: {}, [SHALLOW]: {}}}, + seed: {stateList: [], stateAncestors: {}}, visit: (acc, traversalState, tree) => { const treeLabel = getLabel(tree); const controlState = Object.keys(treeLabel)[0]; @@ -393,7 +393,7 @@ export function computeHistoryMaps(control_states) { } else { const parentControlState = traversalState.get(JSON.stringify(parentPath)); - acc.stateAncestors[SHALLOW][controlState] = [parentControlState]; + acc.stateAncestors[controlState] = [parentControlState]; const {ancestors} = path.reduce((acc, _) => { const parentPath = acc.path.slice(0, -1); @@ -405,7 +405,7 @@ export function computeHistoryMaps(control_states) { return acc }, {ancestors: [], path}); - acc.stateAncestors[DEEP][controlState] = ancestors; + acc.stateAncestors[controlState] = ancestors; } return acc @@ -554,7 +554,7 @@ export function updateHistory(history, stateAncestors, state_from_name) { } else { // ancestors for the state which is exited - const ancestors = stateAncestors[DEEP][state_from_name] || []; + const ancestors = stateAncestors[state_from_name] || []; ancestors.reduce((oldAncestor, newAncestor) => { // set the exited state in the history of all ancestors history[DEEP][newAncestor] = state_from_name; diff --git a/test/index.js b/test/index.js index 16f3ce5..8c40912 100644 --- a/test/index.js +++ b/test/index.js @@ -1,15 +1,15 @@ -// import './no-hierarchy.specs' -// import './no-hierarchy-with-init-control-state-specs' -// import "./convert-to-plantuml.specs" -// import "./online_visualizer_translation.specs" -// import "./fsm_trace.specs" -// import "./utils.specs" -// import './hierarchy.specs' -// import './debug-settings-specs' -// import './contracts.specs' -// import './entry-actions.specs' -// import './errors-specs' -// import './contracts.ad-hoc.specs' -// import './issue-4.specs' +import './no-hierarchy.specs' +import './no-hierarchy-with-init-control-state-specs' +import "./convert-to-plantuml.specs" +import "./online_visualizer_translation.specs" +import "./fsm_trace.specs" +import "./utils.specs" +import './hierarchy.specs' +import './debug-settings-specs' +import './contracts.specs' +import './entry-actions.specs' +import './errors-specs' +import './contracts.ad-hoc.specs' +import './issue-4.specs' import './issue-5.specs' QUnit.dump.maxDepth = 50; diff --git a/test/utils.specs.js b/test/utils.specs.js index fe211ba..c13543a 100644 --- a/test/utils.specs.js +++ b/test/utils.specs.js @@ -277,7 +277,6 @@ QUnit.test("states with hierarchy", function exec_test(assert) { const history = computeHistoryMaps(states); assert.deepEqual(history, { "stateAncestors": { - "deep": { "INNER": [ "OUTER" ], @@ -295,14 +294,6 @@ QUnit.test("states with hierarchy", function exec_test(assert) { "outer_b": [ "OUTER" ] - }, - "shallow": { - "INNER": ["OUTER"], - "inner_s": ["INNER"], - "inner_t": ["INNER"], - "outer_a": ["OUTER"], - "outer_b": ["OUTER"] - } }, "stateList": [ "OUTER",