const BaseDetailsView = function BaseDetailsView(options) { BaseView.call(this, options); this.screen = options.parent.screen; this.node = blessed.box(this.layoutConfig); this.parent.append(this.node); this.refreshContent(); this.recalculatePosition(); }
describe("constructor", () => { it("should create a popup screen", () => { const gotoTimeView = new GotoTimeView(options); expect(gotoTimeView).to.be.an.instanceof(GotoTimeView); expect(gotoTimeView).to.have.property("metricsProvider").which.is.an.instanceOf(MetricsProvider); expect(gotoTimeView).to.have.property("screen").which.is.an("object"); expect(gotoTimeView).to.have.property("parent").which.is.an.instanceOf(blessed.box); expect(gotoTimeView).to.have.property("node").which.is.an.instanceOf(blessed.node); expect(gotoTimeView).to.have.property("form").which.is.an.instanceOf(blessed.form); expect(gotoTimeView).to.have.property("timeRangeLabel").which.is.an.instanceOf(blessed.text); expect(gotoTimeView).to.have.property("textBox").which.is.an.instanceOf(blessed.textbox); expect(gotoTimeView).to.have.property("errorText").which.is.an.instanceOf(blessed.text); expect(gotoTimeView).to.have.property("acceptButton").which.is.an.instanceOf(blessed.button); expect(gotoTimeView).to.have.property("cancelButton").which.is.an.instanceOf(blessed.button); }); });
describe("constructor", () => { it("should create a box with two gauges and listen for metrics event", () => { const append = sandbox.spy(blessed.node.prototype, "append"); const memory = new MemoryGaugeView(options); expect(memory).to.have.property("node").that.is.an.instanceof(blessed.box); expect(memory.node).to.have.nested.property("options.label", " memory "); expect(append.thirdCall).to.have.been.calledOn(testContainer) .and.calledWithExactly(memory.node); expect(testContainer.screen.on).to.have.been.calledWithExactly("metrics", sinon.match.func); expect(memory).to.have.property("heapGauge").that.is.an.instanceof(contrib.gauge); expect(memory.heapGauge).to.have.nested.property("options.label", "heap"); expect(append.firstCall).to.have.been.calledOn(memory.node) .and.calledWithExactly(memory.heapGauge); expect(memory).to.have.property("rssGauge").that.is.an.instanceof(contrib.gauge); expect(memory.rssGauge).to.have.nested.property("options.label", "resident"); expect(append.secondCall).to.have.been.calledOn(memory.node) .and.calledWithExactly(memory.rssGauge); }); });
describe("HelpView", () => { let sandbox; let testContainer; before(() => { sandbox = sinon.createSandbox(); }); beforeEach(() => { utils.stubWidgets(sandbox); testContainer = utils.getTestContainer(sandbox); }); afterEach(() => { sandbox.restore(); }); it("should create a box with text describing keybindings", () => { const help = new HelpView({ parent: testContainer }); expect(help).to.have.property("node").that.is.an.instanceof(blessed.box); expect(help.node).to.have.nested.property("options.content").that.contains("keybindings"); expect(help.node).to.have.property("hidden", true); }); });
].join("\n"); this.node = blessed.box({ position: { top: "center",
function () { this.node = blessed.box({ position: { top: "center",
create() { this. label = "Network"; this. grid = new contrib.grid({ rows: 1, cols: 1, label: this.label, screen: this.screen }); this.text = this.grid.set(0, 0, 1, 1, blessed.box, { align: 'center', label: this.label }); this.ip = internalIp.v4.sync(); this.text.setContent(`\n\n\n\nLocal IP: ${this.ip}`); }
const render = (artist, title, lyrics) => { const screenTitle = chalk.yellow.bold(`${artist} - ${title}`) const highlightedLyrics = lyrics.replace(/^\[(.+)\]/gm, chalk.green.bold('[$1]')) const content = [screenTitle, '\n', highlightedLyrics].join('\n') const screen = blessed.screen({ smartCSR: true, fullUnicode: true }) const box = blessed.box({ width: '85%', height: '85%', left: 'center', top: 'center', scrollable: true, alwaysScroll: true, keys: true, vi: true, content: content }) screen.append(box) screen.render() screen.key(['escape', 'q', 'C-c'], () => process.exit(0)) return screen }
}); this.temperatureText = this.grid.set(0, 0, 3, 1, blessed.box, { align: 'center', label: `Temperature for ${config.weatherLocation}` }); this.windText = this.grid.set(3, 0, 3, 1, blessed.box, { align: 'center', label: 'Wind' }); this.skyText = this.grid.set(6, 0, 3, 1, blessed.box, { align: 'center', label: 'Sky'
/** * @return {InfoBar} * @constructor */ var InfoBar = function() { this._playlist = app.ui.console._panels.mainPL.playlist; this._node = blessed.box({ left: 0, top: 0, height: 3, width: '50%', border: { type: 'line' } }); app.ui.console.append(this._node); app.service.player.on('play', function(currentTrack) { var message = currentTrack.position + '. ' + currentTrack.track.toString(); this._node.setText(message); app.ui.console.render(); }.bind(this)); }
if (self.legend) self.remove(self.legend) var legendWidth = self.options.legend.width || 15 self.legend = blessed.box({ height: data.length + 2, top: 1,
const box = blessed.box({ width: '85%', height: '85%',
}); this.price = this.grid.set(0, 0, 2, 1, blessed.box, { align: 'center', label: 'Current ETH price'