UNPKG

2.93 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2017 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// *****************************************************************************
17Object.defineProperty(exports, "__esModule", { value: true });
18const chai_1 = require("chai");
19const label_provider_1 = require("./label-provider");
20const uri_1 = require("../common/uri");
21const os_1 = require("../common/os");
22describe('DefaultUriLabelProviderContribution', function () {
23 it('should return a short name', function () {
24 const prov = new label_provider_1.DefaultUriLabelProviderContribution();
25 const shortName = prov.getName(new uri_1.default('file:///tmp/hello/you.txt'));
26 (0, chai_1.expect)(shortName).eq('you.txt');
27 });
28 it('should return a long name', function () {
29 const prov = new label_provider_1.DefaultUriLabelProviderContribution();
30 const longName = prov.getLongName(new uri_1.default('file:///tmp/hello/you.txt'));
31 if (os_1.OS.backend.isWindows) {
32 (0, chai_1.expect)(longName).eq('\\tmp\\hello\\you.txt');
33 }
34 else {
35 (0, chai_1.expect)(longName).eq('/tmp/hello/you.txt');
36 }
37 });
38 it('should return icon class for something that seems to be a file', function () {
39 const prov = new label_provider_1.DefaultUriLabelProviderContribution();
40 const icon = prov.getIcon(new uri_1.default('file:///tmp/hello/you.txt'));
41 (0, chai_1.expect)(icon).eq('text-icon medium-blue theia-file-icons-js');
42 });
43 it('should return file icon class for something that seems to be a directory', function () {
44 const prov = new label_provider_1.DefaultUriLabelProviderContribution();
45 const icon = prov.getIcon(new uri_1.default('file:///tmp/hello'));
46 (0, chai_1.expect)(icon).eq(prov.defaultFileIcon);
47 });
48 it('should return folder icon class for something that is a directory', function () {
49 const prov = new label_provider_1.DefaultUriLabelProviderContribution();
50 const icon = prov.getIcon(label_provider_1.URIIconReference.create('folder', new uri_1.default('file:///tmp/hello')));
51 (0, chai_1.expect)(icon).eq(prov.defaultFolderIcon);
52 });
53});
54//# sourceMappingURL=label-provider.spec.js.map
\No newline at end of file