-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updte docker ignore * Move the MiniMapBtn and LayoutBtn to the new ControlCenter component which wraps and extends react-flow's Controls component ControlCenter's layout button toggle the layout direction (horizontal or vertical) Control Center renders a layout button minimap control button toggle map visibility Added benefit, this eliminates all the css associated with the previous control buttons render MiniMapBtn in out ControlCenter convert MiniMapBtn and LayoutBtn's from html native <button/> elements to react flow <ControlButton/> elements move ControlCenter component source tree to under the Tree component directory remove control buttons from Header * update css so our usage do not use react-flow internals * 0.5.0
- Loading branch information
1 parent
f54b902
commit 1d23ef1
Showing
19 changed files
with
179 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
# Configs | ||
.gitignore | ||
.dockerignore | ||
README.md | ||
.editorconfig | ||
.eslintrc.cjs | ||
.prettier* | ||
.github | ||
__mocks__ | ||
docs | ||
node_modules/ | ||
**/.idea | ||
.run | ||
coverage | ||
.git | ||
Dockerfile | ||
**/compose.* | ||
|
||
|
||
# Documentation | ||
**/README.md | ||
docs | ||
LICENSE | ||
|
||
|
||
# TS/JS | ||
**/node_modules/ | ||
**/*.d.ts | ||
**/*.spec.* | ||
__mocks__ | ||
**/coverage | ||
**/build |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
src/components/Header/Controls/LayoutBtn/layoutbtn.module.css
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/components/Header/Controls/MiniMapBtn/minimapbtn.module.css
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,8 +29,3 @@ | |
margin: 0; | ||
} | ||
|
||
.headerControls { | ||
display: flex; | ||
align-items: center; | ||
justify-content: end; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import '@testing-library/jest-dom'; | ||
import { cleanup, render, screen } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { ControlCenter } from 'components/Tree/ControlCenter/index'; | ||
import { ReactFlowProvider } from 'reactflow'; | ||
import { DagDirection } from 'store/DagSlice/dagSlice'; | ||
import { afterEach, describe, expect, it, vi } from 'vitest'; | ||
|
||
interface TestComponentProps { | ||
mapVisible?: boolean; | ||
setMapVisible?: (visible: boolean) => void; | ||
direction?: DagDirection; | ||
setDirection?: (direction: DagDirection) => void; | ||
} | ||
|
||
const TestComponent = ({ ...props }: TestComponentProps) => { | ||
const dummyFunc = () => undefined; | ||
const mapVisible = props?.mapVisible ?? true; | ||
const onClick = props?.setMapVisible ?? dummyFunc; | ||
const setDirection = props?.setDirection ?? dummyFunc; | ||
const direction = props?.direction ?? 'TB'; | ||
|
||
return ( | ||
<ReactFlowProvider> | ||
<ControlCenter | ||
mapVisible={mapVisible} | ||
setMapVisible={onClick} | ||
direction={direction} | ||
setDirection={setDirection} | ||
/> | ||
</ReactFlowProvider> | ||
); | ||
}; | ||
|
||
afterEach(() => cleanup()); | ||
|
||
describe('ControlCenter', () => { | ||
it('renders', () => { | ||
render(<TestComponent />); | ||
expect(screen.getByTestId('controlCenter')).toBeInTheDocument(); | ||
}); | ||
it('renders a map toggle button', () => { | ||
render(<TestComponent />); | ||
expect(screen.getByRole('button', { name: /minimap/i })).toBeInTheDocument(); | ||
}); | ||
it('toggles the minimap visibility', async () => { | ||
const user = userEvent.setup(); | ||
const setMapVisible = vi.fn(); | ||
const { rerender } = render(<TestComponent mapVisible={true} setMapVisible={setMapVisible} />); | ||
await user.click(screen.getByRole('button', { name: /minimap/i })); | ||
expect(setMapVisible).toHaveBeenCalled(); | ||
rerender(<TestComponent setMapVisible={setMapVisible} />); | ||
await user.click(screen.getByRole('button', { name: /minimap/i })); | ||
expect(setMapVisible).toHaveBeenCalled(); | ||
}); | ||
it('renders a layout toggle button', () => { | ||
render(<TestComponent />); | ||
expect(screen.getByRole('button', { name: /layout/i })).toBeInTheDocument(); | ||
}); | ||
it('toggles the layout direction', async () => { | ||
const user = userEvent.setup(); | ||
const setDirection = vi.fn(); | ||
const { rerender } = render(<TestComponent setDirection={setDirection} direction={'LR'} />); | ||
await user.click(screen.getByRole('button', { name: /layout/i })); | ||
expect(setDirection).toHaveBeenCalled(); | ||
rerender(<TestComponent setDirection={setDirection} />); | ||
await user.click(screen.getByRole('button', { name: /layout/i })); | ||
expect(setDirection).toHaveBeenCalled(); | ||
}); | ||
}); |
Oops, something went wrong.