UNPKG

@theia/core

Version:

Theia is a cloud & desktop IDE framework implemented in TypeScript.

54 lines 2.93 kB
"use strict"; // ***************************************************************************** // Copyright (C) 2017 Ericsson and others. // // This program and the accompanying materials are made available under the // terms of the Eclipse Public License v. 2.0 which is available at // http://www.eclipse.org/legal/epl-2.0. // // This Source Code may also be made available under the following Secondary // Licenses when the conditions for such availability set forth in the Eclipse // Public License v. 2.0 are satisfied: GNU General Public License, version 2 // with the GNU Classpath Exception which is available at // https://www.gnu.org/software/classpath/license.html. // // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 // ***************************************************************************** Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const label_provider_1 = require("./label-provider"); const uri_1 = require("../common/uri"); const os_1 = require("../common/os"); describe('DefaultUriLabelProviderContribution', function () { it('should return a short name', function () { const prov = new label_provider_1.DefaultUriLabelProviderContribution(); const shortName = prov.getName(new uri_1.default('file:///tmp/hello/you.txt')); (0, chai_1.expect)(shortName).eq('you.txt'); }); it('should return a long name', function () { const prov = new label_provider_1.DefaultUriLabelProviderContribution(); const longName = prov.getLongName(new uri_1.default('file:///tmp/hello/you.txt')); if (os_1.OS.backend.isWindows) { (0, chai_1.expect)(longName).eq('\\tmp\\hello\\you.txt'); } else { (0, chai_1.expect)(longName).eq('/tmp/hello/you.txt'); } }); it('should return icon class for something that seems to be a file', function () { const prov = new label_provider_1.DefaultUriLabelProviderContribution(); const icon = prov.getIcon(new uri_1.default('file:///tmp/hello/you.txt')); (0, chai_1.expect)(icon).eq('text-icon medium-blue theia-file-icons-js'); }); it('should return file icon class for something that seems to be a directory', function () { const prov = new label_provider_1.DefaultUriLabelProviderContribution(); const icon = prov.getIcon(new uri_1.default('file:///tmp/hello')); (0, chai_1.expect)(icon).eq(prov.defaultFileIcon); }); it('should return folder icon class for something that is a directory', function () { const prov = new label_provider_1.DefaultUriLabelProviderContribution(); const icon = prov.getIcon(label_provider_1.URIIconReference.create('folder', new uri_1.default('file:///tmp/hello'))); (0, chai_1.expect)(icon).eq(prov.defaultFolderIcon); }); }); //# sourceMappingURL=label-provider.spec.js.map