-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enabling/Disabling floor labels in settings (#3175)
Implement feature, Add store entry, Add tests Co-authored-by: RomanenkoVladimir <vladimir.romanenko@maibornwolff.de>
- Loading branch information
1 parent
53e161c
commit f674684
Showing
18 changed files
with
346 additions
and
17 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
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
21 changes: 21 additions & 0 deletions
21
...ion/app/codeCharta/state/store/appSettings/enableFloorLabels/enableFloorLabels.actions.ts
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,21 @@ | ||
import { CCAction } from "../../../../codeCharta.model" | ||
|
||
export enum EnableFloorLabelsActions { | ||
SET_ENABLE_FLOOR_LABELS = "SET_ENABLE_FLOOR_LABELS" | ||
} | ||
|
||
export interface SetEnableFloorLabelsAction extends CCAction { | ||
type: EnableFloorLabelsActions.SET_ENABLE_FLOOR_LABELS | ||
payload: boolean | ||
} | ||
|
||
export type EnableFloorLabelAction = SetEnableFloorLabelsAction | ||
|
||
export function setEnableFloorLabels(enableFloorLabel: boolean = defaultEnableFloorLabel): SetEnableFloorLabelsAction { | ||
return { | ||
type: EnableFloorLabelsActions.SET_ENABLE_FLOOR_LABELS, | ||
payload: enableFloorLabel | ||
} | ||
} | ||
|
||
export const defaultEnableFloorLabel = true |
26 changes: 26 additions & 0 deletions
26
...pp/codeCharta/state/store/appSettings/enableFloorLabels/enableFloorLabels.reducer.spec.ts
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,26 @@ | ||
import { enableFloorLabels } from "./enableFloorLabels.reducer" | ||
import { EnableFloorLabelAction, setEnableFloorLabels } from "./enableFloorLabels.actions" | ||
|
||
describe("enableFloorLabel", () => { | ||
describe("Default State", () => { | ||
it("should initialize the default state", () => { | ||
const result = enableFloorLabels(undefined, {} as EnableFloorLabelAction) | ||
|
||
expect(result).toBeTruthy() | ||
}) | ||
}) | ||
|
||
describe("Action: SET_ENABLE_FLOOR_LABEL", () => { | ||
it("should set new enableFloorLabel", () => { | ||
const result = enableFloorLabels(true, setEnableFloorLabels(false)) | ||
|
||
expect(result).toBeFalsy() | ||
}) | ||
|
||
it("should set default colorMetric", () => { | ||
const result = enableFloorLabels(false, setEnableFloorLabels()) | ||
|
||
expect(result).toBeTruthy() | ||
}) | ||
}) | ||
}) |
10 changes: 10 additions & 0 deletions
10
...ion/app/codeCharta/state/store/appSettings/enableFloorLabels/enableFloorLabels.reducer.ts
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,10 @@ | ||
import { EnableFloorLabelAction, EnableFloorLabelsActions, setEnableFloorLabels } from "./enableFloorLabels.actions" | ||
|
||
export function enableFloorLabels(state = setEnableFloorLabels().payload, action: EnableFloorLabelAction) { | ||
switch (action.type) { | ||
case EnableFloorLabelsActions.SET_ENABLE_FLOOR_LABELS: | ||
return action.payload | ||
default: | ||
return state | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...on/app/codeCharta/state/store/appSettings/enableFloorLabels/enableFloorLabels.selector.ts
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,4 @@ | ||
import { createSelector } from "../../../angular-redux/createSelector" | ||
import { appSettingsSelector } from "../appSettings.selector" | ||
|
||
export const enableFloorLabelsSelector = createSelector([appSettingsSelector], appSettings => appSettings.enableFloorLabels) |
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
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
Oops, something went wrong.