]>
Commit | Line | Data |
---|---|---|
824a9c6d PK |
1 | import { assert } from 'chai'; |
2 | import * as Terminal from '../xterm'; | |
3 | import * as Clipboard from './Clipboard'; | |
42a1e4ef PK |
4 | |
5 | ||
6 | describe('evaluateCopiedTextProcessing', function () { | |
7 | it('should strip trailing whitespaces and replace nbsps with spaces', function () { | |
20b6f209 | 8 | let nonBreakingSpace = String.fromCharCode(160), |
42a1e4ef PK |
9 | copiedText = 'echo' + nonBreakingSpace + 'hello' + nonBreakingSpace, |
10 | processedText = Clipboard.prepareTextForClipboard(copiedText); | |
11 | ||
12 | // No trailing spaces | |
13 | assert.equal(processedText.match(/\s+$/), null); | |
14 | ||
15 | // No non-breaking space | |
16 | assert.equal(processedText.indexOf(nonBreakingSpace), -1); | |
17 | }); | |
18 | }); | |
0532e5cb JD |
19 | |
20 | describe('evaluatePastedTextProcessing', function () { | |
21 | it('should replace carriage return + line feed with line feed on windows', function () { | |
22 | const pastedText = 'foo\r\nbar\r\n', | |
23 | processedText = Clipboard.prepareTextForTerminal(pastedText, false), | |
24 | windowsProcessedText = Clipboard.prepareTextForTerminal(pastedText, true); | |
25 | ||
26 | assert.equal(processedText, 'foo\r\nbar\r\n'); | |
27 | assert.equal(windowsProcessedText, 'foo\nbar\n'); | |
28 | }); | |
29 | }); |