mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 18:18:53 +08:00
Loading remote database and inquiries #109
This commit is contained in:
@@ -19,7 +19,9 @@ describe('Inquiries.vue', () => {
|
||||
predefinedInquiries: []
|
||||
}
|
||||
const mutations = {
|
||||
updatePredefinedInquiries: sinon.stub()
|
||||
setPredefinedInquiriesLoaded: sinon.stub(),
|
||||
updatePredefinedInquiries: sinon.stub(),
|
||||
setLoadingPredefinedInquiries: sinon.stub()
|
||||
}
|
||||
const store = new Vuex.Store({ state, mutations })
|
||||
const wrapper = shallowMount(Inquiries, { store })
|
||||
@@ -327,6 +329,7 @@ describe('Inquiries.vue', () => {
|
||||
sinon.stub(storedInquiries, 'getStoredInquiries').returns([inquiryInStorage])
|
||||
|
||||
const state = {
|
||||
tabs: [],
|
||||
predefinedInquiries: []
|
||||
}
|
||||
const actions = { addTab: sinon.stub().resolves(1) }
|
||||
|
||||
@@ -406,4 +406,119 @@ describe('Tab.vue', () => {
|
||||
expect(wrapper.find('.above .sql-editor-panel').exists()).to.equal(true)
|
||||
expect(wrapper.find('.bottomPane .run-result-panel').exists()).to.equal(true)
|
||||
})
|
||||
|
||||
it('Maximize top panel if maximized panel is above', () => {
|
||||
const state = {
|
||||
currentTabId: 1
|
||||
}
|
||||
const store = new Vuex.Store({ state, mutations })
|
||||
const tab = {
|
||||
id: 1,
|
||||
name: 'foo',
|
||||
query: 'SELECT * FROM foo; CREATE TABLE bar(a,b);',
|
||||
viewType: 'chart',
|
||||
viewOptions: {},
|
||||
layout: {
|
||||
sqlEditor: 'above',
|
||||
table: 'bottom',
|
||||
dataView: 'hidden'
|
||||
},
|
||||
maximize: 'sqlEditor',
|
||||
isPredefined: false,
|
||||
result: null,
|
||||
isGettingResults: false,
|
||||
error: null,
|
||||
time: 0,
|
||||
isSaved: true
|
||||
}
|
||||
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
store,
|
||||
stubs: ['chart'],
|
||||
propsData: {
|
||||
tab
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.find('.above').element.parentElement.style.height)
|
||||
.to.equal('100%')
|
||||
})
|
||||
|
||||
it('Maximize bottom panel if maximized panel is below', () => {
|
||||
const state = {
|
||||
currentTabId: 1
|
||||
}
|
||||
const store = new Vuex.Store({ state, mutations })
|
||||
const tab = {
|
||||
id: 1,
|
||||
name: 'foo',
|
||||
query: 'SELECT * FROM foo; CREATE TABLE bar(a,b);',
|
||||
viewType: 'chart',
|
||||
viewOptions: {},
|
||||
layout: {
|
||||
sqlEditor: 'above',
|
||||
table: 'bottom',
|
||||
dataView: 'hidden'
|
||||
},
|
||||
maximize: 'table',
|
||||
isPredefined: false,
|
||||
result: null,
|
||||
isGettingResults: false,
|
||||
error: null,
|
||||
time: 0,
|
||||
isSaved: true
|
||||
}
|
||||
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
store,
|
||||
stubs: ['chart'],
|
||||
propsData: {
|
||||
tab
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.find('.bottomPane').element.parentElement.style.height)
|
||||
.to.equal('100%')
|
||||
})
|
||||
|
||||
it('Panel size is 50 is nothing to maximize', () => {
|
||||
const state = {
|
||||
currentTabId: 1
|
||||
}
|
||||
const store = new Vuex.Store({ state, mutations })
|
||||
const tab = {
|
||||
id: 1,
|
||||
name: 'foo',
|
||||
query: 'SELECT * FROM foo; CREATE TABLE bar(a,b);',
|
||||
viewType: 'chart',
|
||||
viewOptions: {},
|
||||
layout: {
|
||||
sqlEditor: 'above',
|
||||
table: 'bottom',
|
||||
dataView: 'hidden'
|
||||
},
|
||||
isPredefined: false,
|
||||
result: null,
|
||||
isGettingResults: false,
|
||||
error: null,
|
||||
time: 0,
|
||||
isSaved: true
|
||||
}
|
||||
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
store,
|
||||
stubs: ['chart'],
|
||||
propsData: {
|
||||
tab
|
||||
}
|
||||
})
|
||||
|
||||
expect(wrapper.find('.above').element.parentElement.style.height)
|
||||
.to.equal('50%')
|
||||
expect(wrapper.find('.bottomPane').element.parentElement.style.height)
|
||||
.to.equal('50%')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -12,9 +12,11 @@ describe('Workspace.vue', () => {
|
||||
tabs: []
|
||||
}
|
||||
const store = new Vuex.Store({ state, actions, mutations })
|
||||
const $route = { path: '/workspace', query: {} }
|
||||
mount(Workspace, {
|
||||
store,
|
||||
stubs: ['router-link']
|
||||
stubs: ['router-link'],
|
||||
mocks: { $route }
|
||||
})
|
||||
|
||||
expect(state.tabs[0].query).to.include('Your database is empty.')
|
||||
@@ -24,4 +26,20 @@ describe('Workspace.vue', () => {
|
||||
expect(state.tabs[0].viewOptions).to.equal(undefined)
|
||||
expect(state.tabs[0].isSaved).to.equal(false)
|
||||
})
|
||||
|
||||
it('Collapse schema if hide_schema is 1', () => {
|
||||
const state = {
|
||||
db: {},
|
||||
tabs: []
|
||||
}
|
||||
const store = new Vuex.Store({ state, actions, mutations })
|
||||
const $route = { path: '/workspace', query: { hide_schema: '1' } }
|
||||
const vm = mount(Workspace, {
|
||||
store,
|
||||
stubs: ['router-link'],
|
||||
mocks: { $route }
|
||||
})
|
||||
|
||||
expect(vm.find('#schema-container').element.offsetWidth).to.equal(0)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user