Skip to content

Commit

Permalink
Fix failing tests and add (still empty) new tests #1234
Browse files Browse the repository at this point in the history
  • Loading branch information
Nereboss committed Jan 10, 2024
1 parent 0386918 commit 34b847e
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ describe("codeMapMouseEventService", () => {

it("should call selectBuilding when no building is selected", () => {
threeSceneService.getSelectedBuilding = jest.fn()
threeSceneService.getLabelForHoveredNode = jest.fn()
threeSceneService.animateLabel = jest.fn()

codeMapMouseEventService["intersectedBuilding"] = codeMapBuilding

codeMapMouseEventService.onDocumentMouseUp(event)
Expand All @@ -530,6 +533,9 @@ describe("codeMapMouseEventService", () => {

it("should call selectBuilding when a new building is selected", () => {
threeSceneService.getSelectedBuilding = jest.fn().mockReturnValue(new CodeMapBuilding(200, null, null, null))
threeSceneService.getLabelForHoveredNode = jest.fn()
threeSceneService.animateLabel = jest.fn()

codeMapMouseEventService["intersectedBuilding"] = codeMapBuilding

codeMapMouseEventService.onDocumentMouseUp(event)
Expand All @@ -548,6 +554,9 @@ describe("codeMapMouseEventService", () => {
})

it("should not call clearSelection, when the mouse has moved less or exact 3 pixels but a building is currently being clicked upon", () => {
threeSceneService.getLabelForHoveredNode = jest.fn()
threeSceneService.animateLabel = jest.fn()

codeMapMouseEventService.onDocumentMouseMove(event)
codeMapMouseEventService.onDocumentMouseDown(event)
codeMapMouseEventService.onDocumentMouseMove({ clientX: 10, clientY: 17 } as MouseEvent)
Expand Down Expand Up @@ -817,7 +826,7 @@ describe("codeMapMouseEventService", () => {
threeSceneService.getLabelForHoveredNode = jest.fn()
codeMapLabelService.addLeafLabel = jest.fn()

codeMapMouseEventService["drawTemporaryLabelFor"](codeMapBuilding, null)
codeMapMouseEventService["drawTemporaryLabelFor"](codeMapBuilding)
const nodeHeight = codeMapBuilding.node.height + Math.abs(codeMapBuilding.node.heightDelta ?? 0)

expect(threeSceneService.getLabelForHoveredNode).toHaveBeenCalled()
Expand All @@ -829,10 +838,20 @@ describe("codeMapMouseEventService", () => {
threeSceneService.getLabelForHoveredNode = jest.fn()
codeMapLabelService.addLeafLabel = jest.fn()

codeMapMouseEventService["drawTemporaryLabelFor"](codeMapBuilding, null)
codeMapMouseEventService["drawTemporaryLabelFor"](codeMapBuilding)

expect(threeSceneService.getLabelForHoveredNode).toHaveBeenCalled()
expect(codeMapLabelService.addLeafLabel).toHaveBeenCalledWith(codeMapBuilding.node, 0, true)
})
})

describe("labelForSelectedBuilding", () => {
it("should create a label when clicking on a building", () => {})

it("should remove the label when the building is unselected", () => {})

it("should remove the old and create the new label when selected building is changed", () => {})

it("should keep the label when clicking on the already selected building", () => {})
})
})

0 comments on commit 34b847e

Please sign in to comment.