Skip to content

Commit

Permalink
Fix act test warnings on hic test (#1971)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin authored May 17, 2021
1 parent 25cad08 commit 905e690
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,30 @@ const LoadingMessage = observer(({ model }: { model: any }) => {
const [shown, setShown] = useState(false)
const classes = useStyles()
useEffect(() => {
const timeout = setTimeout(() => setShown(true), 300)
return () => clearTimeout(timeout)
let killed = false
const timeout = setTimeout(() => {
if (!killed) {
setShown(true)
}
}, 300)
return () => {
clearTimeout(timeout)
killed = true
}
}, [])

const { status: blockStatus } = model
const { message: displayStatus } = getParent(model, 2)
const status = displayStatus || blockStatus
return shown ? (
<div className={classes.loading}>
<div className={classes.dots}>{status ? `${status}` : 'Loading'}</div>
</div>
) : null
return (
<>
{shown ? (
<div className={classes.loading}>
<div className={classes.dots}>{status ? `${status}` : 'Loading'}</div>
</div>
) : null}
</>
)
})

function BlockMessage({
Expand Down
5 changes: 0 additions & 5 deletions products/jbrowse-web/src/tests/Hic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ hicConfig.configuration = {
},
}

function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}

test('hic', async () => {
fetch.resetMocks()
fetch.mockResponse(
Expand All @@ -40,7 +36,6 @@ test('hic', async () => {
)
state.session.views[0].setNewView(5000, 0)
fireEvent.click(await findByTestId('htsTrackEntry-hic_test'))
await timeout(1000)
const canvas = await findAllByTestId(
'prerendered_canvas',
{},
Expand Down

0 comments on commit 905e690

Please sign in to comment.