1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import { expect } from 'chai';
|
18 | import { DefaultUriLabelProviderContribution, URIIconReference } from './label-provider';
|
19 | import URI from '../common/uri';
|
20 | import { OS } from '../common/os';
|
21 |
|
22 | describe('DefaultUriLabelProviderContribution', function (): void {
|
23 |
|
24 | it('should return a short name', function (): void {
|
25 | const prov = new DefaultUriLabelProviderContribution();
|
26 | const shortName = prov.getName(new URI('file:///tmp/hello/you.txt'));
|
27 |
|
28 | expect(shortName).eq('you.txt');
|
29 | });
|
30 |
|
31 | it('should return a long name', function (): void {
|
32 | const prov = new DefaultUriLabelProviderContribution();
|
33 | const longName = prov.getLongName(new URI('file:///tmp/hello/you.txt'));
|
34 |
|
35 | if (OS.backend.isWindows) {
|
36 | expect(longName).eq('\\tmp\\hello\\you.txt');
|
37 | } else {
|
38 | expect(longName).eq('/tmp/hello/you.txt');
|
39 | }
|
40 | });
|
41 |
|
42 | it('should return icon class for something that seems to be a file', function (): void {
|
43 | const prov = new DefaultUriLabelProviderContribution();
|
44 | const icon = prov.getIcon(new URI('file:///tmp/hello/you.txt'));
|
45 |
|
46 | expect(icon).eq('text-icon medium-blue theia-file-icons-js');
|
47 | });
|
48 |
|
49 | it('should return file icon class for something that seems to be a directory', function (): void {
|
50 | const prov = new DefaultUriLabelProviderContribution();
|
51 | const icon = prov.getIcon(new URI('file:///tmp/hello'));
|
52 |
|
53 | expect(icon).eq(prov.defaultFileIcon);
|
54 | });
|
55 |
|
56 | it('should return folder icon class for something that is a directory', function (): void {
|
57 | const prov = new DefaultUriLabelProviderContribution();
|
58 | const icon = prov.getIcon(URIIconReference.create('folder', new URI('file:///tmp/hello')));
|
59 |
|
60 | expect(icon).eq(prov.defaultFolderIcon);
|
61 | });
|
62 | });
|