Commit e5d7b705 authored by Amir Golparvar's avatar Amir Golparvar
Browse files

fixing linting an dgui tests

parent 3d606fe3
Pipeline #135899 failed with stages
in 76 minutes and 16 seconds
......@@ -27,7 +27,7 @@ import {
FormHelperText} from '@material-ui/core'
import { useRouteMatch, useHistory } from 'react-router-dom'
import Autocomplete from '@material-ui/lab/Autocomplete'
import Browser, { Item, Content, Compartment, Adaptor, formatSubSectionName, laneContext, useLane } from './Browser'
import Browser, { Item, Content, Compartment, Adaptor, formatSubSectionName, laneContext, useLane, browserContext } from './Browser'
import { RawFileAdaptor } from './FileBrowser'
import {
isEditable, PackageMDef, QuantityMDef, removeSubSection, resolveRef, resolveRefAsync, SectionMDef, SubSectionMDef,
......@@ -597,13 +597,14 @@ QuantityValue.propTypes = ({
})
const InheritingSections = React.memo(function InheritingSections({def, section, lane}) {
const browser = useContext(browserContext)
const selection = useMemo(() => {
return section?.m_def || null
}, [section])
const handleInheritingSectionsChange = useCallback((e) => {
section.m_def = e.target.value
lane.update()
}, [section.m_def, lane])
browser.invalidateLanesFromIndex(lane.index)
}, [section, browser, lane])
return (def._allInheritingSections?.length > 0 &&
<Box sx={{minWidth: 120}}>
......@@ -642,7 +643,7 @@ function Section({section, def, parentRelation}) {
const {editable, handleArchiveChanged} = useEntryContext() || {}
const config = useRecoilValue(configState)
const [showJson, setShowJson] = useState(false)
const lane = useLane()
const lane = useContext(laneContext)
const history = useHistory()
const navEntryId = useMemo(() => {
......
......@@ -19,7 +19,6 @@ import React from 'react'
import { join } from 'path'
import { waitFor } from '@testing-library/dom'
import userEvent from '@testing-library/user-event'
import { fireEvent } from '@testing-library/react'
import { render, screen, within, startAPI, closeAPI, blockConsoleOutput, unblockConsoleOutput, waitForGUI } from '../conftest.spec'
import { getLane, navigateTo, browseRecursively } from '../archive/conftest.spec'
import EntryContext from './EntryContext'
......@@ -105,8 +104,7 @@ test.each([
await browseRecursively(lane, laneIndex, join(`*ArchiveBrowser ${name}*`, path), archiveItemFilter, filterKeyLength)
}, 20 * minutes)
test.only('inheriting sections', async () => {
// closeAPI()
test('inheriting sections', async () => {
await startAPI('tests.states.uploads.archive_browser_test', 'inheriting_sectins', 'test', 'password')
render(<EntryContext entryId={'Z0mBq-MtZ0B2IFveOhFCFJMPCZgO'}><ArchiveEntryView /></EntryContext>)
......@@ -116,22 +114,13 @@ test.only('inheriting sections', async () => {
let sectionName = '../uploads/archive_browser_test/raw/inheriting-schema.archive.yaml#definitions/section_definitions/1'
await navigateTo(path)
userEvent.click(await screen.findByTestId(/subsection:subsectionbase1/i))
userEvent.click(await screen.findByTestId('subsection:C1'))
expect(await screen.findByText('Select an m_def from the list')).toBeInTheDocument()
const dropDown = await screen.findByTestId(`inheriting:SubSectionBase1`)
expect(dropDown).toBeInTheDocument()
const selectInput = within(dropDown).getByRole('textbox', { hidden: true })
// await waitForGUI()
// dropDown.focus()
// fireEvent.keyDown(dropDown, { key: 'ArrowDown' })
// fireEvent.keyDown(dropDown, { key: 'Enter' })
await waitForGUI()
await waitFor(() => expect(selectInput.value).toEqual(`${sectionName}`))
// const fruit = screen.getByTestId('inheriting:SubSectionBase1')
// fireEvent.change(fruit, { target: { value: 'SubSectionDescendant2' } })
})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment