call screen.destroy instead of process.exit in tests.

This commit is contained in:
Christopher Jeffrey 2015-08-07 21:00:31 -07:00
parent 7e0104ef42
commit b54e86d361
36 changed files with 52 additions and 47 deletions

View File

@ -127,7 +127,11 @@ var bottomright = blessed.terminal({
topleft.focus(); topleft.focus();
screen.key('C-q', function() { screen.key('C-q', function() {
return process.exit(0); topleft.kill();
topright.kill();
bottomleft.kill();
bottomright.kill();
return screen.destroy();
}); });
screen.program.key('S-tab', function() { screen.program.key('S-tab', function() {

View File

@ -27,7 +27,7 @@ var box2 = blessed.box({
}); });
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -26,7 +26,7 @@ var box = blessed.bigtext({
}); });
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -84,7 +84,7 @@ text.scroll = function(offset, always) {
text.focus(); text.focus();
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -82,7 +82,7 @@ blessed.listtable({
// }); // });
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -119,7 +119,7 @@ var over = blessed.box({
}); });
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -32,5 +32,5 @@ box.input('Input: ', '', function(err, data) {
}); });
screen.key('C-q', function(ch, key) { screen.key('C-q', function(ch, key) {
return process.exit(0); return screen.destroy();
}); });

View File

@ -47,7 +47,7 @@ fm.refresh();
screen.render(); screen.render();
screen.key('q', function() { screen.key('q', function() {
process.exit(0); screen.destroy();
}); });
screen.key(['s', 'p'], function() { screen.key(['s', 'p'], function() {

View File

@ -243,7 +243,7 @@ var bottom = blessed.line({
}); });
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
form.focus(); form.focus();

View File

@ -64,7 +64,7 @@ screen.key('i', function() {
}); });
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -33,5 +33,5 @@ setTimeout(function() {
}, 2000); }, 2000);
screen.key('q', function() { screen.key('q', function() {
process.exit(0); screen.destroy();
}); });

View File

@ -159,7 +159,7 @@ if (process.argv[2] !== 'grid') {
} }
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -116,7 +116,7 @@ screen.append(bar);
bar.focus(); bar.focus();
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -83,7 +83,7 @@ data2[1][0] = '{red-fg}' + data2[1][0] + '{/red-fg}';
data2[2][0] += ' (' + DU + JUAN + ')'; data2[2][0] += ' (' + DU + JUAN + ')';
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
table.focus(); table.focus();

View File

@ -42,7 +42,7 @@ setInterval(function() {
}, 1000).unref(); }, 1000).unref();
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -23,7 +23,7 @@ blessed.box({
}); });
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -38,11 +38,11 @@ list.select(0);
list.on('select', function(item) { list.on('select', function(item) {
console.log(item.getText()); console.log(item.getText());
process.exit(0); screen.destroy();
}); });
screen.key('C-c', function() { screen.key('C-c', function() {
process.exit(0); screen.destroy();
}); });
list.focus(); list.focus();

View File

@ -23,7 +23,7 @@ var box = blessed.box({
box.focus(); box.focus();
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -68,5 +68,5 @@ box.focus();
screen.render(); screen.render();
screen.key('q', function() { screen.key('q', function() {
process.exit(0); screen.destroy();
}); });

View File

@ -22,7 +22,7 @@ blessed.box({
}); });
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -8,7 +8,10 @@ var screen = blessed.screen({
var frames = require(__dirname + '/frames.json'); var frames = require(__dirname + '/frames.json');
setInterval(function() { var timer = setInterval(function() {
if (!frames.length) return process.exit(0); if (!frames.length) {
clearInterval(timer);
return screen.destroy();
}
process.stdout.write(frames.shift()); process.stdout.write(frames.shift());
}, 100); }, 100);

View File

@ -94,7 +94,7 @@ var png = blessed.image({
screen.render(); screen.render();
screen.key('q', function() { screen.key('q', function() {
process.exit(0); screen.destroy();
}); });
var timeout = setInterval(function() { var timeout = setInterval(function() {

View File

@ -107,7 +107,7 @@ assert.equal(inner.rtop, 4);
screen.on('keypress', function(ch, key) { screen.on('keypress', function(ch, key) {
if (key.name === 'escape' || key.name === 'q') { if (key.name === 'escape' || key.name === 'q') {
return process.exit(0); return screen.destroy();
} }
}); });

View File

@ -69,7 +69,7 @@ prompt.input('Question?', '', function(err, value) {
loader.load('Loading...'); loader.load('Loading...');
setTimeout(function() { setTimeout(function() {
loader.stop(); loader.stop();
process.exit(0); screen.destroy();
}, 3000); }, 3000);
}); });
}); });
@ -77,7 +77,7 @@ prompt.input('Question?', '', function(err, value) {
}); });
screen.key('q', function() { screen.key('q', function() {
process.exit(0); screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -36,18 +36,16 @@ var text = blessed.scrollabletext({
text.focus(); text.focus();
screen.key('q', function() {
return process.exit(0);
});
screen.render();
var frames = []; var frames = [];
setInterval(function() { var timer = setInterval(function() {
frames.push(screen.screenshot()); frames.push(screen.screenshot());
}, 100); }, 100);
process.on('exit', function() { screen.key('C-q', function() {
fs.writeFileSync(__dirname + '/frames.json', JSON.stringify(frames)); fs.writeFileSync(__dirname + '/frames.json', JSON.stringify(frames));
clearInterval(timer);
return screen.destroy();
}); });
screen.render();

View File

@ -120,7 +120,7 @@ var box3 = blessed.box({
}); });
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
box.focus(); box.focus();

View File

@ -75,7 +75,7 @@ over.key('down', function() {
over.focus(); over.focus();
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
var lorem = 'Non eram nescius Brute cum quae summis ingeniis exquisitaque' var lorem = 'Non eram nescius Brute cum quae summis ingeniis exquisitaque'

View File

@ -37,7 +37,7 @@ tab._.data = blessed.text({
tab._.data.setContent(require('util').inspect(process, null, 6)); tab._.data.setContent(require('util').inspect(process, null, 6));
screen.key('q', function() { screen.key('q', function() {
process.exit(0); screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -151,11 +151,11 @@ form._.submit.on('press', function() {
form.on('submit', function(data) { form.on('submit', function(data) {
screen.leave(); screen.leave();
console.log(data); console.log(data);
process.exit(0); screen.destroy();
}); });
screen.key('q', function() { screen.key('q', function() {
process.exit(0); screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -37,7 +37,7 @@ var inner = blessed.box({
}); });
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -58,7 +58,7 @@ data2[1][0] = '{red-fg}' + data2[1][0] + '{/red-fg}';
data2[2][0] += ' (' + DU + JUAN + ')'; data2[2][0] += ' (' + DU + JUAN + ')';
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
table.setData(data2); table.setData(data2);

View File

@ -39,7 +39,7 @@ var text = blessed.scrollabletext({
text.focus(); text.focus();
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -24,7 +24,7 @@ var box = blessed.textarea({
screen.render(); screen.render();
screen.key('q', function() { screen.key('q', function() {
process.exit(0); screen.destroy();
}); });
screen.key('i', function() { screen.key('i', function() {

View File

@ -105,7 +105,7 @@ var main = blessed.box({
main.focus(); main.focus();
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -22,7 +22,7 @@ var box = blessed.box({
}); });
screen.key('q', function() { screen.key('q', function() {
return process.exit(0); return screen.destroy();
}); });
screen.render(); screen.render();

View File

@ -23,5 +23,5 @@ video.focus();
screen.render(); screen.render();
screen.key(['q', 'C-q', 'C-c'], function() { screen.key(['q', 'C-q', 'C-c'], function() {
process.exit(0); screen.destroy();
}); });