mirror of
https://github.com/nasa/openmct.git
synced 2025-01-19 03:06:54 +00:00
[Tabs] Fix "Eager Load Tabs" option (#4371)
* If eager load is checked, tabs are pre-fetched and kept alive. * If eager load is not checked, tabs are not pre-fetched, and are not kept alive
This commit is contained in:
parent
e59e4efdf0
commit
4e325fb165
@ -152,6 +152,10 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
addTabToLoaded(tab) {
|
||||
if (!this.internalDomainObject.keep_alive) {
|
||||
this.loadedTabs = {};
|
||||
}
|
||||
|
||||
this.loadedTabs[tab.keyString] = true;
|
||||
},
|
||||
setCurrentTabByIndex(index) {
|
||||
|
@ -173,9 +173,34 @@ describe('the plugin', function () {
|
||||
return Vue.nextTick();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
count = 0;
|
||||
});
|
||||
|
||||
it ('renders a tab for each item', () => {
|
||||
let tabEls = element.querySelectorAll('.js-tab');
|
||||
|
||||
expect(tabEls.length).toEqual(2);
|
||||
});
|
||||
|
||||
describe('with domainObject.keep_alive set to', () => {
|
||||
|
||||
it ('true, will keep all views loaded, regardless of current tab view', () => {
|
||||
let tabViewEls = element.querySelectorAll('.c-tabs-view__object');
|
||||
|
||||
expect(tabViewEls.length).toEqual(2);
|
||||
});
|
||||
|
||||
it ('false, will only keep the current tab view loaded', async () => {
|
||||
testViewObject.keep_alive = false;
|
||||
|
||||
await Vue.nextTick();
|
||||
|
||||
let tabViewEls = element.querySelectorAll('.c-tabs-view__object');
|
||||
|
||||
expect(tabViewEls.length).toEqual(1);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user