Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nav should react to plot_prep #2607

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/mass/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,12 @@ class TdbNav {
if (action.type.startsWith('filter')) return true
if (action.type.startsWith('cohort')) return true
if (action.type.startsWith('tab')) return true

// do not use startsWith('plot_') to exclude 'plot_edit' as no need for nav to react to that
if (action.type == 'plot_prep') return true
if (action.type == 'plot_create') return true
if (action.type == 'plot_delete') return true

if (action.type == 'app_refresh') return true
if (action.type.endsWith('_customTerm')) return true
if (action.type.endsWith('_group')) return true
Expand Down
2 changes: 2 additions & 0 deletions client/mass/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ TdbStore.prototype.actions = {
})
},

// dispatch "plot_prep" action to produce a 'initiating' UI of this plot, for user to fill in additional details to launch the plot
// example: table, scatterplot which requires user to select two terms
async plot_prep(action) {
const plot = {
id: 'id' in action ? action.id : getId()
Expand Down
76 changes: 0 additions & 76 deletions client/mass/test/nav.integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,82 +61,6 @@ tape('default hidden tabs, no filter', function (test) {
}
})

tape('chart buttons', function (test) {
test.timeoutAfter(3000)
runpp({
state: {
activeCohort: 0,
nav: {
header_mode: 'with_tabs'
}
},
nav: {
callbacks: {
'postRender.test': runTests
}
}
})
async function runTests(nav) {
for (const btn of nav.Inner.components.charts.Inner.dom.btns._groups[0]) {
// btn is native dom element, not d3-wrapped
if (btn.style.display == 'none') {
// hidden button means the chart is not supported in termdbtest
continue
}
/* chart button is visible
evaluate what happens after clicking it, based on the innerHTML of each button;
if a chart name is customized in termdbtest, the test must be updated here
must not trigger click before all if(), this will cause all previous temporary menu items to disappear
*/
switch (btn.innerHTML) {
case 'Data Dictionary':
btn.dispatchEvent(new Event('click'))
await detectOne({
elem: nav.Inner.app.Inner.dom.plotDiv.node(),
selector: '[data-testid=sjpp-massplot-sandbox-dictionary]'
})
test.pass('found sandbox after clicking chart button: ' + btn.innerHTML)
break
case 'Sample View':
btn.dispatchEvent(new Event('click'))
await detectOne({
elem: nav.Inner.app.Inner.dom.plotDiv.node(),
selector: '[data-testid=sjpp-massplot-sandbox-sampleView]'
})
test.pass('found sandbox after clicking chart button: ' + btn.innerHTML)
break
case 'Data Download':
btn.dispatchEvent(new Event('click'))
await detectOne({
elem: nav.Inner.app.Inner.dom.plotDiv.node(),
selector: '[data-testid=sjpp-massplot-sandbox-dataDownload]'
})
test.pass('found sandbox after clicking chart button: ' + btn.innerHTML)
break
case 'Summary Plots':
case 'Scatter Plot':
case 'Cumulative Incidence':
case 'Survival':
case 'Regression Analysis':
case 'Sample Matrix':
case 'Genome Browser':
case 'Facet Table':
case 'Gene Expression':
btn.dispatchEvent(new Event('click'))
await whenVisible(nav.Inner.components.charts.Inner.dom.tip.d.node())
test.pass('charts.dom.tip is shown after clicking chart button: ' + btn.innerHTML)
nav.Inner.components.charts.Inner.dom.tip.hide()
break
default:
test.fail('TODO: need test cover for chart button', btn.innerHTML)
}
}
if (test._ok) nav.Inner.app.destroy()
test.end()
}
})

tape('filter subheader and tab', function (test) {
test.timeoutAfter(3000)
runpp({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,19 @@ tape('Render Databrowser UI from runpp()', async test => {
await runproteinpaint({
holder,
noheader: true,
parseurl: true,
nobox: true,
tkui: 'databrowser'
})

const headers = ['Data Dictionary', 'Sample Annotation Matrix']
const headers = ['Data Dictionary']
const sectionFound = await detectGte({
elem: holder,
selector: '.sjpp-databrowser-section-header'
})
const headersFound = sectionFound.filter(elem => headers.some(h => h == elem.innerText))
test.equal(headersFound.length, sectionFound.length, `Should render all sections`)

// if (test._ok) holder.remove()
if (test._ok) holder.remove()
test.end()
})

Expand Down