UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

104 lines 3.71 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const test_utils_1 = require("@sprucelabs/test-utils"); const AbstractCliTest_1 = __importDefault(require("../../tests/AbstractCliTest")); const WidgetFactory_1 = __importDefault(require("../../widgets/WidgetFactory")); class WidgetsTest extends AbstractCliTest_1.default { static factory; static async beforeEach() { await super.beforeEach(); this.factory = new WidgetFactory_1.default(); } static async canCreateFactory() { test_utils_1.assert.isTruthy(this.factory); } static async canCreateTextWidget() { const log = this.buildText(); test_utils_1.assert.isTruthy(log); } static async setsStartingFrame() { const text = this.buildText(); test_utils_1.assert.isEqualDeep(text.getFrame(), { left: 0, top: 0, width: 4, height: 4, }); } static canCreateWindow() { const window = this.factory.Widget('window', {}); test_utils_1.assert.isTruthy(window); } static canCreateProgressBar() { const progress = this.factory.Widget('progressBar', { progress: 0, }); test_utils_1.assert.isTruthy(progress); } static canCreateText() { const text = this.factory.Widget('text', {}); test_utils_1.assert.isTruthy(text); } static canCreateLayout() { const window = this.factory.Widget('window', {}); const layout = this.factory.Widget('layout', { parent: window, width: '100%', rows: [ { id: 'row_1', height: '100%', columns: [ { id: 'column_1', width: '100%', }, ], }, ], }); test_utils_1.assert.isTruthy(layout); const column = layout.getChildById('results'); test_utils_1.assert.isTruthy(column); } static buildText() { return this.factory.Widget('text', { left: 0, top: 0, width: 4, height: 4, }); } } exports.default = WidgetsTest; __decorate([ (0, test_utils_1.test)() ], WidgetsTest, "canCreateFactory", null); __decorate([ (0, test_utils_1.test)() ], WidgetsTest, "canCreateTextWidget", null); __decorate([ (0, test_utils_1.test)() ], WidgetsTest, "setsStartingFrame", null); __decorate([ (0, test_utils_1.test)() ], WidgetsTest, "canCreateWindow", null); __decorate([ (0, test_utils_1.test)() ], WidgetsTest, "canCreateProgressBar", null); __decorate([ (0, test_utils_1.test)() ], WidgetsTest, "canCreateText", null); __decorate([ test_utils_1.test.skip('enable when ready to fake termkit') ], WidgetsTest, "canCreateLayout", null); //# sourceMappingURL=Widgets.test.js.map