refactor: changed nav store to use nav index and selector instead of initNav action

This commit is contained in:
Torkel Ödegaard
2018-09-02 10:36:36 -07:00
parent 2ac202b22f
commit 7b06800295
17 changed files with 174 additions and 202 deletions

View File

@@ -20,3 +20,24 @@ configure({ adapter: new Adapter() });
const global = <any>window;
global.$ = global.jQuery = $;
const localStorageMock = (function() {
var store = {};
return {
getItem: function(key) {
return store[key];
},
setItem: function(key, value) {
store[key] = value.toString();
},
clear: function() {
store = {};
},
removeItem: function(key) {
delete store[key];
},
};
})();
global.localStorage = localStorageMock;
// Object.defineProperty(window, 'localStorage', { value: localStorageMock });

View File

@@ -20,7 +20,7 @@ export function createNavTree(...args) {
return root;
}
export function getNavModel(title: string, tabs: string[]): NavModel {
export function createNavModel(title: string, ...tabs: string[]): NavModel {
const node: NavModelItem = {
id: title,
text: title,
@@ -38,9 +38,12 @@ export function getNavModel(title: string, tabs: string[]): NavModel {
subTitle: 'subTitle',
url: title,
text: title,
active: false,
});
}
node.children[0].active = true;
return {
node: node,
main: node,