Skip to content

Commit

Permalink
Merge pull request #316 from weaveworks/297-close-details
Browse files Browse the repository at this point in the history
Close details when changing topologies
  • Loading branch information
davkal committed Jul 20, 2015
2 parents 9a314b1 + dfd158c commit 7b1b873
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions client/app/scripts/stores/__tests__/app-store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,23 @@ describe('AppStore', function() {
expect(AppStore.getNodes()).toEqual(NODE_SET);
});

it('closes details when changing topologies', function() {
registeredCallback(ReceiveTopologiesAction);
registeredCallback(ClickTopologyAction);
registeredCallback(ReceiveNodesDeltaAction);

expect(AppStore.getAppState())
.toEqual({"topologyId":"topo1","selectedNodeId": null});

registeredCallback(ClickNodeAction);
expect(AppStore.getAppState())
.toEqual({"topologyId":"topo1","selectedNodeId": 'n1'});

registeredCallback(ClickSubTopologyAction);
expect(AppStore.getAppState())
.toEqual({"topologyId":"topo1-grouped","selectedNodeId": null});
});

// connection errors

it('resets topology on websocket reconnect', function() {
Expand Down
1 change: 1 addition & 0 deletions client/app/scripts/stores/app-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ AppStore.registeredCallback = function(payload) {
break;

case ActionTypes.CLICK_TOPOLOGY:
selectedNodeId = null;
if (payload.topologyId !== currentTopologyId) {
currentTopologyId = payload.topologyId;
nodes = {};
Expand Down

0 comments on commit 7b1b873

Please sign in to comment.