Skip to content

Commit

Permalink
chore(client): rename tabHistory to navigationHistory
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Kiefer committed Nov 28, 2018
1 parent 563904d commit a830a8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions client/src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class App extends Component {
this.tabComponentCache = {};

// TODO(nikku): make state
this.tabHistory = new History();
this.navigationHistory = new History();

// TODO(nikku): make state
this.closedTabs = new History();
Expand Down Expand Up @@ -147,9 +147,9 @@ export class App extends Component {
return tabShown.promise;
}

const tabHistory = this.tabHistory;
const navigationHistory = this.navigationHistory;

tabHistory.push(tab);
navigationHistory.push(tab);

return this.setActiveTab(tab);
}
Expand All @@ -170,9 +170,9 @@ export class App extends Component {
return getNextTab(tabs, activeTab, direction);
};

const tabHistory = this.tabHistory;
const navigationHistory = this.navigationHistory;

const nextActiveTab = tabHistory.navigate(direction, nextFn);
const nextActiveTab = navigationHistory.navigate(direction, nextFn);

return this.setActiveTab(nextActiveTab);
}
Expand Down Expand Up @@ -270,7 +270,7 @@ export class App extends Component {
});

// replace in navigation history
const navigationHistory = this.tabHistory;
const navigationHistory = this.navigationHistory;
navigationHistory.replace(tab, updatedTab);

return updatedTab;
Expand All @@ -288,7 +288,7 @@ export class App extends Component {
}

if (tab !== EMPTY_TAB) {
const navigationHistory = this.tabHistory;
const navigationHistory = this.navigationHistory;

if (navigationHistory.get() !== tab) {
navigationHistory.push(tab);
Expand Down Expand Up @@ -339,7 +339,7 @@ export class App extends Component {
} = this.state;

const {
tabHistory,
navigationHistory,
closedTabs
} = this;

Expand All @@ -351,7 +351,7 @@ export class App extends Component {

const newTabs = tabs.filter(t => t !== tab);

tabHistory.purge(tab);
navigationHistory.purge(tab);

if (!isNew(tab)) {
closedTabs.push(tab);
Expand All @@ -363,7 +363,7 @@ export class App extends Component {

// open previous tab, if it exists
const nextActive = (
tabHistory.get() ||
navigationHistory.get() ||
newTabs[tabIdx] ||
newTabs[tabIdx - 1] ||
EMPTY_TAB
Expand Down
12 changes: 6 additions & 6 deletions client/src/app/__tests__/AppSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1040,11 +1040,11 @@ describe('<App>', function() {
await app.triggerAction('close-all-tabs');

// then
const tabHistory = app.tabHistory;
const navigationHistory = app.navigationHistory;

expect(tabHistory.elements).to.be.empty;
expect(tabHistory.idx).to.eql(-1);
expect(tabHistory.get()).not.to.exist;
expect(navigationHistory.elements).to.be.empty;
expect(navigationHistory.idx).to.eql(-1);
expect(navigationHistory.get()).not.to.exist;
});

});
Expand Down Expand Up @@ -1580,10 +1580,10 @@ describe('<App>', function() {
const updatedTab = await app.updateTab(tab, newAttrs);

const {
tabHistory
navigationHistory
} = app;

const tabs = tabHistory.elements;
const tabs = navigationHistory.elements;

// then
expect(tabs).to.not.include(tab);
Expand Down

0 comments on commit a830a8d

Please sign in to comment.