codecharta-visualization 1.86.0 → 1.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +1 -1
- package/app/app.module.ts +30 -6
- package/app/codeCharta/codeCharta.component.html +0 -2
- package/app/codeCharta/codeCharta.component.ts +2 -0
- package/app/codeCharta/codeCharta.model.ts +8 -5
- package/app/codeCharta/codeCharta.service.spec.ts +41 -50
- package/app/codeCharta/codeCharta.service.ts +33 -32
- package/app/codeCharta/e2e/url.e2e.ts +1 -1
- package/app/codeCharta/services/ajs-upgraded-providers.ts +13 -0
- package/app/codeCharta/state/angular-redux/effects/createEffect.spec.ts +37 -0
- package/app/codeCharta/state/angular-redux/effects/createEffect.ts +25 -0
- package/app/codeCharta/state/angular-redux/effects/effects.module.ts +36 -0
- package/app/codeCharta/state/angular-redux/ofType.ts +11 -0
- package/app/codeCharta/state/angular-redux/state.ts +12 -0
- package/app/codeCharta/state/angular-redux/store.ts +1 -1
- package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/addBlacklistItemsIfNotResultsInEmptyMap.effect.spec.ts +60 -0
- package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/addBlacklistItemsIfNotResultsInEmptyMap.effect.ts +56 -0
- package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/resultsInEmptyMap.ts +22 -0
- package/app/codeCharta/state/effects/nodeContextMenu/excludeButton/excludeButton.component.html +3 -0
- package/app/codeCharta/state/effects/nodeContextMenu/excludeButton/excludeButton.component.ts +26 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.html +13 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.spec.ts +55 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.ts +34 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.module.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.html +24 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.spec.ts +55 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.ts +38 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.module.ts +13 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/isNodeFocused.pipe.spec.ts +31 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/isNodeFocused.pipe.ts +25 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.html +6 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.spec.ts +64 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.ts +39 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.module.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.html +22 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.scss +31 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.spec.ts +35 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.ts +30 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.module.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.spec.ts +17 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.ts +29 -0
- package/app/codeCharta/{ui → state/effects}/nodeContextMenu/nodeContextMenu.e2e.ts +4 -16
- package/app/codeCharta/{ui → state/effects}/nodeContextMenu/nodeContextMenu.po.ts +1 -1
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenu.service.spec.ts +78 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenu.service.ts +72 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/lastPartOfNodePath.pipe.spec.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/lastPartOfNodePath.pipe.ts +8 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.html +17 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.scss +34 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.spec.ts +49 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.ts +19 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.module.ts +18 -0
- package/app/codeCharta/state/effects/nodeContextMenu/openNodeContextMenu.effect.spec.ts +32 -0
- package/app/codeCharta/state/effects/nodeContextMenu/openNodeContextMenu.effect.ts +33 -0
- package/app/codeCharta/state/effects/nodeContextMenu/rightClickedCodeMapNode.selector.ts +8 -0
- package/app/codeCharta/state/effects/unfocusNodesOnLoadingMap.effect.spec.ts +47 -0
- package/app/codeCharta/state/effects/unfocusNodesOnLoadingMap.effect.ts +18 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/areAllNecessaryRenderDataAvailable.selector.ts +30 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areDynamicSettingsAvailable.spec.ts +36 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areDynamicSettingsAvailable.ts +10 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areMetricsAvailable.spec.ts +13 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areMetricsAvailable.ts +8 -0
- package/app/codeCharta/state/store/appSettings/appSettings.actions.ts +2 -0
- package/app/codeCharta/state/store/appSettings/appSettings.reducer.ts +2 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.actions.ts +32 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.reducer.spec.ts +26 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.reducer.ts +12 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.selector.ts +3 -0
- package/app/codeCharta/state/store/appSettings/isLoadingMap/isLoadingMap.reducer.spec.ts +14 -3
- package/app/codeCharta/state/store/appSettings/isLoadingMap/isLoadingMap.reducer.ts +41 -6
- package/app/codeCharta/state/store/appStatus/appStatus.reducer.ts +3 -1
- package/app/codeCharta/state/store/appStatus/appStatus.selector.ts +3 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.actions.ts +23 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.reducer.ts +15 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.selector.ts +4 -0
- package/app/codeCharta/state/store/dynamicSettings/dynamicSettings.splitter.ts +2 -2
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/currentFocused.selector.ts +8 -0
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.actions.ts +27 -7
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.reducer.spec.ts +27 -11
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.reducer.ts +11 -5
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.selector.ts +4 -0
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.service.spec.ts +2 -2
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.service.ts +1 -1
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.actions.ts +33 -2
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.reducer.spec.ts +17 -1
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.reducer.ts +3 -1
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.service.spec.ts +1 -19
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.service.ts +5 -28
- package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.actions.ts +9 -10
- package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.reducer.spec.ts +37 -7
- package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.reducer.ts +7 -3
- package/app/codeCharta/state/store/fileSettings/markedPackages/util/findIndexOfMarkedPackageOrParent.spec.ts +39 -0
- package/app/codeCharta/state/store/fileSettings/markedPackages/util/findIndexOfMarkedPackageOrParent.ts +19 -0
- package/app/codeCharta/state/store/lookUp/idToNode/idToNode.selector.ts +4 -0
- package/app/codeCharta/state/store/lookUp/lookUp.selector.ts +3 -0
- package/app/codeCharta/state/store/metricData/nodeMetricData/nodeMetricData.service.ts +0 -4
- package/app/codeCharta/state/store/state.actions.ts +3 -1
- package/app/codeCharta/state/store/state.splitter.spec.ts +4 -4
- package/app/codeCharta/state/store/store.ts +5 -1
- package/app/codeCharta/state/store.service.spec.ts +21 -8
- package/app/codeCharta/state/store.service.ts +3 -31
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.html +3 -1
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.scss +6 -2
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.ts +1 -1
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.module.ts +3 -0
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.po.ts +4 -4
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.html +1 -0
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.scss +26 -0
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.spec.ts +29 -0
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.ts +24 -0
- package/app/codeCharta/ui/artificialIntelligence/__snapshots__/artificialIntelligence.component.spec.ts.snap +13 -16
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.html +4 -4
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.scss +0 -4
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.spec.ts +82 -52
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.ts +41 -101
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/aggregationType.pipe.spec.ts +19 -0
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/{aggregationSymbol.pipe.ts → aggregationType.pipe.ts} +4 -4
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.html +4 -12
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.scss +11 -20
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.spec.ts +8 -15
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.module.ts +2 -2
- package/app/codeCharta/ui/codeMap/__snapshots__/codeMap.arrow.service.spec.ts.snap +2 -2
- package/app/codeCharta/ui/codeMap/codeMap.actions.service.ts +1 -40
- package/app/codeCharta/ui/codeMap/codeMap.mouseEvent.service.ts +8 -16
- package/app/codeCharta/ui/codeMap/codeMap.preRender.service.spec.ts +1 -9
- package/app/codeCharta/ui/codeMap/codeMap.preRender.service.ts +9 -32
- package/app/codeCharta/ui/codeMap/rendering/codeMapMesh.ts +1 -0
- package/app/codeCharta/ui/colorPicker/colorPicker.component.html +16 -7
- package/app/codeCharta/ui/colorPicker/colorPicker.component.spec.ts +55 -16
- package/app/codeCharta/ui/colorPicker/colorPicker.component.ts +32 -1
- package/app/codeCharta/ui/colorPicker/colorPicker.module.ts +3 -1
- package/app/codeCharta/ui/customConfigs/customConfigs.component.html +29 -11
- package/app/codeCharta/ui/customConfigs/customConfigs.component.scss +1 -0
- package/app/codeCharta/ui/customConfigs/customConfigs.component.spec.ts +123 -2
- package/app/codeCharta/ui/customConfigs/customConfigs.component.ts +56 -2
- package/app/codeCharta/ui/dialog/dialog.addCustomConfigSettings.component.html +2 -2
- package/app/codeCharta/ui/dialog/dialog.changelog.component.html +1 -1
- package/app/codeCharta/ui/dialog/dialog.changelog.component.scss +15 -0
- package/app/codeCharta/ui/dialog/dialog.changelog.component.spec.ts +15 -15
- package/app/codeCharta/ui/dialog/dialog.changelog.component.ts +2 -1
- package/app/codeCharta/ui/dialog/dialog.globalSettings.e2e.ts +1 -1
- package/app/codeCharta/ui/dialog/dialog.globalSettings.po.ts +1 -1
- package/app/codeCharta/ui/dialog/dialog.service.spec.ts +68 -0
- package/app/codeCharta/ui/dialog/dialog.service.ts +38 -17
- package/app/codeCharta/ui/dialogs/dialogs.ts +3 -0
- package/app/codeCharta/ui/dialogs/errorDialog/errorDialog.component.html +7 -0
- package/app/codeCharta/ui/dialogs/errorDialog/errorDialog.component.ts +9 -0
- package/app/codeCharta/ui/edgeChooser/edgeChooser.e2e.ts +3 -2
- package/app/codeCharta/ui/fileChooser/fileChooser.e2e.ts +5 -6
- package/app/codeCharta/ui/filePanel/filePanel.component.html +24 -106
- package/app/codeCharta/ui/filePanel/filePanel.component.scss +12 -57
- package/app/codeCharta/ui/filePanel/filePanel.component.spec.ts +40 -72
- package/app/codeCharta/ui/filePanel/filePanel.component.ts +29 -81
- package/app/codeCharta/ui/filePanel/filePanel.module.ts +13 -1
- package/app/codeCharta/ui/filePanel/filePanel.po.ts +6 -24
- package/app/codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component.html +23 -0
- package/app/codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component.ts +18 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.html +18 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.ts +16 -0
- package/app/codeCharta/ui/filePanel/filePanelStateButtons/filePanelStateButtons.component.html +18 -0
- package/app/codeCharta/ui/filePanel/filePanelStateButtons/filePanelStateButtons.component.ts +11 -0
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.html +21 -13
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.spec.ts +11 -24
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.ts +1 -40
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.module.ts +1 -2
- package/app/codeCharta/ui/legendPanel/legendMarkedPackages/legendMarkedPackages.component.ts +2 -2
- package/app/codeCharta/ui/mapTreeView/mapTreeView.level.e2e.ts +8 -6
- package/app/codeCharta/ui/mapTreeView/mapTreeView.level.po.ts +1 -1
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.html +1 -1
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.spec.ts +6 -16
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.ts +15 -11
- package/app/codeCharta/ui/ribbonBar/ribbonBar.component.html +3 -3
- package/app/codeCharta/ui/ribbonBar/ribbonBar.e2e.ts +3 -3
- package/app/codeCharta/ui/searchBar/searchBar.component.html +5 -0
- package/app/codeCharta/ui/searchBar/searchBar.component.scss +11 -0
- package/app/codeCharta/ui/searchBar/searchBar.component.spec.ts +10 -0
- package/app/codeCharta/ui/searchBar/searchBar.component.ts +1 -1
- package/app/codeCharta/ui/sortingOption/sortingOption.component.spec.ts +1 -1
- package/app/codeCharta/ui/toolBar/toolBar.component.html +1 -1
- package/app/codeCharta/ui/toolBar/toolBar.component.scss +1 -1
- package/app/codeCharta/ui/ui.ts +2 -6
- package/app/codeCharta/util/algorithm/streetLayout/strip/strip.ts +2 -2
- package/app/codeCharta/util/algorithm/streetLayout/treeMap.ts +1 -1
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapGenerator.spec.ts +2 -2
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapGenerator.ts +14 -7
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapHelper.spec.ts +2 -2
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapHelper.ts +1 -1
- package/app/codeCharta/util/customConfigBuilder.ts +2 -1
- package/app/codeCharta/util/customConfigHelper.spec.ts +155 -60
- package/app/codeCharta/util/customConfigHelper.ts +33 -3
- package/app/codeCharta/util/dataMocks.ts +8 -4
- package/app/codeCharta/util/fileExtensionCalculator.ts +1 -1
- package/app/codeCharta/util/fileValidator.spec.ts +69 -182
- package/app/codeCharta/util/fileValidator.ts +61 -37
- package/app/codeCharta/util/reduxHelper.ts +11 -0
- package/app/material/material.module.ts +17 -1
- package/conf/webpack.loaders.js +4 -1
- package/dist/webpack/bundle.js +5925 -1896
- package/dist/webpack/bundle.js.map +1 -1
- package/package.json +7 -6
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.splitter.ts +0 -8
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/aggregationSymbol.pipe.spec.ts +0 -19
- package/app/codeCharta/ui/codeMap/codeMap.actions.service.spec.ts +0 -147
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.html +0 -5
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.scss +0 -13
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.ts +0 -30
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.module.ts +0 -13
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.html +0 -68
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.scss +0 -52
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.spec.ts +0 -571
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.ts +0 -318
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.module.ts +0 -13
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.html +0 -15
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.scss +0 -5
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.spec.ts +0 -106
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.ts +0 -62
- package/app/codeCharta/ui/unfocusButton/unfocusButton.module.ts +0 -7
|
@@ -1,571 +0,0 @@
|
|
|
1
|
-
import "./nodeContextMenu.module"
|
|
2
|
-
|
|
3
|
-
import { IRootScopeService, IWindowService } from "angular"
|
|
4
|
-
import { instantiateModule, getService } from "../../../../mocks/ng.mockhelper"
|
|
5
|
-
import { CodeMapActionsService } from "../codeMap/codeMap.actions.service"
|
|
6
|
-
import { NodeContextMenuController } from "./nodeContextMenu.component"
|
|
7
|
-
import {
|
|
8
|
-
CODE_MAP_BUILDING,
|
|
9
|
-
CODE_MAP_BUILDING_TS_NODE,
|
|
10
|
-
CONSTANT_HIGHLIGHT,
|
|
11
|
-
TEST_DELTA_MAP_A,
|
|
12
|
-
VALID_FILE_NODE_WITH_ID,
|
|
13
|
-
VALID_NODE_WITH_PATH,
|
|
14
|
-
withMockedEventMethods
|
|
15
|
-
} from "../../util/dataMocks"
|
|
16
|
-
import { CodeMapPreRenderService } from "../codeMap/codeMap.preRender.service"
|
|
17
|
-
import { StoreService } from "../../state/store.service"
|
|
18
|
-
import { setMarkedPackages } from "../../state/store/fileSettings/markedPackages/markedPackages.actions"
|
|
19
|
-
import { BlacklistType, MarkedPackage, NodeType } from "../../codeCharta.model"
|
|
20
|
-
import { addBlacklistItem } from "../../state/store/fileSettings/blacklist/blacklist.actions"
|
|
21
|
-
import { focusNode, unfocusNode } from "../../state/store/dynamicSettings/focusedNodePath/focusedNodePath.actions"
|
|
22
|
-
import { NodeDecorator } from "../../util/nodeDecorator"
|
|
23
|
-
import { CodeMapMouseEventService } from "../codeMap/codeMap.mouseEvent.service"
|
|
24
|
-
import { ThreeSceneService } from "../codeMap/threeViewer/threeSceneService"
|
|
25
|
-
import { CodeMapBuilding } from "../codeMap/rendering/codeMapBuilding"
|
|
26
|
-
import { setIdToBuilding } from "../../state/store/lookUp/idToBuilding/idToBuilding.actions"
|
|
27
|
-
import { DialogService } from "../dialog/dialog.service"
|
|
28
|
-
import { BlacklistService } from "../../state/store/fileSettings/blacklist/blacklist.service"
|
|
29
|
-
|
|
30
|
-
describe("nodeContextMenuController", () => {
|
|
31
|
-
let element: Element
|
|
32
|
-
let nodeContextMenuController: NodeContextMenuController
|
|
33
|
-
let $window: IWindowService
|
|
34
|
-
let $rootScope: IRootScopeService
|
|
35
|
-
let storeService: StoreService
|
|
36
|
-
let codeMapActionsService: CodeMapActionsService
|
|
37
|
-
let codeMapPreRenderService: CodeMapPreRenderService
|
|
38
|
-
let threeSceneService: ThreeSceneService
|
|
39
|
-
let dialogService: DialogService
|
|
40
|
-
let blacklistService: BlacklistService
|
|
41
|
-
|
|
42
|
-
beforeEach(() => {
|
|
43
|
-
restartSystem()
|
|
44
|
-
mockElement()
|
|
45
|
-
mockWindow()
|
|
46
|
-
withMockedCodeMapActionService()
|
|
47
|
-
withMockedCodeMapPreRenderService()
|
|
48
|
-
withMockedThreeSceneService()
|
|
49
|
-
rebuildController()
|
|
50
|
-
withMockedHideNodeContextMenuMethod()
|
|
51
|
-
|
|
52
|
-
NodeDecorator.decorateMapWithPathAttribute(TEST_DELTA_MAP_A)
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
function restartSystem() {
|
|
56
|
-
instantiateModule("app.codeCharta.ui.nodeContextMenu")
|
|
57
|
-
|
|
58
|
-
$window = getService<IWindowService>("$window")
|
|
59
|
-
$rootScope = getService<IRootScopeService>("$rootScope")
|
|
60
|
-
storeService = getService<StoreService>("storeService")
|
|
61
|
-
codeMapActionsService = getService<CodeMapActionsService>("codeMapActionsService")
|
|
62
|
-
codeMapPreRenderService = getService<CodeMapPreRenderService>("codeMapPreRenderService")
|
|
63
|
-
threeSceneService = getService<ThreeSceneService>("threeSceneService")
|
|
64
|
-
dialogService = getService<DialogService>("dialogService")
|
|
65
|
-
blacklistService = getService<BlacklistService>("blacklistService")
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function mockElement() {
|
|
69
|
-
// @ts-ignore we only care about few properties for the test.
|
|
70
|
-
element = [{ children: [{ clientWidth: 50, clientHeight: 100 }] }]
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function mockWindow() {
|
|
74
|
-
$window = { innerWidth: 800, innerHeight: 600 } as IWindowService
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function rebuildController() {
|
|
78
|
-
nodeContextMenuController = new NodeContextMenuController(
|
|
79
|
-
element,
|
|
80
|
-
$window,
|
|
81
|
-
$rootScope,
|
|
82
|
-
storeService,
|
|
83
|
-
codeMapActionsService,
|
|
84
|
-
codeMapPreRenderService,
|
|
85
|
-
threeSceneService,
|
|
86
|
-
dialogService,
|
|
87
|
-
blacklistService
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function withMockedCodeMapActionService() {
|
|
92
|
-
codeMapActionsService.markFolder = jest.fn()
|
|
93
|
-
codeMapActionsService.unmarkFolder = jest.fn()
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function withMockedCodeMapPreRenderService() {
|
|
97
|
-
codeMapPreRenderService.getRenderMap = jest.fn().mockReturnValue(TEST_DELTA_MAP_A.map)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function withMockedHideNodeContextMenuMethod() {
|
|
101
|
-
nodeContextMenuController.onHideNodeContextMenu = jest.fn()
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function withMockedThreeSceneService() {
|
|
105
|
-
threeSceneService = jest.fn().mockReturnValue({
|
|
106
|
-
addNodeAndChildrenToConstantHighlight: jest.fn(),
|
|
107
|
-
removeNodeAndChildrenFromConstantHighlight: jest.fn(),
|
|
108
|
-
getConstantHighlight: jest.fn().mockReturnValue(CONSTANT_HIGHLIGHT)
|
|
109
|
-
})()
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
describe("constructor", () => {
|
|
113
|
-
it("should subscribe to 'show-node-context-menu' events", () => {
|
|
114
|
-
NodeContextMenuController.subscribeToShowNodeContextMenu = jest.fn()
|
|
115
|
-
|
|
116
|
-
rebuildController()
|
|
117
|
-
|
|
118
|
-
expect(NodeContextMenuController.subscribeToShowNodeContextMenu).toHaveBeenCalledWith($rootScope, nodeContextMenuController)
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
it("should broadcast 'show-node-context-menu' when 'show' method is called", () => {
|
|
122
|
-
withMockedEventMethods($rootScope)
|
|
123
|
-
NodeContextMenuController.broadcastShowEvent($rootScope, "somepath", "sometype", 42, 24)
|
|
124
|
-
|
|
125
|
-
expect($rootScope.$broadcast).toHaveBeenCalledWith("show-node-context-menu", {
|
|
126
|
-
path: "somepath",
|
|
127
|
-
type: "sometype",
|
|
128
|
-
x: 42,
|
|
129
|
-
y: 24
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
it("should subscribe to 'on-building-right-clicked' events", () => {
|
|
134
|
-
NodeContextMenuController.subscribeToShowNodeContextMenu = jest.fn()
|
|
135
|
-
CodeMapMouseEventService.subscribeToBuildingRightClickedEvents = jest.fn()
|
|
136
|
-
|
|
137
|
-
rebuildController()
|
|
138
|
-
|
|
139
|
-
expect(CodeMapMouseEventService.subscribeToBuildingRightClickedEvents).toHaveBeenCalledWith(
|
|
140
|
-
$rootScope,
|
|
141
|
-
nodeContextMenuController
|
|
142
|
-
)
|
|
143
|
-
})
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
describe("onShowNodeContextMenu", () => {
|
|
147
|
-
let elementMock
|
|
148
|
-
beforeEach(() => {
|
|
149
|
-
nodeContextMenuController.setPosition = jest.fn()
|
|
150
|
-
nodeContextMenuController.calculatePosition = jest.fn().mockReturnValue({ x: 1, y: 2 })
|
|
151
|
-
|
|
152
|
-
document.body.addEventListener = jest.fn()
|
|
153
|
-
elementMock = { addEventListener: jest.fn() }
|
|
154
|
-
// @ts-ignore
|
|
155
|
-
jest.spyOn(document, "getElementById").mockImplementation(() => elementMock)
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
it("should set the correct building after some timeout", () => {
|
|
159
|
-
nodeContextMenuController.onShowNodeContextMenu("/root", NodeType.FOLDER, 42, 24)
|
|
160
|
-
|
|
161
|
-
expect(nodeContextMenuController["_viewModel"].codeMapNode).toEqual(TEST_DELTA_MAP_A.map)
|
|
162
|
-
expect(nodeContextMenuController["_viewModel"].showNodeContextMenu).toBe(true)
|
|
163
|
-
expect(nodeContextMenuController.calculatePosition).toHaveBeenCalledWith(42, 24)
|
|
164
|
-
expect(nodeContextMenuController.setPosition).toHaveBeenCalledTimes(1)
|
|
165
|
-
expect(nodeContextMenuController.setPosition).toBeCalledWith(1, 2)
|
|
166
|
-
|
|
167
|
-
expect(document.body.addEventListener).toHaveBeenNthCalledWith(1, "click", expect.anything(), expect.anything())
|
|
168
|
-
expect(document.body.addEventListener).toHaveBeenNthCalledWith(2, "mousedown", expect.anything(), expect.anything())
|
|
169
|
-
|
|
170
|
-
expect(document.getElementById).toHaveBeenCalledWith("codeMap")
|
|
171
|
-
expect(elementMock.addEventListener).toHaveBeenCalledWith("wheel", expect.anything(), expect.anything())
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
it("should not shorten the path if it has no sub paths", () => {
|
|
175
|
-
nodeContextMenuController.onShowNodeContextMenu("/root", NodeType.FOLDER, 42, 24)
|
|
176
|
-
|
|
177
|
-
expect(nodeContextMenuController["_viewModel"].nodePath).toEqual(TEST_DELTA_MAP_A.map.path)
|
|
178
|
-
expect(nodeContextMenuController["_viewModel"].lastPartOfNodePath).toBe(TEST_DELTA_MAP_A.map.path)
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
it("should set the complete and shortened node path", () => {
|
|
182
|
-
nodeContextMenuController.onShowNodeContextMenu("/root/big leaf", NodeType.FILE, 521, 588)
|
|
183
|
-
const nodePath = TEST_DELTA_MAP_A.map.children[0].path
|
|
184
|
-
|
|
185
|
-
expect(nodeContextMenuController["_viewModel"].nodePath).toEqual(nodePath)
|
|
186
|
-
expect(nodeContextMenuController["_viewModel"].lastPartOfNodePath).toBe(`...${nodePath.slice(nodePath.lastIndexOf("/"))}`)
|
|
187
|
-
})
|
|
188
|
-
|
|
189
|
-
it("should set if the node is focused or it's parent is focuesd", () => {
|
|
190
|
-
storeService.dispatch(unfocusNode())
|
|
191
|
-
storeService.dispatch(focusNode("/root/big leaf"))
|
|
192
|
-
nodeContextMenuController.onShowNodeContextMenu("/root/big leaf", NodeType.FILE, 521, 588)
|
|
193
|
-
expect(nodeContextMenuController["_viewModel"].isNodeFocused).toEqual(true)
|
|
194
|
-
expect(nodeContextMenuController["_viewModel"].isParentFocused).toEqual(false)
|
|
195
|
-
storeService.dispatch(unfocusNode())
|
|
196
|
-
storeService.dispatch(focusNode("/root/other big leaf"))
|
|
197
|
-
nodeContextMenuController.onShowNodeContextMenu("/root/big leaf", NodeType.FILE, 521, 588)
|
|
198
|
-
expect(nodeContextMenuController["_viewModel"].isNodeFocused).toEqual(false)
|
|
199
|
-
expect(nodeContextMenuController["_viewModel"].isParentFocused).toEqual(false)
|
|
200
|
-
storeService.dispatch(unfocusNode())
|
|
201
|
-
storeService.dispatch(focusNode("/root"))
|
|
202
|
-
nodeContextMenuController.onShowNodeContextMenu("/root/ParentLeaf/smallLeaf", NodeType.FILE, 521, 588)
|
|
203
|
-
expect(nodeContextMenuController["_viewModel"].isNodeFocused).toEqual(false)
|
|
204
|
-
expect(nodeContextMenuController["_viewModel"].isParentFocused).toEqual(true)
|
|
205
|
-
storeService.dispatch(unfocusNode())
|
|
206
|
-
storeService.dispatch(focusNode("/root/ParentLeaf"))
|
|
207
|
-
nodeContextMenuController.onShowNodeContextMenu("/root/ParentLeaf/smallLeaf", NodeType.FOLDER, 521, 588)
|
|
208
|
-
expect(nodeContextMenuController["_viewModel"].isNodeFocused).toEqual(false)
|
|
209
|
-
expect(nodeContextMenuController["_viewModel"].isParentFocused).toEqual(true)
|
|
210
|
-
})
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
describe("calculatePosition", () => {
|
|
214
|
-
function testPositionCalculation(expectedX, expectedY, mouseX, mouseY) {
|
|
215
|
-
const { x, y } = nodeContextMenuController.calculatePosition(mouseX, mouseY)
|
|
216
|
-
expect(x).toBe(expectedX)
|
|
217
|
-
expect(y).toBe(expectedY)
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
it("should calculate the position for the menu correctly, when it fits in the window", () => {
|
|
221
|
-
testPositionCalculation(400, 300, 400, 300)
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
it("should calculate the position for the menu correctly, when it doesn't fit in the window.innerWidth", () => {
|
|
225
|
-
testPositionCalculation(750, 300, 799, 300)
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
it("should calculate the position for the menu correctly, when it doesn't fit in the window.innerHeight", () => {
|
|
229
|
-
testPositionCalculation(400, 500, 400, 599)
|
|
230
|
-
})
|
|
231
|
-
|
|
232
|
-
it("should calculate the position for the menu correctly, when it doesn't fit in the window.innerHeight and window.innerWidth", () => {
|
|
233
|
-
testPositionCalculation(750, 500, 799, 599)
|
|
234
|
-
})
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
describe("removeNodeFromConstantHighlight", () => {
|
|
238
|
-
it("should call addNodeandChildrenToConstantHighlight", () => {
|
|
239
|
-
nodeContextMenuController.addNodeToConstantHighlight()
|
|
240
|
-
|
|
241
|
-
expect(threeSceneService.addNodeAndChildrenToConstantHighlight).toHaveBeenCalled()
|
|
242
|
-
})
|
|
243
|
-
})
|
|
244
|
-
|
|
245
|
-
describe("addNodeToConstantHighlight", () => {
|
|
246
|
-
it("should call addNodeandChildrenToConstantHighlight", () => {
|
|
247
|
-
nodeContextMenuController.removeNodeFromConstantHighlight()
|
|
248
|
-
|
|
249
|
-
expect(threeSceneService.removeNodeAndChildrenFromConstantHighlight).toHaveBeenCalled()
|
|
250
|
-
})
|
|
251
|
-
})
|
|
252
|
-
|
|
253
|
-
describe("isNodeConstantlyHighlighted", () => {
|
|
254
|
-
beforeEach(() => {
|
|
255
|
-
const idToBuilding = new Map<number, CodeMapBuilding>()
|
|
256
|
-
idToBuilding.set(CODE_MAP_BUILDING.id, CODE_MAP_BUILDING)
|
|
257
|
-
idToBuilding.set(CODE_MAP_BUILDING_TS_NODE.id, CODE_MAP_BUILDING_TS_NODE)
|
|
258
|
-
storeService.dispatch(setIdToBuilding(idToBuilding))
|
|
259
|
-
})
|
|
260
|
-
it("should return false if codeMapNode is not existing", () => {
|
|
261
|
-
nodeContextMenuController["_viewModel"].codeMapNode = null
|
|
262
|
-
|
|
263
|
-
const result = nodeContextMenuController.isNodeConstantlyHighlighted()
|
|
264
|
-
|
|
265
|
-
expect(result).toEqual(false)
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
it("should return false if codeMapNode exists but is not in constant Highlight", () => {
|
|
269
|
-
threeSceneService.getConstantHighlight = jest.fn().mockReturnValue(new Map())
|
|
270
|
-
nodeContextMenuController["_viewModel"].codeMapNode = VALID_FILE_NODE_WITH_ID
|
|
271
|
-
|
|
272
|
-
const result = nodeContextMenuController.isNodeConstantlyHighlighted()
|
|
273
|
-
|
|
274
|
-
expect(threeSceneService.getConstantHighlight).toHaveBeenCalled()
|
|
275
|
-
expect(result).toEqual(false)
|
|
276
|
-
})
|
|
277
|
-
|
|
278
|
-
it("should return true if codeMapNode exists and in constant Highlight", () => {
|
|
279
|
-
nodeContextMenuController["_viewModel"].codeMapNode = VALID_FILE_NODE_WITH_ID
|
|
280
|
-
|
|
281
|
-
const result = nodeContextMenuController.isNodeConstantlyHighlighted()
|
|
282
|
-
|
|
283
|
-
expect(result).toEqual(true)
|
|
284
|
-
})
|
|
285
|
-
})
|
|
286
|
-
|
|
287
|
-
describe("flattenNode", () => {
|
|
288
|
-
it("should add flattened blacklistItem", () => {
|
|
289
|
-
nodeContextMenuController["_viewModel"].codeMapNode = VALID_NODE_WITH_PATH.children[1]
|
|
290
|
-
const expected = {
|
|
291
|
-
nodeType: NodeType.FOLDER,
|
|
292
|
-
path: "/root/Parent Leaf",
|
|
293
|
-
type: BlacklistType.flatten
|
|
294
|
-
}
|
|
295
|
-
nodeContextMenuController.flattenNode()
|
|
296
|
-
|
|
297
|
-
expect(storeService.getState().fileSettings.blacklist).toContainEqual(expected)
|
|
298
|
-
})
|
|
299
|
-
})
|
|
300
|
-
|
|
301
|
-
describe("showNode", () => {
|
|
302
|
-
it("should add flattened blacklistItem", () => {
|
|
303
|
-
nodeContextMenuController["_viewModel"].codeMapNode = VALID_NODE_WITH_PATH.children[1]
|
|
304
|
-
const expected = {
|
|
305
|
-
path: "/root/Parent Leaf",
|
|
306
|
-
type: BlacklistType.flatten
|
|
307
|
-
}
|
|
308
|
-
storeService.dispatch(addBlacklistItem(expected))
|
|
309
|
-
|
|
310
|
-
nodeContextMenuController.showFlattenedNode()
|
|
311
|
-
|
|
312
|
-
expect(storeService.getState().fileSettings.blacklist).not.toContain(expected)
|
|
313
|
-
})
|
|
314
|
-
})
|
|
315
|
-
|
|
316
|
-
describe("clickColor", () => {
|
|
317
|
-
it("should call unmarkFolder, if current folder is marked with color ", () => {
|
|
318
|
-
nodeContextMenuController.isNodeOrParentMarked = jest.fn().mockReturnValue(true)
|
|
319
|
-
nodeContextMenuController.unmarkFolder = jest.fn()
|
|
320
|
-
|
|
321
|
-
nodeContextMenuController.clickColor("color")
|
|
322
|
-
|
|
323
|
-
expect(nodeContextMenuController.isNodeOrParentMarked).toHaveBeenCalledWith("color")
|
|
324
|
-
expect(nodeContextMenuController.unmarkFolder).toHaveBeenCalled()
|
|
325
|
-
})
|
|
326
|
-
|
|
327
|
-
it("should call markFolder, if current folder is not marked with color ", () => {
|
|
328
|
-
nodeContextMenuController.isNodeOrParentMarked = jest.fn().mockReturnValue(false)
|
|
329
|
-
nodeContextMenuController.markFolder = jest.fn()
|
|
330
|
-
|
|
331
|
-
nodeContextMenuController.clickColor("color")
|
|
332
|
-
|
|
333
|
-
expect(nodeContextMenuController.isNodeOrParentMarked).toHaveBeenCalledWith("color")
|
|
334
|
-
expect(nodeContextMenuController.markFolder).toHaveBeenCalled()
|
|
335
|
-
})
|
|
336
|
-
})
|
|
337
|
-
|
|
338
|
-
describe("currentFolderIsMarkedWithColor", () => {
|
|
339
|
-
it("should return false, if color is undefined", () => {
|
|
340
|
-
const result = nodeContextMenuController.isNodeOrParentMarked()
|
|
341
|
-
|
|
342
|
-
expect(result).toBeFalsy()
|
|
343
|
-
})
|
|
344
|
-
|
|
345
|
-
it("should return false, if color is null", () => {
|
|
346
|
-
const result = nodeContextMenuController.isNodeOrParentMarked(null)
|
|
347
|
-
|
|
348
|
-
expect(result).toBeFalsy()
|
|
349
|
-
})
|
|
350
|
-
|
|
351
|
-
it("should return false, if _viewModel.contextMenuBuilding is undefined", () => {
|
|
352
|
-
nodeContextMenuController["_viewModel"].codeMapNode = undefined
|
|
353
|
-
|
|
354
|
-
const result = nodeContextMenuController.isNodeOrParentMarked("color")
|
|
355
|
-
|
|
356
|
-
expect(result).toBeFalsy()
|
|
357
|
-
})
|
|
358
|
-
|
|
359
|
-
it("should return false, if _viewModel.contextMenuBuilding is null", () => {
|
|
360
|
-
nodeContextMenuController["_viewModel"].codeMapNode = null
|
|
361
|
-
|
|
362
|
-
const result = nodeContextMenuController.isNodeOrParentMarked("color")
|
|
363
|
-
|
|
364
|
-
expect(result).toBeFalsy()
|
|
365
|
-
})
|
|
366
|
-
|
|
367
|
-
it("should return true, if package is marked and matches the color", () => {
|
|
368
|
-
const markedPackages: MarkedPackage[] = [{ path: "/root", color: "color" }]
|
|
369
|
-
storeService.dispatch(setMarkedPackages(markedPackages))
|
|
370
|
-
|
|
371
|
-
nodeContextMenuController["_viewModel"].codeMapNode = VALID_NODE_WITH_PATH
|
|
372
|
-
|
|
373
|
-
const result = nodeContextMenuController.isNodeOrParentMarked("color")
|
|
374
|
-
|
|
375
|
-
expect(result).toBeTruthy()
|
|
376
|
-
})
|
|
377
|
-
|
|
378
|
-
it("should return false, if package is not marked and doesn't match the color of parent folder", () => {
|
|
379
|
-
const markedPackages: MarkedPackage[] = [{ path: "/root", color: "color" }]
|
|
380
|
-
storeService.dispatch(setMarkedPackages(markedPackages))
|
|
381
|
-
|
|
382
|
-
nodeContextMenuController["_viewModel"].codeMapNode = VALID_NODE_WITH_PATH
|
|
383
|
-
|
|
384
|
-
const result = nodeContextMenuController.isNodeOrParentMarked("another color")
|
|
385
|
-
|
|
386
|
-
expect(result).toBeFalsy()
|
|
387
|
-
})
|
|
388
|
-
})
|
|
389
|
-
|
|
390
|
-
describe("markFolder", () => {
|
|
391
|
-
it("should call hide and codeMapActionService.markFolder", () => {
|
|
392
|
-
nodeContextMenuController.markFolder("color")
|
|
393
|
-
|
|
394
|
-
expect(codeMapActionsService.markFolder).toHaveBeenCalledWith(nodeContextMenuController["_viewModel"].codeMapNode, "color")
|
|
395
|
-
})
|
|
396
|
-
})
|
|
397
|
-
|
|
398
|
-
describe("unmarkFolder", () => {
|
|
399
|
-
it("should call hide and codeMapActionService.unmarkFolder", () => {
|
|
400
|
-
nodeContextMenuController.unmarkFolder()
|
|
401
|
-
|
|
402
|
-
expect(codeMapActionsService.unmarkFolder).toHaveBeenCalledWith(nodeContextMenuController["_viewModel"].codeMapNode)
|
|
403
|
-
})
|
|
404
|
-
})
|
|
405
|
-
|
|
406
|
-
describe("focusNode", () => {
|
|
407
|
-
beforeEach(() => {
|
|
408
|
-
nodeContextMenuController["_viewModel"].codeMapNode = VALID_NODE_WITH_PATH.children[1]
|
|
409
|
-
})
|
|
410
|
-
|
|
411
|
-
it("should set new focused path", () => {
|
|
412
|
-
nodeContextMenuController.focusNode()
|
|
413
|
-
|
|
414
|
-
expect(storeService.getState().dynamicSettings.focusedNodePath).toEqual(VALID_NODE_WITH_PATH.children[1].path)
|
|
415
|
-
})
|
|
416
|
-
})
|
|
417
|
-
|
|
418
|
-
describe("excludeNode", () => {
|
|
419
|
-
beforeEach(() => {
|
|
420
|
-
nodeContextMenuController["_viewModel"].codeMapNode = VALID_NODE_WITH_PATH.children[1]
|
|
421
|
-
})
|
|
422
|
-
|
|
423
|
-
it("should add exclude blacklistItem", () => {
|
|
424
|
-
blacklistService.resultsInEmptyMap = jest.fn(() => false)
|
|
425
|
-
const expected = { nodeType: "Folder", path: "/root/Parent Leaf", type: BlacklistType.exclude }
|
|
426
|
-
|
|
427
|
-
nodeContextMenuController.excludeNode()
|
|
428
|
-
|
|
429
|
-
expect(storeService.getState().fileSettings.blacklist).toContainEqual(expected)
|
|
430
|
-
})
|
|
431
|
-
|
|
432
|
-
it("should display error dialog when no files are left", () => {
|
|
433
|
-
blacklistService.resultsInEmptyMap = jest.fn(() => true)
|
|
434
|
-
dialogService.showErrorDialog = jest.fn()
|
|
435
|
-
|
|
436
|
-
nodeContextMenuController.excludeNode()
|
|
437
|
-
|
|
438
|
-
expect(dialogService.showErrorDialog).toBeCalled()
|
|
439
|
-
})
|
|
440
|
-
|
|
441
|
-
it("should prevent duplicate blacklist object regarding issue #2419", () => {
|
|
442
|
-
blacklistService.resultsInEmptyMap = jest.fn(() => false)
|
|
443
|
-
|
|
444
|
-
nodeContextMenuController.excludeNode()
|
|
445
|
-
nodeContextMenuController.excludeNode()
|
|
446
|
-
|
|
447
|
-
expect(storeService.getState().fileSettings.blacklist.length).toEqual(1)
|
|
448
|
-
})
|
|
449
|
-
})
|
|
450
|
-
|
|
451
|
-
describe("nodeIsFolder", () => {
|
|
452
|
-
it("should return true, if contextMenuBuilding is a folder", () => {
|
|
453
|
-
nodeContextMenuController["_viewModel"].codeMapNode = VALID_NODE_WITH_PATH
|
|
454
|
-
const result = nodeContextMenuController.nodeIsFolder()
|
|
455
|
-
|
|
456
|
-
expect(result).toBeTruthy()
|
|
457
|
-
})
|
|
458
|
-
|
|
459
|
-
it("should return false, if contextMenuBuilding is null", () => {
|
|
460
|
-
nodeContextMenuController["_viewModel"].codeMapNode = null
|
|
461
|
-
const result = nodeContextMenuController.nodeIsFolder()
|
|
462
|
-
|
|
463
|
-
expect(result).toBeFalsy()
|
|
464
|
-
})
|
|
465
|
-
|
|
466
|
-
it("should return false, if contextMenuBuilding is undefined", () => {
|
|
467
|
-
nodeContextMenuController["_viewModel"].codeMapNode = undefined
|
|
468
|
-
const result = nodeContextMenuController.nodeIsFolder()
|
|
469
|
-
|
|
470
|
-
expect(result).toBeFalsy()
|
|
471
|
-
})
|
|
472
|
-
|
|
473
|
-
it("should return false, if contextMenuBuilding has no children property", () => {
|
|
474
|
-
nodeContextMenuController["_viewModel"].codeMapNode = VALID_NODE_WITH_PATH.children[0]
|
|
475
|
-
const result = nodeContextMenuController.nodeIsFolder()
|
|
476
|
-
|
|
477
|
-
expect(result).toBeFalsy()
|
|
478
|
-
})
|
|
479
|
-
|
|
480
|
-
it("should return false, if contextMenuBuilding has children property but no children", () => {
|
|
481
|
-
const VALID_NODE_WITHOUT_CHILDREN = VALID_NODE_WITH_PATH
|
|
482
|
-
VALID_NODE_WITHOUT_CHILDREN.children[0].children = []
|
|
483
|
-
|
|
484
|
-
nodeContextMenuController["_viewModel"].codeMapNode = VALID_NODE_WITHOUT_CHILDREN[0]
|
|
485
|
-
const result = nodeContextMenuController.nodeIsFolder()
|
|
486
|
-
|
|
487
|
-
expect(result).toBeFalsy()
|
|
488
|
-
})
|
|
489
|
-
})
|
|
490
|
-
|
|
491
|
-
describe("isNodeFocused", () => {
|
|
492
|
-
it("should return true if a node is focused", () => {
|
|
493
|
-
storeService.dispatch(focusNode("/root/big leaf"))
|
|
494
|
-
nodeContextMenuController["_viewModel"].codeMapNode = TEST_DELTA_MAP_A.map.children[0]
|
|
495
|
-
|
|
496
|
-
const actual = nodeContextMenuController.isNodeFocused()
|
|
497
|
-
|
|
498
|
-
expect(actual).toBeTruthy()
|
|
499
|
-
})
|
|
500
|
-
|
|
501
|
-
it("should return false if a node is not focused", () => {
|
|
502
|
-
storeService.dispatch(unfocusNode())
|
|
503
|
-
nodeContextMenuController["_viewModel"].codeMapNode = TEST_DELTA_MAP_A.map.children[0]
|
|
504
|
-
|
|
505
|
-
const actual = nodeContextMenuController.isNodeFocused()
|
|
506
|
-
|
|
507
|
-
expect(actual).toBeFalsy()
|
|
508
|
-
})
|
|
509
|
-
})
|
|
510
|
-
|
|
511
|
-
describe("isNodeOrParentFocused", () => {
|
|
512
|
-
it("should return true if a node is focused", () => {
|
|
513
|
-
storeService.dispatch(focusNode("/root/big leaf"))
|
|
514
|
-
nodeContextMenuController["_viewModel"].codeMapNode = TEST_DELTA_MAP_A.map.children[0]
|
|
515
|
-
|
|
516
|
-
const actual = nodeContextMenuController.isNodeOrParentFocused()
|
|
517
|
-
|
|
518
|
-
expect(actual).toBeTruthy()
|
|
519
|
-
})
|
|
520
|
-
|
|
521
|
-
it("should return true if a parent of a node is focused", () => {
|
|
522
|
-
storeService.dispatch(focusNode("/root/Parent Leaf"))
|
|
523
|
-
nodeContextMenuController["_viewModel"].codeMapNode = TEST_DELTA_MAP_A.map.children[1].children[0]
|
|
524
|
-
|
|
525
|
-
const actual = nodeContextMenuController.isNodeOrParentFocused()
|
|
526
|
-
|
|
527
|
-
expect(actual).toBeTruthy()
|
|
528
|
-
})
|
|
529
|
-
|
|
530
|
-
it("should return false if a node is not focused", () => {
|
|
531
|
-
storeService.dispatch(unfocusNode())
|
|
532
|
-
nodeContextMenuController["_viewModel"].codeMapNode = TEST_DELTA_MAP_A.map.children[0]
|
|
533
|
-
|
|
534
|
-
const actual = nodeContextMenuController.isNodeOrParentFocused()
|
|
535
|
-
|
|
536
|
-
expect(actual).toBeFalsy()
|
|
537
|
-
})
|
|
538
|
-
})
|
|
539
|
-
|
|
540
|
-
describe("onBodyLeftClickHideNodeContextMenu", () => {
|
|
541
|
-
it("should not hide if a click on color-picker tricker occurs", () => {
|
|
542
|
-
const broadcastHideEventSpy = jest.spyOn(NodeContextMenuController, "broadcastHideEvent")
|
|
543
|
-
const mockedMouseEvent: any = {
|
|
544
|
-
composedPath: () => [{ nodeName: "CC-MARK-FOLDER-COLOR-PICKER" }]
|
|
545
|
-
}
|
|
546
|
-
nodeContextMenuController.onBodyLeftClickHideNodeContextMenu(mockedMouseEvent)
|
|
547
|
-
|
|
548
|
-
expect(broadcastHideEventSpy).not.toHaveBeenCalled()
|
|
549
|
-
})
|
|
550
|
-
|
|
551
|
-
it("should not hide if a click within color-picker occurs", () => {
|
|
552
|
-
const broadcastHideEventSpy = jest.spyOn(NodeContextMenuController, "broadcastHideEvent")
|
|
553
|
-
const mockedMouseEvent: any = {
|
|
554
|
-
composedPath: () => [{ nodeName: "COLOR-CHROME" }]
|
|
555
|
-
}
|
|
556
|
-
nodeContextMenuController.onBodyLeftClickHideNodeContextMenu(mockedMouseEvent)
|
|
557
|
-
|
|
558
|
-
expect(broadcastHideEventSpy).not.toHaveBeenCalled()
|
|
559
|
-
})
|
|
560
|
-
|
|
561
|
-
it("should hide if clicked somewhere but not within the color-picker", () => {
|
|
562
|
-
const broadcastHideEventSpy = jest.spyOn(NodeContextMenuController, "broadcastHideEvent")
|
|
563
|
-
const mockedMouseEvent: any = {
|
|
564
|
-
composedPath: () => [{ nodeName: "DIV" }]
|
|
565
|
-
}
|
|
566
|
-
nodeContextMenuController.onBodyLeftClickHideNodeContextMenu(mockedMouseEvent)
|
|
567
|
-
|
|
568
|
-
expect(broadcastHideEventSpy).toHaveBeenCalled()
|
|
569
|
-
})
|
|
570
|
-
})
|
|
571
|
-
})
|