diff --git a/src/shell/boards/board-container.test.tsx b/src/shell/boards/board-container.test.tsx index 3a484ccc..7fe2aa0e 100644 --- a/src/shell/boards/board-container.test.tsx +++ b/src/shell/boards/board-container.test.tsx @@ -692,6 +692,7 @@ describe('Board container', () => { jest.advanceTimersToNextTimer(); }); const board = screen.getByTestId(TESTID_SELECTORS.board); + const elementForMove = screen.getByTestId(TESTID_SELECTORS.boardHeader); const boardInitialSizeAndPos = buildBoardSizeAndPosition(); const boardNewPosition = { top: 0, @@ -702,7 +703,8 @@ describe('Board container', () => { boardInitialSizeAndPos, { clientX: boardInitialSizeAndPos.clientLeft, clientY: boardInitialSizeAndPos.clientTop }, { clientX: 0, clientY: 0 }, - boardNewPosition + boardNewPosition, + elementForMove ); expect(board).toHaveStyle({ height: '70vh', @@ -719,6 +721,7 @@ describe('Board container', () => { jest.advanceTimersToNextTimer(); }); const board = screen.getByTestId(TESTID_SELECTORS.board); + const elementForMove = screen.getByTestId(TESTID_SELECTORS.boardHeader); let boardInitialSizeAndPos = buildBoardSizeAndPosition(); let boardNewPosition = { top: 10, @@ -729,7 +732,8 @@ describe('Board container', () => { boardInitialSizeAndPos, { clientX: boardInitialSizeAndPos.clientLeft, clientY: boardInitialSizeAndPos.clientTop }, { clientX: 10, clientY: 10 }, - boardNewPosition + boardNewPosition, + elementForMove ); boardInitialSizeAndPos = buildBoardSizeAndPosition({ ...boardInitialSizeAndPos, @@ -744,7 +748,8 @@ describe('Board container', () => { boardInitialSizeAndPos, { clientX: boardInitialSizeAndPos.clientLeft, clientY: boardInitialSizeAndPos.clientTop }, { clientX: 80, clientY: 50 }, - boardNewPosition + boardNewPosition, + elementForMove ); expect(board).toHaveStyle({ height: '70vh', @@ -762,6 +767,7 @@ describe('Board container', () => { }); const border: Border = 'n'; const board = screen.getByTestId(TESTID_SELECTORS.board); + const elementForMove = screen.getByTestId(TESTID_SELECTORS.boardHeader); const boardInitialSizeAndPos = buildBoardSizeAndPosition(); const mouseInitialPos = buildMousePosition(border, boardInitialSizeAndPos); const deltaY = -50; @@ -793,7 +799,8 @@ describe('Board container', () => { clientY: boardNewInitialSizeAndPos.clientTop }, { clientX: 0, clientY: 0 }, - boardNewSizeAndPos + boardNewSizeAndPos, + elementForMove ); expect(board).toHaveStyle({ height: `${boardNewSizeAndPos.height}px`, @@ -811,6 +818,7 @@ describe('Board container', () => { }); const border: Border = 'n'; const board = screen.getByTestId(TESTID_SELECTORS.board); + const elementForMove = screen.getByTestId(TESTID_SELECTORS.boardHeader); const boardInitialSizeAndPos = buildBoardSizeAndPosition(); const mouseInitialPos = buildMousePosition(border, boardInitialSizeAndPos); const deltaY = -50; @@ -844,7 +852,8 @@ describe('Board container', () => { boardInitialSizeAndPos, { clientX: boardInitialSizeAndPos.clientLeft, clientY: boardInitialSizeAndPos.clientTop }, { clientX: 0, clientY: 0 }, - boardNewPos + boardNewPos, + elementForMove ); expect(board).toHaveStyle({ height: '70vh', @@ -869,6 +878,7 @@ describe('Board container', () => { jest.advanceTimersToNextTimer(); }); const board = screen.getByTestId(TESTID_SELECTORS.board); + const elementForMove = screen.getByTestId(TESTID_SELECTORS.boardHeader); const actionElement = getAllByRoleWithIcon('button', { icon })[0]; let boardInitialSizeAndPos = buildBoardSizeAndPosition(); let boardNewPosition = { @@ -880,7 +890,8 @@ describe('Board container', () => { boardInitialSizeAndPos, { clientX: boardInitialSizeAndPos.clientLeft, clientY: boardInitialSizeAndPos.clientTop }, { clientX: 0, clientY: 0 }, - boardNewPosition + boardNewPosition, + elementForMove ); boardInitialSizeAndPos = buildBoardSizeAndPosition({ ...boardInitialSizeAndPos, @@ -986,6 +997,7 @@ describe('Board container', () => { jest.advanceTimersToNextTimer(); }); const board = screen.getByTestId(TESTID_SELECTORS.board); + const elementForMove = screen.getByTestId(TESTID_SELECTORS.boardHeader); const boardInitialSizeAndPos = buildBoardSizeAndPosition(); const boardNewPosition = { top: 0, @@ -996,7 +1008,8 @@ describe('Board container', () => { boardInitialSizeAndPos, { clientX: boardInitialSizeAndPos.clientLeft, clientY: boardInitialSizeAndPos.clientTop }, { clientX: 0, clientY: 0 }, - boardNewPosition + boardNewPosition, + elementForMove ); await user.click(getByRoleWithIcon('button', { icon: ICONS.closeBoard })); act(() => { diff --git a/src/shell/boards/board-container.tsx b/src/shell/boards/board-container.tsx index c1fdaeff..97d147ef 100644 --- a/src/shell/boards/board-container.tsx +++ b/src/shell/boards/board-container.tsx @@ -354,7 +354,6 @@ export const BoardContainer = (): React.JSX.Element | null => { ref={boardRef} width={currentBoardSizeAndPosition.width} height={currentBoardSizeAndPosition.height} - onMouseDown={(!expanded && moveElementHandler) || undefined} > { localStorageKey={LOCAL_STORAGE_BOARD_SIZE} disabled={expanded} > - + diff --git a/src/shell/boards/board.tsx b/src/shell/boards/board.tsx index 79ffa44b..cec07c73 100644 --- a/src/shell/boards/board.tsx +++ b/src/shell/boards/board.tsx @@ -15,7 +15,6 @@ import { Board } from '../../../types'; import AppContextProvider from '../../boot/app/app-context-provider'; import { useAppStore } from '../../store/app'; import { BoardProvider, updateBoard, useBoardStore } from '../../store/boards'; -import { stopPropagation } from '../../utils/utils'; const BoardContainer = styled.div<{ show: boolean }>` display: ${(props): string => (props.show ? 'block' : 'none')}; @@ -75,7 +74,7 @@ export const AppBoard: FC<{ board: Board }> = ({ board }) => { }, [board.url, history]); return ( - + {route} ); diff --git a/src/shell/shell-view.test.tsx b/src/shell/shell-view.test.tsx index 73dd6f22..e3d345b7 100644 --- a/src/shell/shell-view.test.tsx +++ b/src/shell/shell-view.test.tsx @@ -83,6 +83,7 @@ describe('Shell view', () => { }); const border: Border = 'n'; const board = screen.getByTestId(TESTID_SELECTORS.board); + const elementForMove = screen.getByTestId(TESTID_SELECTORS.boardHeader); let boardInitialSizeAndPos = buildBoardSizeAndPosition(); const mouseInitialPos = buildMousePosition(border, boardInitialSizeAndPos); const deltaY = -50; @@ -111,7 +112,8 @@ describe('Shell view', () => { boardInitialSizeAndPos, { clientX: boardInitialSizeAndPos.clientLeft, clientY: boardInitialSizeAndPos.clientTop }, { clientX: 500, clientY: 500 }, - boardNewSizeAndPos + boardNewSizeAndPos, + elementForMove ); await user.click(getByRoleWithIcon('button', { icon: ICONS.collapseBoard })); await user.click(getByRoleWithIcon('button', { icon: ICONS.unCollapseBoard })); @@ -191,6 +193,7 @@ describe('Shell view', () => { }); const border: Border = 'n'; const board = screen.getByTestId(TESTID_SELECTORS.board); + const elementForMove = screen.getByTestId(TESTID_SELECTORS.boardHeader); let boardInitialSizeAndPos = buildBoardSizeAndPosition(); const mouseInitialPos = buildMousePosition(border, boardInitialSizeAndPos); const deltaY = -50; @@ -214,7 +217,8 @@ describe('Shell view', () => { boardInitialSizeAndPos, { clientX: boardInitialSizeAndPos.clientLeft, clientY: boardInitialSizeAndPos.clientTop }, { clientX: 0, clientY: 0 }, - boardNewSizeAndPos + boardNewSizeAndPos, + elementForMove ); await user.click(getAllByRoleWithIcon('button', { icon: ICONS.close })[0]); // update state to open a new board @@ -236,6 +240,7 @@ describe('Shell view', () => { jest.advanceTimersToNextTimer(); }); const board2Element = screen.getByTestId(TESTID_SELECTORS.board); + const elementForMove2 = screen.getByTestId(TESTID_SELECTORS.boardHeader); boardInitialSizeAndPos = buildBoardSizeAndPosition({ ...INITIAL_SIZE_AND_POS, width: boardNewSizeAndPos.width, @@ -247,7 +252,8 @@ describe('Shell view', () => { boardInitialSizeAndPos, { clientX: boardInitialSizeAndPos.clientLeft, clientY: boardInitialSizeAndPos.clientTop }, { clientX: 80, clientY: 55 }, - boardNewSizeAndPos + boardNewSizeAndPos, + elementForMove2 ); expect(board2Element).toHaveStyle({ height: `${boardNewSizeAndPos.height}px`, diff --git a/src/test/constants.ts b/src/test/constants.ts index 326f13c6..43e182e0 100644 --- a/src/test/constants.ts +++ b/src/test/constants.ts @@ -144,6 +144,7 @@ export const ICONS = { export const TESTID_SELECTORS = { board: 'NewItemContainer', + boardHeader: 'BoardHeader', checkbox: 'checkbox', dropdown: 'dropdown-popper-list', resizableBorder(border: Border): string {