Merge remote-tracking branch 'upstream/master' into 439_wide_char_class

This commit is contained in:
Daniel Imms
2017-01-08 16:32:51 -08:00
7 changed files with 111 additions and 82 deletions
+10
View File
@@ -1,6 +1,11 @@
import { assert } from 'chai';
import { Viewport } from './Viewport';
class MockWindow {
// Disable refreshLoop in test
public requestAnimationFrame() { }
}
describe('Viewport', () => {
let terminal;
let viewportElement;
@@ -11,6 +16,7 @@ describe('Viewport', () => {
const CHARACTER_HEIGHT = 10;
beforeEach(() => {
(<any>global).window = new MockWindow();
terminal = {
lines: [],
rows: 0,
@@ -67,10 +73,14 @@ describe('Viewport', () => {
terminal.rows = 1;
assert.equal(scrollAreaElement.style.height, 0 * CHARACTER_HEIGHT + 'px');
viewport.syncScrollArea();
assert.ok(viewport.isRefreshQueued);
viewport.refresh();
assert.equal(viewportElement.style.height, 1 * CHARACTER_HEIGHT + 'px');
assert.equal(scrollAreaElement.style.height, 1 * CHARACTER_HEIGHT + 'px');
terminal.lines.push('');
viewport.syncScrollArea();
assert.ok(viewport.isRefreshQueued);
viewport.refresh();
assert.equal(viewportElement.style.height, 1 * CHARACTER_HEIGHT + 'px');
assert.equal(scrollAreaElement.style.height, 2 * CHARACTER_HEIGHT + 'px');
});