Add opaque selection dom renderer tests
This commit is contained in:
@@ -12,7 +12,7 @@ import { IBufferLine } from 'common/Types';
|
|||||||
import { CellData } from 'common/buffer/CellData';
|
import { CellData } from 'common/buffer/CellData';
|
||||||
import { MockCoreService, MockDecorationService, MockOptionsService } from 'common/TestUtils.test';
|
import { MockCoreService, MockDecorationService, MockOptionsService } from 'common/TestUtils.test';
|
||||||
import { css } from 'common/Color';
|
import { css } from 'common/Color';
|
||||||
import { MockCharacterJoinerService, MockSelectionService } from 'browser/TestUtils.test';
|
import { MockCharacterJoinerService } from 'browser/TestUtils.test';
|
||||||
|
|
||||||
describe('DomRendererRowFactory', () => {
|
describe('DomRendererRowFactory', () => {
|
||||||
let dom: jsdom.JSDOM;
|
let dom: jsdom.JSDOM;
|
||||||
@@ -245,6 +245,26 @@ describe('DomRendererRowFactory', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('selectionForeground', () => {
|
||||||
|
it('should force selected cells with content to be rendered above the background', () => {
|
||||||
|
lineData.setCell(0, CellData.fromCharData([DEFAULT_ATTR, 'a', 1, 'a'.charCodeAt(0)]));
|
||||||
|
lineData.setCell(1, CellData.fromCharData([DEFAULT_ATTR, 'b', 1, 'b'.charCodeAt(0)]));
|
||||||
|
rowFactory.onSelectionChanged([1, 0], [2, 0], false);
|
||||||
|
const fragment = rowFactory.createRow(lineData, 0, false, undefined, 0, false, 5, 20);
|
||||||
|
assert.equal(getFragmentHtml(fragment),
|
||||||
|
'<span>a</span><span class="xterm-decoration-top">b</span>'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('should force whitespace cells to be rendered above the background', () => {
|
||||||
|
lineData.setCell(1, CellData.fromCharData([DEFAULT_ATTR, 'a', 1, 'a'.charCodeAt(0)]));
|
||||||
|
rowFactory.onSelectionChanged([0, 0], [2, 0], false);
|
||||||
|
const fragment = rowFactory.createRow(lineData, 0, false, undefined, 0, false, 5, 20);
|
||||||
|
assert.equal(getFragmentHtml(fragment),
|
||||||
|
'<span class="xterm-decoration-top"> </span><span class="xterm-decoration-top">a</span>'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function getFragmentHtml(fragment: DocumentFragment): string {
|
function getFragmentHtml(fragment: DocumentFragment): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user