Skip to content

Commit

Permalink
add test for blessed+term.js. see chjj#168.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Aug 18, 2015
1 parent 05dcd84 commit 7a1a979
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions test/widget-term-blessed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
var blessed = require('../');

var screen = blessed.screen({
dump: __dirname + '/logs/termblessed.log',
smartCSR: true,
warnings: true
});

var terminal = blessed.terminal({
parent: screen,
// cursor: 'line',
cursorBlink: true,
screenKeys: false,
top: 'center',
left: 'center',
width: '90%',
height: '90%',
border: 'line',
handler: function() {},
style: {
fg: 'default',
bg: 'default',
focus: {
border: {
fg: 'green'
}
}
}
});

terminal.focus();

var term = terminal.term;

var screen2 = blessed.screen({
dump: __dirname + '/logs/termblessed2.log',
smartCSR: true,
warnings: true,
input: term,
output: term
});

var box1 = blessed.box({
parent: screen2,
top: 'center',
left: 'center',
width: 20,
height: 10,
border: 'line',
content: 'Hello world'
});

screen.key('C-q', function() {
// NOTE:
// not necessary since screen.destroy causes terminal.term to be destroyed
// (screen2's input and output are no longer readable/writable)
// screen2.destroy();
return screen.destroy();
});

screen2.render();
screen.render();

0 comments on commit 7a1a979

Please sign in to comment.