@dodona/papyros
Version:
Scratchpad for multiple programming languages in the browser.
43 lines • 1.71 kB
JavaScript
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;
};
import { State, stateProperty } from "@dodona/lit-state";
import { Runner } from "./Runner";
export class Test extends State {
editTestCode() {
this.papyros.runner.code = this.papyros.runner.effectiveCode;
this.testCode = undefined;
}
get testLines() {
if (this.testCode === undefined) {
return undefined;
}
const codeLines = this.papyros.runner.code.split("\n").length;
const testLines = this.testCode.split("\n").length;
return Array.from({ length: testLines }, (_, i) => i + codeLines + Runner.CODE_SEPARATOR.length);
}
get testLineCount() {
if (this.testCode === undefined) {
return undefined;
}
return this.testCode.split("\n").length;
}
constructor(papyros) {
super();
this.testCode = undefined;
this.papyros = papyros;
}
}
__decorate([
stateProperty
], Test.prototype, "testCode", void 0);
__decorate([
stateProperty
], Test.prototype, "testLines", null);
__decorate([
stateProperty
], Test.prototype, "testLineCount", null);
//# sourceMappingURL=Test.js.map