name polishing, docs
This commit is contained in:
+11
-11
@@ -28,23 +28,23 @@ describe('CellData', () => {
|
||||
// ASCII
|
||||
cell.setFromCharData([123, 'a', 1, 'a'.charCodeAt(0)]);
|
||||
chai.assert.deepEqual(cell.asCharData, [123, 'a', 1, 'a'.charCodeAt(0)]);
|
||||
chai.assert.equal(cell.combined, 0);
|
||||
chai.assert.equal(cell.isCombined, 0);
|
||||
// combining
|
||||
cell.setFromCharData([123, 'e\u0301', 1, '\u0301'.charCodeAt(0)]);
|
||||
chai.assert.deepEqual(cell.asCharData, [123, 'e\u0301', 1, '\u0301'.charCodeAt(0)]);
|
||||
chai.assert.equal(cell.combined, Content.IS_COMBINED);
|
||||
chai.assert.equal(cell.isCombined, Content.IS_COMBINED);
|
||||
// surrogate
|
||||
cell.setFromCharData([123, '𝄞', 1, 0x1D11E]);
|
||||
chai.assert.deepEqual(cell.asCharData, [123, '𝄞', 1, 0x1D11E]);
|
||||
chai.assert.equal(cell.combined, 0);
|
||||
chai.assert.equal(cell.isCombined, 0);
|
||||
// surrogate + combining
|
||||
cell.setFromCharData([123, '𓂀\u0301', 1, '𓂀\u0301'.charCodeAt(2)]);
|
||||
chai.assert.deepEqual(cell.asCharData, [123, '𓂀\u0301', 1, '𓂀\u0301'.charCodeAt(2)]);
|
||||
chai.assert.equal(cell.combined, Content.IS_COMBINED);
|
||||
chai.assert.equal(cell.isCombined, Content.IS_COMBINED);
|
||||
// wide char
|
||||
cell.setFromCharData([123, '1', 2, '1'.charCodeAt(0)]);
|
||||
chai.assert.deepEqual(cell.asCharData, [123, '1', 2, '1'.charCodeAt(0)]);
|
||||
chai.assert.equal(cell.combined, 0);
|
||||
chai.assert.equal(cell.isCombined, 0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -331,39 +331,39 @@ describe('BufferLine', function(): void {
|
||||
describe('addCharToCell', () => {
|
||||
it('should set width to 1 for empty cell', () => {
|
||||
const line = new TestBufferLine(3, CellData.fromCharData([DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]), false);
|
||||
line.addCharToCell(0, '\u0301'.charCodeAt(0));
|
||||
line.addCodepointToCell(0, '\u0301'.charCodeAt(0));
|
||||
const cell = line.loadCell(0, new CellData());
|
||||
// chars contains single combining char
|
||||
// width is set to 1
|
||||
chai.assert.deepEqual(cell.asCharData, [DEFAULT_ATTR, '\u0301', 1, 0x0301]);
|
||||
// do not account a single combining char as combined
|
||||
chai.assert.equal(cell.combined, 0);
|
||||
chai.assert.equal(cell.isCombined, 0);
|
||||
});
|
||||
it('should add char to combining string in cell', () => {
|
||||
const line = new TestBufferLine(3, CellData.fromCharData([DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]), false);
|
||||
const cell = line .loadCell(0, new CellData());
|
||||
cell.setFromCharData([123, 'e\u0301', 1, 'e\u0301'.charCodeAt(1)]);
|
||||
line.setCell(0, cell);
|
||||
line.addCharToCell(0, '\u0301'.charCodeAt(0));
|
||||
line.addCodepointToCell(0, '\u0301'.charCodeAt(0));
|
||||
line.loadCell(0, cell);
|
||||
// chars contains 3 chars
|
||||
// width is set to 1
|
||||
chai.assert.deepEqual(cell.asCharData, [123, 'e\u0301\u0301', 1, 0x0301]);
|
||||
// do not account a single combining char as combined
|
||||
chai.assert.equal(cell.combined, Content.IS_COMBINED);
|
||||
chai.assert.equal(cell.isCombined, Content.IS_COMBINED);
|
||||
});
|
||||
it('should create combining string on taken cell', () => {
|
||||
const line = new TestBufferLine(3, CellData.fromCharData([DEFAULT_ATTR, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]), false);
|
||||
const cell = line .loadCell(0, new CellData());
|
||||
cell.setFromCharData([123, 'e', 1, 'e'.charCodeAt(1)]);
|
||||
line.setCell(0, cell);
|
||||
line.addCharToCell(0, '\u0301'.charCodeAt(0));
|
||||
line.addCodepointToCell(0, '\u0301'.charCodeAt(0));
|
||||
line.loadCell(0, cell);
|
||||
// chars contains 2 chars
|
||||
// width is set to 1
|
||||
chai.assert.deepEqual(cell.asCharData, [123, 'e\u0301', 1, 0x0301]);
|
||||
// do not account a single combining char as combined
|
||||
chai.assert.equal(cell.combined, Content.IS_COMBINED);
|
||||
chai.assert.equal(cell.isCombined, Content.IS_COMBINED);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user