@theia/property-view 1.45.0 → 1.46.0-next.72

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.
Files changed (56) hide show
  1. package/README.md +44 -44
  2. package/lib/browser/empty-property-view-widget-provider.d.ts +32 -32
  3. package/lib/browser/empty-property-view-widget-provider.js +83 -83
  4. package/lib/browser/property-data-service.d.ts +28 -28
  5. package/lib/browser/property-data-service.js +19 -19
  6. package/lib/browser/property-view-content-widget.d.ts +10 -10
  7. package/lib/browser/property-view-content-widget.js +17 -17
  8. package/lib/browser/property-view-contribution.d.ts +5 -5
  9. package/lib/browser/property-view-contribution.js +48 -48
  10. package/lib/browser/property-view-frontend-module.d.ts +4 -4
  11. package/lib/browser/property-view-frontend-module.js +42 -42
  12. package/lib/browser/property-view-service.d.ts +17 -17
  13. package/lib/browser/property-view-service.js +81 -81
  14. package/lib/browser/property-view-widget-provider.d.ts +57 -57
  15. package/lib/browser/property-view-widget-provider.js +84 -84
  16. package/lib/browser/property-view-widget.d.ts +26 -26
  17. package/lib/browser/property-view-widget.js +130 -130
  18. package/lib/browser/resource-property-view/index.d.ts +1 -1
  19. package/lib/browser/resource-property-view/index.js +28 -28
  20. package/lib/browser/resource-property-view/resource-property-data-service.d.ts +17 -17
  21. package/lib/browser/resource-property-view/resource-property-data-service.js +72 -72
  22. package/lib/browser/resource-property-view/resource-property-data-service.spec.d.ts +1 -1
  23. package/lib/browser/resource-property-view/resource-property-data-service.spec.js +101 -101
  24. package/lib/browser/resource-property-view/resource-property-view-label-provider.d.ts +10 -10
  25. package/lib/browser/resource-property-view/resource-property-view-label-provider.js +60 -60
  26. package/lib/browser/resource-property-view/resource-property-view-label-provider.spec.d.ts +1 -1
  27. package/lib/browser/resource-property-view/resource-property-view-label-provider.spec.js +129 -129
  28. package/lib/browser/resource-property-view/resource-property-view-tree-container.d.ts +2 -2
  29. package/lib/browser/resource-property-view/resource-property-view-tree-container.js +43 -43
  30. package/lib/browser/resource-property-view/resource-property-view-tree-items.d.ts +27 -27
  31. package/lib/browser/resource-property-view/resource-property-view-tree-items.js +41 -41
  32. package/lib/browser/resource-property-view/resource-property-view-tree-widget.d.ts +40 -40
  33. package/lib/browser/resource-property-view/resource-property-view-tree-widget.js +191 -191
  34. package/lib/browser/resource-property-view/resource-property-view-widget-provider.d.ts +16 -16
  35. package/lib/browser/resource-property-view/resource-property-view-widget-provider.js +66 -66
  36. package/lib/package.spec.js +25 -25
  37. package/package.json +5 -5
  38. package/src/browser/empty-property-view-widget-provider.tsx +83 -83
  39. package/src/browser/property-data-service.ts +48 -48
  40. package/src/browser/property-view-content-widget.ts +27 -27
  41. package/src/browser/property-view-contribution.ts +36 -36
  42. package/src/browser/property-view-frontend-module.ts +47 -47
  43. package/src/browser/property-view-service.ts +62 -62
  44. package/src/browser/property-view-widget-provider.ts +112 -112
  45. package/src/browser/property-view-widget.tsx +118 -118
  46. package/src/browser/resource-property-view/index.ts +17 -17
  47. package/src/browser/resource-property-view/resource-property-data-service.spec.ts +127 -127
  48. package/src/browser/resource-property-view/resource-property-data-service.ts +64 -64
  49. package/src/browser/resource-property-view/resource-property-view-label-provider.spec.ts +153 -153
  50. package/src/browser/resource-property-view/resource-property-view-label-provider.ts +49 -49
  51. package/src/browser/resource-property-view/resource-property-view-tree-container.ts +47 -47
  52. package/src/browser/resource-property-view/resource-property-view-tree-items.ts +53 -53
  53. package/src/browser/resource-property-view/resource-property-view-tree-widget.tsx +219 -219
  54. package/src/browser/resource-property-view/resource-property-view-widget-provider.ts +55 -55
  55. package/src/browser/style/property-view.css +51 -51
  56. package/src/package.spec.ts +29 -29
@@ -1,102 +1,102 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2021 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const jsdom_1 = require("@theia/core/lib/browser/test/jsdom");
19
- let disableJSDOM = (0, jsdom_1.enableJSDOM)();
20
- const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
21
- frontend_application_config_provider_1.FrontendApplicationConfigProvider.set({});
22
- const chai_1 = require("chai");
23
- const inversify_1 = require("@theia/core/shared/inversify");
24
- const resource_property_data_service_1 = require("./resource-property-data-service");
25
- const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
26
- const uri_1 = require("@theia/core/lib/common/uri");
27
- const property_data_service_1 = require("../property-data-service");
28
- disableJSDOM();
29
- let resourcePropertyDataService;
30
- const mockFileStat = {
31
- isFile: false,
32
- isDirectory: true,
33
- isSymbolicLink: false,
34
- isReadonly: false,
35
- resource: new uri_1.default('resource'),
36
- name: 'name'
37
- };
38
- describe('resource-property-data-service', () => {
39
- before(() => {
40
- disableJSDOM = (0, jsdom_1.enableJSDOM)();
41
- const container = new inversify_1.Container();
42
- container.bind(resource_property_data_service_1.ResourcePropertyDataService).toSelf().inSingletonScope();
43
- container.bind(file_service_1.FileService).toConstantValue({
44
- async resolve(uri) {
45
- return mockFileStat;
46
- }
47
- });
48
- container.bind(property_data_service_1.PropertyDataService).to(resource_property_data_service_1.ResourcePropertyDataService).inSingletonScope();
49
- resourcePropertyDataService = container.get(resource_property_data_service_1.ResourcePropertyDataService);
50
- });
51
- after(() => {
52
- disableJSDOM();
53
- });
54
- const navigatableSelection = {
55
- getResourceUri() {
56
- return new uri_1.default('resource-uri');
57
- },
58
- createMoveToUri() {
59
- return new uri_1.default('move-uri');
60
- }
61
- };
62
- const fileSelection = [
63
- { fileStat: mockFileStat }
64
- ];
65
- describe('#canHandle', () => {
66
- it('should not handle an empty object selection', () => {
67
- (0, chai_1.expect)(resourcePropertyDataService.canHandleSelection({})).eq(0);
68
- });
69
- it('should not handle an undefined selection', () => {
70
- (0, chai_1.expect)(resourcePropertyDataService.canHandleSelection(undefined)).eq(0);
71
- });
72
- it('should handle a file selection', () => {
73
- (0, chai_1.expect)(resourcePropertyDataService.canHandleSelection(fileSelection)).to.be.greaterThan(0);
74
- });
75
- it('should handle a navigatable selection', () => {
76
- (0, chai_1.expect)(resourcePropertyDataService.canHandleSelection(navigatableSelection)).to.be.greaterThan(0);
77
- });
78
- });
79
- describe('#providePropertyData', () => {
80
- it('should return the file-stat of a file selection', async () => {
81
- const data = await resourcePropertyDataService.providePropertyData(fileSelection);
82
- (0, chai_1.expect)(data).to.equal(mockFileStat);
83
- });
84
- it('should return the first file-stat for multiple file selections', async () => {
85
- const arrayFileSelection = [
86
- { fileStat: mockFileStat },
87
- { fileStat: { ...mockFileStat, resource: new uri_1.default('secondURI') } }
88
- ];
89
- const data = await resourcePropertyDataService.providePropertyData(arrayFileSelection);
90
- (0, chai_1.expect)(data).to.equal(arrayFileSelection[0].fileStat);
91
- });
92
- it('should return the file-stat for a navigatable selection', async () => {
93
- const data = await resourcePropertyDataService.providePropertyData(navigatableSelection);
94
- (0, chai_1.expect)(data).to.equal(mockFileStat);
95
- });
96
- it('should return undefined if the selection is undefined', async () => {
97
- const data = await resourcePropertyDataService.providePropertyData(undefined);
98
- (0, chai_1.expect)(data).to.equal(undefined);
99
- });
100
- });
101
- });
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2021 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const jsdom_1 = require("@theia/core/lib/browser/test/jsdom");
19
+ let disableJSDOM = (0, jsdom_1.enableJSDOM)();
20
+ const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
21
+ frontend_application_config_provider_1.FrontendApplicationConfigProvider.set({});
22
+ const chai_1 = require("chai");
23
+ const inversify_1 = require("@theia/core/shared/inversify");
24
+ const resource_property_data_service_1 = require("./resource-property-data-service");
25
+ const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
26
+ const uri_1 = require("@theia/core/lib/common/uri");
27
+ const property_data_service_1 = require("../property-data-service");
28
+ disableJSDOM();
29
+ let resourcePropertyDataService;
30
+ const mockFileStat = {
31
+ isFile: false,
32
+ isDirectory: true,
33
+ isSymbolicLink: false,
34
+ isReadonly: false,
35
+ resource: new uri_1.default('resource'),
36
+ name: 'name'
37
+ };
38
+ describe('resource-property-data-service', () => {
39
+ before(() => {
40
+ disableJSDOM = (0, jsdom_1.enableJSDOM)();
41
+ const container = new inversify_1.Container();
42
+ container.bind(resource_property_data_service_1.ResourcePropertyDataService).toSelf().inSingletonScope();
43
+ container.bind(file_service_1.FileService).toConstantValue({
44
+ async resolve(uri) {
45
+ return mockFileStat;
46
+ }
47
+ });
48
+ container.bind(property_data_service_1.PropertyDataService).to(resource_property_data_service_1.ResourcePropertyDataService).inSingletonScope();
49
+ resourcePropertyDataService = container.get(resource_property_data_service_1.ResourcePropertyDataService);
50
+ });
51
+ after(() => {
52
+ disableJSDOM();
53
+ });
54
+ const navigatableSelection = {
55
+ getResourceUri() {
56
+ return new uri_1.default('resource-uri');
57
+ },
58
+ createMoveToUri() {
59
+ return new uri_1.default('move-uri');
60
+ }
61
+ };
62
+ const fileSelection = [
63
+ { fileStat: mockFileStat }
64
+ ];
65
+ describe('#canHandle', () => {
66
+ it('should not handle an empty object selection', () => {
67
+ (0, chai_1.expect)(resourcePropertyDataService.canHandleSelection({})).eq(0);
68
+ });
69
+ it('should not handle an undefined selection', () => {
70
+ (0, chai_1.expect)(resourcePropertyDataService.canHandleSelection(undefined)).eq(0);
71
+ });
72
+ it('should handle a file selection', () => {
73
+ (0, chai_1.expect)(resourcePropertyDataService.canHandleSelection(fileSelection)).to.be.greaterThan(0);
74
+ });
75
+ it('should handle a navigatable selection', () => {
76
+ (0, chai_1.expect)(resourcePropertyDataService.canHandleSelection(navigatableSelection)).to.be.greaterThan(0);
77
+ });
78
+ });
79
+ describe('#providePropertyData', () => {
80
+ it('should return the file-stat of a file selection', async () => {
81
+ const data = await resourcePropertyDataService.providePropertyData(fileSelection);
82
+ (0, chai_1.expect)(data).to.equal(mockFileStat);
83
+ });
84
+ it('should return the first file-stat for multiple file selections', async () => {
85
+ const arrayFileSelection = [
86
+ { fileStat: mockFileStat },
87
+ { fileStat: { ...mockFileStat, resource: new uri_1.default('secondURI') } }
88
+ ];
89
+ const data = await resourcePropertyDataService.providePropertyData(arrayFileSelection);
90
+ (0, chai_1.expect)(data).to.equal(arrayFileSelection[0].fileStat);
91
+ });
92
+ it('should return the file-stat for a navigatable selection', async () => {
93
+ const data = await resourcePropertyDataService.providePropertyData(navigatableSelection);
94
+ (0, chai_1.expect)(data).to.equal(mockFileStat);
95
+ });
96
+ it('should return undefined if the selection is undefined', async () => {
97
+ const data = await resourcePropertyDataService.providePropertyData(undefined);
98
+ (0, chai_1.expect)(data).to.equal(undefined);
99
+ });
100
+ });
101
+ });
102
102
  //# sourceMappingURL=resource-property-data-service.spec.js.map
@@ -1,11 +1,11 @@
1
- import { LabelProvider, LabelProviderContribution, TreeNode } from '@theia/core/lib/browser';
2
- import { ResourcePropertiesCategoryNode, ResourcePropertiesItemNode } from './resource-property-view-tree-items';
3
- export declare const DEFAULT_INFO_ICON: string;
4
- export declare class ResourcePropertiesLabelProvider implements LabelProviderContribution {
5
- protected readonly labelProvider: LabelProvider;
6
- canHandle(element: TreeNode): number;
7
- getIcon(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string;
8
- getName(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string;
9
- getLongName(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string;
10
- }
1
+ import { LabelProvider, LabelProviderContribution, TreeNode } from '@theia/core/lib/browser';
2
+ import { ResourcePropertiesCategoryNode, ResourcePropertiesItemNode } from './resource-property-view-tree-items';
3
+ export declare const DEFAULT_INFO_ICON: string;
4
+ export declare class ResourcePropertiesLabelProvider implements LabelProviderContribution {
5
+ protected readonly labelProvider: LabelProvider;
6
+ canHandle(element: TreeNode): number;
7
+ getIcon(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string;
8
+ getName(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string;
9
+ getLongName(node: ResourcePropertiesCategoryNode | ResourcePropertiesItemNode): string;
10
+ }
11
11
  //# sourceMappingURL=resource-property-view-label-provider.d.ts.map
@@ -1,61 +1,61 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2020 EclipseSource and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.ResourcePropertiesLabelProvider = exports.DEFAULT_INFO_ICON = void 0;
28
- const browser_1 = require("@theia/core/lib/browser");
29
- const inversify_1 = require("@theia/core/shared/inversify");
30
- const resource_property_view_tree_items_1 = require("./resource-property-view-tree-items");
31
- exports.DEFAULT_INFO_ICON = (0, browser_1.codicon)('info');
32
- let ResourcePropertiesLabelProvider = class ResourcePropertiesLabelProvider {
33
- canHandle(element) {
34
- return (resource_property_view_tree_items_1.ResourcePropertiesCategoryNode.is(element) || resource_property_view_tree_items_1.ResourcePropertiesItemNode.is(element)) ? 75 : 0;
35
- }
36
- getIcon(node) {
37
- var _a, _b;
38
- if (resource_property_view_tree_items_1.ResourcePropertiesCategoryNode.is(node)) {
39
- return (_a = node.icon) !== null && _a !== void 0 ? _a : exports.DEFAULT_INFO_ICON;
40
- }
41
- return (_b = node.icon) !== null && _b !== void 0 ? _b : '';
42
- }
43
- getName(node) {
44
- return node.name;
45
- }
46
- getLongName(node) {
47
- if (resource_property_view_tree_items_1.ResourcePropertiesItemNode.is(node)) {
48
- return node.property;
49
- }
50
- return this.getName(node);
51
- }
52
- };
53
- __decorate([
54
- (0, inversify_1.inject)(browser_1.LabelProvider),
55
- __metadata("design:type", browser_1.LabelProvider)
56
- ], ResourcePropertiesLabelProvider.prototype, "labelProvider", void 0);
57
- ResourcePropertiesLabelProvider = __decorate([
58
- (0, inversify_1.injectable)()
59
- ], ResourcePropertiesLabelProvider);
60
- exports.ResourcePropertiesLabelProvider = ResourcePropertiesLabelProvider;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2020 EclipseSource and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.ResourcePropertiesLabelProvider = exports.DEFAULT_INFO_ICON = void 0;
28
+ const browser_1 = require("@theia/core/lib/browser");
29
+ const inversify_1 = require("@theia/core/shared/inversify");
30
+ const resource_property_view_tree_items_1 = require("./resource-property-view-tree-items");
31
+ exports.DEFAULT_INFO_ICON = (0, browser_1.codicon)('info');
32
+ let ResourcePropertiesLabelProvider = class ResourcePropertiesLabelProvider {
33
+ canHandle(element) {
34
+ return (resource_property_view_tree_items_1.ResourcePropertiesCategoryNode.is(element) || resource_property_view_tree_items_1.ResourcePropertiesItemNode.is(element)) ? 75 : 0;
35
+ }
36
+ getIcon(node) {
37
+ var _a, _b;
38
+ if (resource_property_view_tree_items_1.ResourcePropertiesCategoryNode.is(node)) {
39
+ return (_a = node.icon) !== null && _a !== void 0 ? _a : exports.DEFAULT_INFO_ICON;
40
+ }
41
+ return (_b = node.icon) !== null && _b !== void 0 ? _b : '';
42
+ }
43
+ getName(node) {
44
+ return node.name;
45
+ }
46
+ getLongName(node) {
47
+ if (resource_property_view_tree_items_1.ResourcePropertiesItemNode.is(node)) {
48
+ return node.property;
49
+ }
50
+ return this.getName(node);
51
+ }
52
+ };
53
+ __decorate([
54
+ (0, inversify_1.inject)(browser_1.LabelProvider),
55
+ __metadata("design:type", browser_1.LabelProvider)
56
+ ], ResourcePropertiesLabelProvider.prototype, "labelProvider", void 0);
57
+ ResourcePropertiesLabelProvider = __decorate([
58
+ (0, inversify_1.injectable)()
59
+ ], ResourcePropertiesLabelProvider);
60
+ exports.ResourcePropertiesLabelProvider = ResourcePropertiesLabelProvider;
61
61
  //# sourceMappingURL=resource-property-view-label-provider.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=resource-property-view-label-provider.spec.d.ts.map
@@ -1,130 +1,130 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2021 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const jsdom_1 = require("@theia/core/lib/browser/test/jsdom");
19
- let disableJSDOM = (0, jsdom_1.enableJSDOM)();
20
- const chai_1 = require("chai");
21
- const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
22
- frontend_application_config_provider_1.FrontendApplicationConfigProvider.set({});
23
- const inversify_1 = require("@theia/core/shared/inversify");
24
- const resource_property_view_label_provider_1 = require("./resource-property-view-label-provider");
25
- const label_provider_1 = require("@theia/core/lib/browser/label-provider");
26
- const common_1 = require("@theia/core/lib/common");
27
- disableJSDOM();
28
- let resourcePropertiesLabelProvider;
29
- describe('resource-property-view-label', () => {
30
- before(() => {
31
- disableJSDOM = (0, jsdom_1.enableJSDOM)();
32
- const container = new inversify_1.Container();
33
- container.bind(resource_property_view_label_provider_1.ResourcePropertiesLabelProvider).toSelf().inSingletonScope();
34
- container.bind(label_provider_1.LabelProvider).toSelf().inSingletonScope();
35
- container.bind(common_1.ContributionProvider)
36
- .toConstantValue({
37
- getContributions: () => [],
38
- })
39
- .whenTargetNamed(label_provider_1.LabelProviderContribution);
40
- resourcePropertiesLabelProvider = container.get(resource_property_view_label_provider_1.ResourcePropertiesLabelProvider);
41
- });
42
- after(() => {
43
- disableJSDOM();
44
- });
45
- const categoryNode = {
46
- name: 'category',
47
- id: '',
48
- icon: 'iconCategory',
49
- children: [],
50
- parent: {
51
- id: '',
52
- parent: undefined,
53
- children: []
54
- },
55
- categoryId: '',
56
- expanded: false,
57
- selected: false,
58
- };
59
- const itemNode = {
60
- name: 'item',
61
- id: '',
62
- icon: 'iconItem',
63
- selected: false,
64
- parent: {
65
- name: 'category',
66
- id: '',
67
- icon: '',
68
- children: [],
69
- parent: {
70
- id: '',
71
- parent: undefined,
72
- children: []
73
- },
74
- categoryId: '',
75
- expanded: false,
76
- selected: false,
77
- },
78
- property: 'property'
79
- };
80
- describe('#canHandle', () => {
81
- it('should handle a category node', () => {
82
- (0, chai_1.expect)(resourcePropertiesLabelProvider.canHandle(categoryNode)).to.be.greaterThan(0);
83
- });
84
- it('should handle an item node', () => {
85
- (0, chai_1.expect)(resourcePropertiesLabelProvider.canHandle(itemNode)).to.be.greaterThan(0);
86
- });
87
- it('should not handle a tree node (not an item nor a category)', () => {
88
- const node = {
89
- id: '',
90
- parent: undefined
91
- };
92
- (0, chai_1.expect)(resourcePropertiesLabelProvider.canHandle(node)).eq(0);
93
- });
94
- });
95
- describe('#getIcon', () => {
96
- it('should get the icon of a category node', () => {
97
- (0, chai_1.expect)(resourcePropertiesLabelProvider.getIcon(categoryNode)).eq('iconCategory');
98
- });
99
- it('should get the default icon if a category node has an undefined icon field', () => {
100
- const emptyIconCategory = categoryNode;
101
- emptyIconCategory.icon = undefined;
102
- (0, chai_1.expect)(resourcePropertiesLabelProvider.getIcon(emptyIconCategory)).eq(resource_property_view_label_provider_1.DEFAULT_INFO_ICON);
103
- });
104
- it('should get the icon of an item node', () => {
105
- (0, chai_1.expect)(resourcePropertiesLabelProvider.getIcon(itemNode)).eq('iconItem');
106
- });
107
- it('should get an empty string if an item node has an undefined icon field', () => {
108
- const emptyIconItem = itemNode;
109
- emptyIconItem.icon = undefined;
110
- (0, chai_1.expect)(resourcePropertiesLabelProvider.getIcon(emptyIconItem)).eq('');
111
- });
112
- });
113
- describe('#getName', () => {
114
- it('should get the name of a category node', () => {
115
- (0, chai_1.expect)(resourcePropertiesLabelProvider.getName(categoryNode)).eq('category');
116
- });
117
- it('should get the name of an item node', () => {
118
- (0, chai_1.expect)(resourcePropertiesLabelProvider.getName(itemNode)).eq('item');
119
- });
120
- });
121
- describe('#getLongName', () => {
122
- it('should get the property of an item node', () => {
123
- (0, chai_1.expect)(resourcePropertiesLabelProvider.getLongName(itemNode)).eq('property');
124
- });
125
- it('should get the name of a category node', () => {
126
- (0, chai_1.expect)(resourcePropertiesLabelProvider.getLongName(categoryNode)).eq('category');
127
- });
128
- });
129
- });
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2021 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const jsdom_1 = require("@theia/core/lib/browser/test/jsdom");
19
+ let disableJSDOM = (0, jsdom_1.enableJSDOM)();
20
+ const chai_1 = require("chai");
21
+ const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
22
+ frontend_application_config_provider_1.FrontendApplicationConfigProvider.set({});
23
+ const inversify_1 = require("@theia/core/shared/inversify");
24
+ const resource_property_view_label_provider_1 = require("./resource-property-view-label-provider");
25
+ const label_provider_1 = require("@theia/core/lib/browser/label-provider");
26
+ const common_1 = require("@theia/core/lib/common");
27
+ disableJSDOM();
28
+ let resourcePropertiesLabelProvider;
29
+ describe('resource-property-view-label', () => {
30
+ before(() => {
31
+ disableJSDOM = (0, jsdom_1.enableJSDOM)();
32
+ const container = new inversify_1.Container();
33
+ container.bind(resource_property_view_label_provider_1.ResourcePropertiesLabelProvider).toSelf().inSingletonScope();
34
+ container.bind(label_provider_1.LabelProvider).toSelf().inSingletonScope();
35
+ container.bind(common_1.ContributionProvider)
36
+ .toConstantValue({
37
+ getContributions: () => [],
38
+ })
39
+ .whenTargetNamed(label_provider_1.LabelProviderContribution);
40
+ resourcePropertiesLabelProvider = container.get(resource_property_view_label_provider_1.ResourcePropertiesLabelProvider);
41
+ });
42
+ after(() => {
43
+ disableJSDOM();
44
+ });
45
+ const categoryNode = {
46
+ name: 'category',
47
+ id: '',
48
+ icon: 'iconCategory',
49
+ children: [],
50
+ parent: {
51
+ id: '',
52
+ parent: undefined,
53
+ children: []
54
+ },
55
+ categoryId: '',
56
+ expanded: false,
57
+ selected: false,
58
+ };
59
+ const itemNode = {
60
+ name: 'item',
61
+ id: '',
62
+ icon: 'iconItem',
63
+ selected: false,
64
+ parent: {
65
+ name: 'category',
66
+ id: '',
67
+ icon: '',
68
+ children: [],
69
+ parent: {
70
+ id: '',
71
+ parent: undefined,
72
+ children: []
73
+ },
74
+ categoryId: '',
75
+ expanded: false,
76
+ selected: false,
77
+ },
78
+ property: 'property'
79
+ };
80
+ describe('#canHandle', () => {
81
+ it('should handle a category node', () => {
82
+ (0, chai_1.expect)(resourcePropertiesLabelProvider.canHandle(categoryNode)).to.be.greaterThan(0);
83
+ });
84
+ it('should handle an item node', () => {
85
+ (0, chai_1.expect)(resourcePropertiesLabelProvider.canHandle(itemNode)).to.be.greaterThan(0);
86
+ });
87
+ it('should not handle a tree node (not an item nor a category)', () => {
88
+ const node = {
89
+ id: '',
90
+ parent: undefined
91
+ };
92
+ (0, chai_1.expect)(resourcePropertiesLabelProvider.canHandle(node)).eq(0);
93
+ });
94
+ });
95
+ describe('#getIcon', () => {
96
+ it('should get the icon of a category node', () => {
97
+ (0, chai_1.expect)(resourcePropertiesLabelProvider.getIcon(categoryNode)).eq('iconCategory');
98
+ });
99
+ it('should get the default icon if a category node has an undefined icon field', () => {
100
+ const emptyIconCategory = categoryNode;
101
+ emptyIconCategory.icon = undefined;
102
+ (0, chai_1.expect)(resourcePropertiesLabelProvider.getIcon(emptyIconCategory)).eq(resource_property_view_label_provider_1.DEFAULT_INFO_ICON);
103
+ });
104
+ it('should get the icon of an item node', () => {
105
+ (0, chai_1.expect)(resourcePropertiesLabelProvider.getIcon(itemNode)).eq('iconItem');
106
+ });
107
+ it('should get an empty string if an item node has an undefined icon field', () => {
108
+ const emptyIconItem = itemNode;
109
+ emptyIconItem.icon = undefined;
110
+ (0, chai_1.expect)(resourcePropertiesLabelProvider.getIcon(emptyIconItem)).eq('');
111
+ });
112
+ });
113
+ describe('#getName', () => {
114
+ it('should get the name of a category node', () => {
115
+ (0, chai_1.expect)(resourcePropertiesLabelProvider.getName(categoryNode)).eq('category');
116
+ });
117
+ it('should get the name of an item node', () => {
118
+ (0, chai_1.expect)(resourcePropertiesLabelProvider.getName(itemNode)).eq('item');
119
+ });
120
+ });
121
+ describe('#getLongName', () => {
122
+ it('should get the property of an item node', () => {
123
+ (0, chai_1.expect)(resourcePropertiesLabelProvider.getLongName(itemNode)).eq('property');
124
+ });
125
+ it('should get the name of a category node', () => {
126
+ (0, chai_1.expect)(resourcePropertiesLabelProvider.getLongName(categoryNode)).eq('category');
127
+ });
128
+ });
129
+ });
130
130
  //# sourceMappingURL=resource-property-view-label-provider.spec.js.map
@@ -1,3 +1,3 @@
1
- import { interfaces } from '@theia/core/shared/inversify';
2
- export declare function bindResourcePropertyView(bind: interfaces.Bind): void;
1
+ import { interfaces } from '@theia/core/shared/inversify';
2
+ export declare function bindResourcePropertyView(bind: interfaces.Bind): void;
3
3
  //# sourceMappingURL=resource-property-view-tree-container.d.ts.map