diff --git a/src/LexerParser.ts b/src/LexerParser.ts index 78feab20..20ccf1cf 100644 --- a/src/LexerParser.ts +++ b/src/LexerParser.ts @@ -1,6 +1,8 @@ import * as fs from "fs"; import * as path from "path"; +import { promisify } from "util"; import pSettle from "p-settle"; +const readFile = promisify(fs.readFile); import { Lexer } from "./lexer"; import { Parser, Stmt } from "./parser/"; @@ -31,7 +33,7 @@ export function getLexerParserFn( if (script.uri !== undefined) { filename = script.uri.replace(/[\/\\]+/g, path.posix.sep); try { - contents = fs.readFileSync(filename, "utf-8"); + contents = await readFile(filename, "utf-8"); } catch (err) { let errno = (err as NodeJS.ErrnoException)?.errno || -4858; return Promise.reject({ diff --git a/src/brsTypes/components/RoDeviceInfo.ts b/src/brsTypes/components/RoDeviceInfo.ts index 735c6a65..d467f698 100644 --- a/src/brsTypes/components/RoDeviceInfo.ts +++ b/src/brsTypes/components/RoDeviceInfo.ts @@ -641,7 +641,8 @@ export class RoDeviceInfo extends BrsComponent implements BrsValue { returns: ValueKind.Void, }, impl: (_, port: RoMessagePort) => { - return this.port = port; + this.port = port; + return BrsInvalid.Instance; }, }); diff --git a/src/brsTypes/components/RoSGNode.ts b/src/brsTypes/components/RoSGNode.ts index b1f6e477..2b5fc8f2 100644 --- a/src/brsTypes/components/RoSGNode.ts +++ b/src/brsTypes/components/RoSGNode.ts @@ -387,9 +387,9 @@ export class RoSGNode extends BrsComponent implements BrsValue, BrsIterable { return [ ` =`, "{", - ...Array.from(this.fields.entries()).reverse().map( - ([key, value]) => ` ${key}: ${value.toString(this)}` - ), + ...Array.from(this.fields.entries()) + .reverse() + .map(([key, value]) => ` ${key}: ${value.toString(this)}`), "}", ].join("\n"); } diff --git a/src/brsTypes/components/RoSGScreen.ts b/src/brsTypes/components/RoSGScreen.ts index ac6c53e7..ee5011a8 100644 --- a/src/brsTypes/components/RoSGScreen.ts +++ b/src/brsTypes/components/RoSGScreen.ts @@ -112,7 +112,8 @@ export class roSGScreen extends BrsComponent implements BrsValue { returns: ValueKind.Void, }, impl: (_, port: RoMessagePort) => { - return this.port = port; + this.port = port; + return BrsInvalid.Instance; }, }); /** Returns the message port (if any) currently associated with the object */ diff --git a/src/brsTypes/index.ts b/src/brsTypes/index.ts index 19380317..7c800bee 100644 --- a/src/brsTypes/index.ts +++ b/src/brsTypes/index.ts @@ -181,11 +181,7 @@ export function isBrsEvent(value: BrsType): value is BrsEvent { } // The set of BrightScript Event components -export type BrsEvent = - | RoDeviceInfoEvent - | RoSGNodeEvent - | RoSGScreenEvent; - +export type BrsEvent = RoDeviceInfoEvent | RoSGNodeEvent | RoSGScreenEvent; /** * The set of all comparable BrightScript types. Only primitive (i.e. intrinsic * and unboxed) diff --git a/src/index.ts b/src/index.ts index 7cadbeb5..21c20780 100644 --- a/src/index.ts +++ b/src/index.ts @@ -134,13 +134,6 @@ async function loadFiles(options: Partial) { } componentDefinitions.forEach((component: ComponentDefinition) => { - console.log( - `Component: ${component.name?.padEnd(16)} fields: ${ - Object.keys(component.fields).length - } scripts: ${component.scripts.length} functions: ${ - Object.keys(component.functions).length - } children: ${component.children.length}` - ); if (component.scripts.length < 1) return; try { component.scripts = component.scripts.map((script: ComponentScript) => { diff --git a/src/interpreter/Environment.ts b/src/interpreter/Environment.ts index 55f9022e..7e220562 100644 --- a/src/interpreter/Environment.ts +++ b/src/interpreter/Environment.ts @@ -72,7 +72,6 @@ export class Environment { /** The node in which field-change observers are registered. */ public hostNode: RoSGNode | undefined; - public nodeName: string = ""; /** * Stores a `value` for the `name`d variable in the provided `scope`. * @param scope The logical region from a particular variable or function that defines where it may be accessed from diff --git a/test/brsTypes/components/RoInvalid.test.js b/test/brsTypes/components/RoInvalid.test.js index 3f95683c..a6352e75 100644 --- a/test/brsTypes/components/RoInvalid.test.js +++ b/test/brsTypes/components/RoInvalid.test.js @@ -1,25 +1,25 @@ const brs = require("../../../lib"); -const { RoAssociativeArray, BrsBoolean, BrsInvalid, roInvalid } = brs.types; +const { RoAssociativeArray, BrsBoolean, BrsInvalid, RoInvalid } = brs.types; describe("RoInvalid", () => { describe("comparisons", () => { it("is equal to itself", () => { - let a = new roInvalid(); + let a = new RoInvalid(); expect(a.equalTo(a)).toBe(BrsBoolean.True); }); it("is equal to invalid", () => { - let a = new roInvalid(); + let a = new RoInvalid(); expect(a.equalTo(BrsInvalid.Instance)).toBe(BrsBoolean.True); }); - it("is equal to roInvalid", () => { - let a = new roInvalid(); - expect(a.equalTo(new roInvalid())).toBe(BrsBoolean.True); + it("is equal to RoInvalid", () => { + let a = new RoInvalid(); + expect(a.equalTo(new RoInvalid())).toBe(BrsBoolean.True); }); it("is not equal to a RoAssocArray", () => { - let a = new roInvalid(); + let a = new RoInvalid(); let b = new RoAssociativeArray([]); expect(a.equalTo(b)).toBe(BrsBoolean.False); }); @@ -27,7 +27,7 @@ describe("RoInvalid", () => { describe("stringification", () => { it("stringifies itself", () => { - let a = new roInvalid(); + let a = new RoInvalid(); expect(a.toString()).toBe(""); }); }); diff --git a/test/brsTypes/components/RoSGNode.test.js b/test/brsTypes/components/RoSGNode.test.js index 7e702246..e7c3211b 100644 --- a/test/brsTypes/components/RoSGNode.test.js +++ b/test/brsTypes/components/RoSGNode.test.js @@ -1,4 +1,5 @@ const brs = require("../../../lib"); +const { RoInvalid } = require("../../../lib/brsTypes/components/RoInvalid"); const { RoAssociativeArray, RoSGNode, @@ -35,16 +36,16 @@ describe("RoSGNode", () => { expect(node.toString()).toEqual( ` = { + number: -1 + string: "a string" + boolean: true + node: + associative-array: + array: change: focusable: false - focusedchild: invalid + focusedchild: id: "" - array: - associative-array: - node: - boolean: true - string: "a string" - number: -1 }` ); }); @@ -364,6 +365,9 @@ describe("RoSGNode", () => { expect(keyValPairs.length).toEqual(expectedValues.length); expectedValues.forEach((expectedValue, index) => { let actualValue = keyValPairs[index].get(new BrsString("value")); + if ("unbox" in actualValue) { + actualValue = actualValue.unbox(); + } expect(actualValue).toEqual(expectedValue); }); }); @@ -386,6 +390,9 @@ describe("RoSGNode", () => { expect(keyValPairs.length).toEqual(expectedValues.length); expectedValues.forEach((expectedValue, index) => { let actualValue = keyValPairs[index].get(new BrsString("value")); + if ("unbox" in actualValue) { + actualValue = actualValue.unbox(); + } expect(actualValue).toEqual(expectedValue); }); }); @@ -536,6 +543,9 @@ describe("RoSGNode", () => { expect(value.elements).toBeInstanceOf(Map); expect(value.elements).toEqual(expected.elements.get(name).elements); } else { + if ("unbox" in value) { + value = value.unbox(); + } expect(value).toEqual(expected.elements.get(name)); } }); @@ -2189,8 +2199,8 @@ describe("RoSGNode", () => { expect(result).toEqual(BrsBoolean.False); // by default their focusedChild fields should be invalid - expect(child1.get(focusedChildString)).toEqual(BrsInvalid.Instance); - expect(child2.get(focusedChildString)).toEqual(BrsInvalid.Instance); + expect(child1.get(focusedChildString).unbox()).toEqual(BrsInvalid.Instance); + expect(child2.get(focusedChildString).unbox()).toEqual(BrsInvalid.Instance); //focus on child 1 child1SetFocus.call(interpreter, BrsBoolean.True); @@ -2199,7 +2209,7 @@ describe("RoSGNode", () => { result = child2HasFocus.call(interpreter); expect(result).toEqual(BrsBoolean.False); expect(child1.get(focusedChildString)).toEqual(child1); - expect(child2.get(focusedChildString)).toEqual(BrsInvalid.Instance); + expect(child2.get(focusedChildString).unbox()).toEqual(BrsInvalid.Instance); //focus on child 2 should remove focus from child 1 child2SetFocus.call(interpreter, BrsBoolean.True); @@ -2224,7 +2234,7 @@ describe("RoSGNode", () => { result = child2HasFocus.call(interpreter); expect(result).toEqual(BrsBoolean.False); expect(child1.get(focusedChildString)).toEqual(child1); - expect(child2.get(focusedChildString)).toEqual(BrsInvalid.Instance); + expect(child2.get(focusedChildString).unbox()).toEqual(BrsInvalid.Instance); //set focus to false on child 1 child1SetFocus.call(interpreter, BrsBoolean.False); @@ -2233,7 +2243,7 @@ describe("RoSGNode", () => { result = child2HasFocus.call(interpreter); expect(result).toEqual(BrsBoolean.False); expect(child1.get(focusedChildString)).toEqual(BrsInvalid.Instance); - expect(child2.get(focusedChildString)).toEqual(BrsInvalid.Instance); + expect(child2.get(focusedChildString).unbox()).toEqual(BrsInvalid.Instance); }); }); diff --git a/test/brsTypes/nodes/ArrayGrid.test.js b/test/brsTypes/nodes/ArrayGrid.test.js index 7fdce07d..9b707ae5 100644 --- a/test/brsTypes/nodes/ArrayGrid.test.js +++ b/test/brsTypes/nodes/ArrayGrid.test.js @@ -9,67 +9,67 @@ describe("ArrayGrid", () => { expect(group.toString()).toEqual( ` = { + currfocussection: 0 + currfocuscolumn: 0 + currfocusrow: 0 + animatetoitem: 0 + jumptoitem: 0 + itemunfocused: 0 + itemfocused: 0 + itemselected: 0 + itemclippingrect: + sectiondividerleftoffset: 0 + sectiondividerminwidth: 0 + sectiondividerheight: 0 + sectiondividerwidth: 0 + sectiondividerspacing: 0 + sectiondividertextcolor: "" + sectiondividerfont: + sectiondividerbitmapuri: "" + columnspacings: + rowspacings: + columnwidths: + rowheights: + numrenderpasses: 1 + fixedlayout: false + wrapdividerheight: 36 + wrapdividerwidth: 0 + wrapdividerbitmapuri: "" + focusfootprintblendcolor: "0xFFFFFFFF" + focusbitmapblendcolor: "0xFFFFFFFF" + focusfootprintbitmapuri: "" + focusbitmapuri: "" + currfocusfeedbackopacity: NaN + fadefocusfeedbackwhenautoscrolling: false + drawfocusfeedback: true + drawfocusfeedbackontop: false + vertfocusanimationstyle: "floatingFocus" + horizfocusanimationstyle: "floatingFocus" + focuscolumn: 0 + focusrow: 0 + numcolumns: 0 + numrows: 0 + itemspacing: + itemsize: + content: + rendertracking: "disabled" + enablerendertracking: false + muteaudioguide: false + renderpass: 0 + clippingrect: + inheritparentopacity: true + inheritparenttransform: true + childrenderorder: "renderLast" + scalerotatecenter: + scale: + rotation: 0 + translation: + opacity: 1 + visible: true change: focusable: false - focusedchild: invalid + focusedchild: id: "" - visible: true - opacity: 1 - translation: - rotation: 0 - scale: - scalerotatecenter: - childrenderorder: "renderLast" - inheritparenttransform: true - inheritparentopacity: true - clippingrect: - renderpass: 0 - muteaudioguide: false - enablerendertracking: false - rendertracking: "disabled" - content: invalid - itemsize: - itemspacing: - numrows: 0 - numcolumns: 0 - focusrow: 0 - focuscolumn: 0 - horizfocusanimationstyle: "floatingFocus" - vertfocusanimationstyle: "floatingFocus" - drawfocusfeedbackontop: false - drawfocusfeedback: true - fadefocusfeedbackwhenautoscrolling: false - currfocusfeedbackopacity: NaN - focusbitmapuri: "" - focusfootprintbitmapuri: "" - focusbitmapblendcolor: "0xFFFFFFFF" - focusfootprintblendcolor: "0xFFFFFFFF" - wrapdividerbitmapuri: "" - wrapdividerwidth: 0 - wrapdividerheight: 36 - fixedlayout: false - numrenderpasses: 1 - rowheights: - columnwidths: - rowspacings: - columnspacings: - sectiondividerbitmapuri: "" - sectiondividerfont: invalid - sectiondividertextcolor: "" - sectiondividerspacing: 0 - sectiondividerwidth: 0 - sectiondividerheight: 0 - sectiondividerminwidth: 0 - sectiondividerleftoffset: 0 - itemclippingrect: - itemselected: 0 - itemfocused: 0 - itemunfocused: 0 - jumptoitem: 0 - animatetoitem: 0 - currfocusrow: 0 - currfocuscolumn: 0 - currfocussection: 0 }` ); }); diff --git a/test/brsTypes/nodes/ContentNode.test.js b/test/brsTypes/nodes/ContentNode.test.js index ee497774..2d40e045 100644 --- a/test/brsTypes/nodes/ContentNode.test.js +++ b/test/brsTypes/nodes/ContentNode.test.js @@ -10,10 +10,10 @@ describe("ContentNode.js", () => { expect(node.toString()).toEqual( ` = { - change: - focusable: false - focusedchild: invalid id: "" + focusedchild: + focusable: false + change: }` ); }); @@ -142,10 +142,10 @@ describe("ContentNode.js", () => { expect(node.toString()).toEqual( ` = { - change: - focusable: false - focusedchild: invalid id: "" + focusedchild: + focusable: false + change: DESCRIPTION: "" }` ); @@ -160,10 +160,10 @@ describe("ContentNode.js", () => { expect(node.toString()).toEqual( ` = { - change: - focusable: false - focusedchild: invalid id: "" + focusedchild: + focusable: false + change: DESCRIPTION: "" }` ); @@ -182,10 +182,10 @@ describe("ContentNode.js", () => { expect(node.toString()).toEqual( ` = { - change: - focusable: false - focusedchild: invalid id: "" + focusedchild: + focusable: false + change: DESCRIPTION: "new value" }` ); @@ -205,10 +205,10 @@ describe("ContentNode.js", () => { expect(node.toString()).toEqual( ` = { - change: - focusable: false - focusedchild: invalid id: "" + focusedchild: + focusable: false + change: DESCRIPTION: "new value" }` ); @@ -223,10 +223,10 @@ describe("ContentNode.js", () => { expect(node.toString()).toEqual( ` = { - change: - focusable: false - focusedchild: invalid id: "" + focusedchild: + focusable: false + change: DESCRIPTION: "" }` ); @@ -241,10 +241,10 @@ describe("ContentNode.js", () => { expect(node.toString()).toEqual( ` = { - change: - focusable: false - focusedchild: invalid id: "" + focusedchild: + focusable: false + change: DESCRIPTION: "" }` ); diff --git a/test/brsTypes/nodes/Font.test.js b/test/brsTypes/nodes/Font.test.js index 7743044c..08af99f7 100644 --- a/test/brsTypes/nodes/Font.test.js +++ b/test/brsTypes/nodes/Font.test.js @@ -9,13 +9,13 @@ describe("Font", () => { expect(group.toString()).toEqual( ` = { + fallbackglyph: "" + size: 24 + uri: "" change: focusable: false - focusedchild: invalid + focusedchild: id: "" - uri: "" - size: 1 - fallbackglyph: "" }` ); }); diff --git a/test/brsTypes/nodes/Group.test.js b/test/brsTypes/nodes/Group.test.js index 02e459ff..ab8ce4c5 100644 --- a/test/brsTypes/nodes/Group.test.js +++ b/test/brsTypes/nodes/Group.test.js @@ -9,24 +9,24 @@ describe("Group", () => { expect(group.toString()).toEqual( ` = { + rendertracking: "disabled" + enablerendertracking: false + muteaudioguide: false + renderpass: 0 + clippingrect: + inheritparentopacity: true + inheritparenttransform: true + childrenderorder: "renderLast" + scalerotatecenter: + scale: + rotation: 0 + translation: + opacity: 1 + visible: true change: focusable: false - focusedchild: invalid + focusedchild: id: "" - visible: true - opacity: 1 - translation: - rotation: 0 - scale: - scalerotatecenter: - childrenderorder: "renderLast" - inheritparenttransform: true - inheritparentopacity: true - clippingrect: - renderpass: 0 - muteaudioguide: false - enablerendertracking: false - rendertracking: "disabled" }` ); }); diff --git a/test/brsTypes/nodes/Label.test.js b/test/brsTypes/nodes/Label.test.js index 8442861a..aa41ad99 100644 --- a/test/brsTypes/nodes/Label.test.js +++ b/test/brsTypes/nodes/Label.test.js @@ -9,41 +9,41 @@ describe("Label", () => { expect(group.toString()).toEqual( ` = { + istextellipsized: false + ellipsistext: "" + wordbreakchars: "" + truncateondelimiter: "" + ellipsizeonboundary: false + displaypartiallines: false + linespacing: 0 + wrap: false + maxlines: 0 + numlines: 0 + height: 0 + width: 0 + vertalign: "top" + horizalign: "left" + font: + color: "0xddddddff" + text: "" + rendertracking: "disabled" + enablerendertracking: false + muteaudioguide: false + renderpass: 0 + clippingrect: + inheritparentopacity: true + inheritparenttransform: true + childrenderorder: "renderLast" + scalerotatecenter: + scale: + rotation: 0 + translation: + opacity: 1 + visible: true change: focusable: false - focusedchild: invalid + focusedchild: id: "" - visible: true - opacity: 1 - translation: - rotation: 0 - scale: - scalerotatecenter: - childrenderorder: "renderLast" - inheritparenttransform: true - inheritparentopacity: true - clippingrect: - renderpass: 0 - muteaudioguide: false - enablerendertracking: false - rendertracking: "disabled" - text: "" - color: "0xddddddff" - font: invalid - horizalign: "left" - vertalign: "top" - width: 0 - height: 0 - numlines: 0 - maxlines: 0 - wrap: false - linespacing: 0 - displaypartiallines: false - ellipsizeonboundary: false - truncateondelimiter: "" - wordbreakchars: "" - ellipsistext: "" - istextellipsized: false }` ); }); diff --git a/test/brsTypes/nodes/LayoutGroup.test.js b/test/brsTypes/nodes/LayoutGroup.test.js index 740a93f9..8f5a0df0 100644 --- a/test/brsTypes/nodes/LayoutGroup.test.js +++ b/test/brsTypes/nodes/LayoutGroup.test.js @@ -9,29 +9,29 @@ describe("LayoutGroup", () => { expect(group.toString()).toEqual( ` = { + additemspacingafterchild: true + itemspacings: + vertalignment: "top" + horizalignment: "left" + layoutdirection: "vert" + rendertracking: "disabled" + enablerendertracking: false + muteaudioguide: false + renderpass: 0 + clippingrect: + inheritparentopacity: true + inheritparenttransform: true + childrenderorder: "renderLast" + scalerotatecenter: + scale: + rotation: 0 + translation: + opacity: 1 + visible: true change: focusable: false - focusedchild: invalid + focusedchild: id: "" - visible: true - opacity: 1 - translation: - rotation: 0 - scale: - scalerotatecenter: - childrenderorder: "renderLast" - inheritparenttransform: true - inheritparentopacity: true - clippingrect: - renderpass: 0 - muteaudioguide: false - enablerendertracking: false - rendertracking: "disabled" - layoutdirection: "vert" - horizalignment: "left" - vertalignment: "top" - itemspacings: - additemspacingafterchild: true }` ); }); diff --git a/test/brsTypes/nodes/MarkupGrid.test.js b/test/brsTypes/nodes/MarkupGrid.test.js index 83c72cb3..6e58e4f0 100644 --- a/test/brsTypes/nodes/MarkupGrid.test.js +++ b/test/brsTypes/nodes/MarkupGrid.test.js @@ -9,69 +9,69 @@ describe("MarkupGrid", () => { expect(group.toString()).toEqual( ` = { + imagewellbitmapuri: "" + itemcomponentname: "" + currfocussection: 0 + currfocuscolumn: 0 + currfocusrow: 0 + animatetoitem: 0 + jumptoitem: 0 + itemunfocused: 0 + itemfocused: 0 + itemselected: 0 + itemclippingrect: + sectiondividerleftoffset: 0 + sectiondividerminwidth: 117 + sectiondividerheight: 40 + sectiondividerwidth: 0 + sectiondividerspacing: 10 + sectiondividertextcolor: "0xDDDDDDFF" + sectiondividerfont: + sectiondividerbitmapuri: "" + columnspacings: + rowspacings: + columnwidths: + rowheights: + numrenderpasses: 1 + fixedlayout: false + wrapdividerheight: 0 + wrapdividerwidth: 0 + wrapdividerbitmapuri: "" + focusfootprintblendcolor: "0xFFFFFFFF" + focusbitmapblendcolor: "0xFFFFFFFF" + focusfootprintbitmapuri: "" + focusbitmapuri: "" + currfocusfeedbackopacity: NaN + fadefocusfeedbackwhenautoscrolling: false + drawfocusfeedback: true + drawfocusfeedbackontop: false + vertfocusanimationstyle: "floatingFocus" + horizfocusanimationstyle: "floatingFocus" + focuscolumn: 0 + focusrow: 0 + numcolumns: 0 + numrows: 12 + itemspacing: + itemsize: + content: + rendertracking: "disabled" + enablerendertracking: false + muteaudioguide: false + renderpass: 0 + clippingrect: + inheritparentopacity: true + inheritparenttransform: true + childrenderorder: "renderLast" + scalerotatecenter: + scale: + rotation: 0 + translation: + opacity: 1 + visible: true change: focusable: false - focusedchild: invalid + focusedchild: id: "" - visible: true - opacity: 1 - translation: - rotation: 0 - scale: - scalerotatecenter: - childrenderorder: "renderLast" - inheritparenttransform: true - inheritparentopacity: true - clippingrect: - renderpass: 0 - muteaudioguide: false - enablerendertracking: false - rendertracking: "disabled" - content: invalid - itemsize: - itemspacing: - numrows: 12 - numcolumns: 0 - focusrow: 0 - focuscolumn: 0 - horizfocusanimationstyle: "floatingFocus" - vertfocusanimationstyle: "floatingFocus" - drawfocusfeedbackontop: false - drawfocusfeedback: true - fadefocusfeedbackwhenautoscrolling: false - currfocusfeedbackopacity: NaN - focusbitmapuri: "" - focusfootprintbitmapuri: "" - focusbitmapblendcolor: "0xFFFFFFFF" - focusfootprintblendcolor: "0xFFFFFFFF" - wrapdividerbitmapuri: "" - wrapdividerwidth: 0 - wrapdividerheight: 0 - fixedlayout: false - numrenderpasses: 1 - rowheights: - columnwidths: - rowspacings: - columnspacings: - sectiondividerbitmapuri: "" - sectiondividerfont: invalid - sectiondividertextcolor: "0xDDDDDDFF" - sectiondividerspacing: 10 - sectiondividerwidth: 0 - sectiondividerheight: 40 - sectiondividerminwidth: 117 - sectiondividerleftoffset: 0 - itemclippingrect: - itemselected: 0 - itemfocused: 0 - itemunfocused: 0 - jumptoitem: 0 - animatetoitem: 0 - currfocusrow: 0 - currfocuscolumn: 0 - currfocussection: 0 - itemcomponentname: "" - imagewellbitmapuri: "" }` ); }); diff --git a/test/brsTypes/nodes/MiniKeyboard.test.js b/test/brsTypes/nodes/MiniKeyboard.test.js index cae7a94a..62727750 100644 --- a/test/brsTypes/nodes/MiniKeyboard.test.js +++ b/test/brsTypes/nodes/MiniKeyboard.test.js @@ -9,32 +9,32 @@ describe("MiniKeyboard", () => { expect(miniKeyboard.toString()).toEqual( ` = { + lowercase: true + showtexteditbox: true + texteditbox: + focusbitmapuri: "" + keyboardbitmapuri: "" + focusedkeycolor: "0x000000FF" + keycolor: "0x000000FF" + text: "" + rendertracking: "disabled" + enablerendertracking: false + muteaudioguide: false + renderpass: 0 + clippingrect: + inheritparentopacity: true + inheritparenttransform: true + childrenderorder: "renderLast" + scalerotatecenter: + scale: + rotation: 0 + translation: + opacity: 1 + visible: true change: focusable: false - focusedchild: invalid + focusedchild: id: "" - visible: true - opacity: 1 - translation: - rotation: 0 - scale: - scalerotatecenter: - childrenderorder: "renderLast" - inheritparenttransform: true - inheritparentopacity: true - clippingrect: - renderpass: 0 - muteaudioguide: false - enablerendertracking: false - rendertracking: "disabled" - text: "" - keycolor: "0x000000FF" - focusedkeycolor: "0x000000FF" - keyboardbitmapuri: "" - focusbitmapuri: "" - texteditbox: - showtexteditbox: true - lowercase: true }` ); }); diff --git a/test/brsTypes/nodes/NodeFactory.test.js b/test/brsTypes/nodes/NodeFactory.test.js index c7f09276..056bc656 100644 --- a/test/brsTypes/nodes/NodeFactory.test.js +++ b/test/brsTypes/nodes/NodeFactory.test.js @@ -2,21 +2,21 @@ const brs = require("../../../lib"); const { NodeFactory, RoSGNode, Callable, ValueKind } = brs.types; describe("NodeFactory", () => { - describe("createComponent", () => { + describe("createNode", () => { it("returns a properly constructed built in Node with default name", () => { - const node = NodeFactory.createComponent("Rectangle"); + const node = NodeFactory.createNode("Rectangle"); expect(node.nodeSubtype).toBe("Rectangle"); expect(node.name).toBe("Rectangle"); expect(node.constructor.name).toBe("Rectangle"); }); it("returns a properly constructed built in Node with custom name", () => { - const node = NodeFactory.createComponent("Poster", "Foo"); + const node = NodeFactory.createNode("Poster", "Foo"); expect(node.nodeSubtype).toBe("Foo"); expect(node.constructor.name).toBe("Poster"); }); }); - describe("addComponentType", () => { + describe("addNodeTypes", () => { class Foo extends RoSGNode { constructor(initializedFields = [], name = "Foo") { super([], name); @@ -41,7 +41,7 @@ describe("NodeFactory", () => { } } - it("adds a new Component to be constructed", () => { + it("adds a new Node to be constructed", () => { NodeFactory.addNodeTypes([ [ "Foo", @@ -50,7 +50,7 @@ describe("NodeFactory", () => { }, ], ]); - const node = NodeFactory.createComponent("Foo"); + const node = NodeFactory.createNode("Foo"); expect(node.nodeSubtype).toBe("Foo"); expect(node.name).toBe("Foo"); expect(node.constructor.name).toBe("Foo"); diff --git a/test/brsTypes/nodes/Poster.test.js b/test/brsTypes/nodes/Poster.test.js index cef2a1af..2d3a4097 100644 --- a/test/brsTypes/nodes/Poster.test.js +++ b/test/brsTypes/nodes/Poster.test.js @@ -9,41 +9,41 @@ describe("Poster", () => { expect(group.toString()).toEqual( ` = { + audioguidetext: "" + failedbitmapopacity: 1 + failedbitmapuri: "" + loadingbitmapopacity: 1 + loadingbitmapuri: "" + blendcolor: "0xFFFFFFFF" + bitmapmargins: + bitmapheight: 0 + bitmapwidth: 0 + loadstatus: "noScale" + loaddisplaymode: "noScale" + loadheight: 0 + loadwidth: 0 + loadsync: false + height: 0 + width: 0 + uri: "" + rendertracking: "disabled" + enablerendertracking: false + muteaudioguide: false + renderpass: 0 + clippingrect: + inheritparentopacity: true + inheritparenttransform: true + childrenderorder: "renderLast" + scalerotatecenter: + scale: + rotation: 0 + translation: + opacity: 1 + visible: true change: focusable: false - focusedchild: invalid + focusedchild: id: "" - visible: true - opacity: 1 - translation: - rotation: 0 - scale: - scalerotatecenter: - childrenderorder: "renderLast" - inheritparenttransform: true - inheritparentopacity: true - clippingrect: - renderpass: 0 - muteaudioguide: false - enablerendertracking: false - rendertracking: "disabled" - uri: "" - width: 0 - height: 0 - loadsync: false - loadwidth: 0 - loadheight: 0 - loaddisplaymode: "noScale" - loadstatus: "noScale" - bitmapwidth: 0 - bitmapheight: 0 - bitmapmargins: - blendcolor: "0xFFFFFFFF" - loadingbitmapuri: "" - loadingbitmapopacity: 1 - failedbitmapuri: "" - failedbitmapopacity: 1 - audioguidetext: "" }` ); }); diff --git a/test/brsTypes/nodes/Rectangle.test.js b/test/brsTypes/nodes/Rectangle.test.js index c6bbea78..3439c8f2 100644 --- a/test/brsTypes/nodes/Rectangle.test.js +++ b/test/brsTypes/nodes/Rectangle.test.js @@ -9,28 +9,28 @@ describe("Rectangle", () => { expect(group.toString()).toEqual( ` = { + blendingenabled: true + color: "0xFFFFFFFF" + height: 0 + width: 0 + rendertracking: "disabled" + enablerendertracking: false + muteaudioguide: false + renderpass: 0 + clippingrect: + inheritparentopacity: true + inheritparenttransform: true + childrenderorder: "renderLast" + scalerotatecenter: + scale: + rotation: 0 + translation: + opacity: 1 + visible: true change: focusable: false - focusedchild: invalid + focusedchild: id: "" - visible: true - opacity: 1 - translation: - rotation: 0 - scale: - scalerotatecenter: - childrenderorder: "renderLast" - inheritparenttransform: true - inheritparentopacity: true - clippingrect: - renderpass: 0 - muteaudioguide: false - enablerendertracking: false - rendertracking: "disabled" - width: 0 - height: 0 - color: "0xFFFFFFFF" - blendingenabled: true }` ); }); diff --git a/test/brsTypes/nodes/Scene.test.js b/test/brsTypes/nodes/Scene.test.js index 0cc2698e..e09fe63e 100644 --- a/test/brsTypes/nodes/Scene.test.js +++ b/test/brsTypes/nodes/Scene.test.js @@ -9,29 +9,29 @@ describe("Scene", () => { expect(scene.toString()).toEqual( ` = { + currentdesignresolution: + dialog: + backexitsscene: true + backgroundcolor: "0x000000FF" + backgrounduri: "" + rendertracking: "disabled" + enablerendertracking: false + muteaudioguide: false + renderpass: 0 + clippingrect: + inheritparentopacity: true + inheritparenttransform: true + childrenderorder: "renderLast" + scalerotatecenter: + scale: + rotation: 0 + translation: + opacity: 1 + visible: true change: focusable: false - focusedchild: invalid + focusedchild: id: "" - visible: true - opacity: 1 - translation: - rotation: 0 - scale: - scalerotatecenter: - childrenderorder: "renderLast" - inheritparenttransform: true - inheritparentopacity: true - clippingrect: - renderpass: 0 - muteaudioguide: false - enablerendertracking: false - rendertracking: "disabled" - backgrounduri: "" - backgroundcolor: "0x000000FF" - backexitsscene: true - dialog: invalid - currentdesignresolution: }` ); }); diff --git a/test/brsTypes/nodes/TextEditBox.test.js b/test/brsTypes/nodes/TextEditBox.test.js index 051ba69d..38770c66 100644 --- a/test/brsTypes/nodes/TextEditBox.test.js +++ b/test/brsTypes/nodes/TextEditBox.test.js @@ -9,34 +9,34 @@ describe("TextEditBox", () => { expect(textEditBox.toString()).toEqual( ` = { + backgrounduri: "" + width: -1 + hinttextcolor: "OxFFFFFFFF" + textcolor: "OxFFFFFFFF" + active: false + clearondownkey: true + cursorposition: 0 + maxtextlength: 15 + hinttext: "" + text: "" + rendertracking: "disabled" + enablerendertracking: false + muteaudioguide: false + renderpass: 0 + clippingrect: + inheritparentopacity: true + inheritparenttransform: true + childrenderorder: "renderLast" + scalerotatecenter: + scale: + rotation: 0 + translation: + opacity: 1 + visible: true change: focusable: false - focusedchild: invalid + focusedchild: id: "" - visible: true - opacity: 1 - translation: - rotation: 0 - scale: - scalerotatecenter: - childrenderorder: "renderLast" - inheritparenttransform: true - inheritparentopacity: true - clippingrect: - renderpass: 0 - muteaudioguide: false - enablerendertracking: false - rendertracking: "disabled" - text: "" - hinttext: "" - maxtextlength: 15 - cursorposition: 0 - clearondownkey: true - active: false - textcolor: "OxFFFFFFFF" - hinttextcolor: "OxFFFFFFFF" - width: -1 - backgrounduri: "" }` ); }); diff --git a/test/brsTypes/nodes/Timer.test.js b/test/brsTypes/nodes/Timer.test.js index 5e8d7bea..b940bbd2 100644 --- a/test/brsTypes/nodes/Timer.test.js +++ b/test/brsTypes/nodes/Timer.test.js @@ -9,14 +9,14 @@ describe("Timer", () => { expect(timer.toString()).toEqual( ` = { + fire: + duration: 0 + repeat: false + control: "" change: focusable: false - focusedchild: invalid + focusedchild: id: "" - control: "" - repeat: false - duration: 0 - fire: }` ); }); diff --git a/test/e2e/BrsComponents.test.js b/test/e2e/BrsComponents.test.js index b07719c6..a3ec2ca5 100644 --- a/test/e2e/BrsComponents.test.js +++ b/test/e2e/BrsComponents.test.js @@ -665,7 +665,7 @@ describe("end to end brightscript functions", () => { "font node uri:", "", "font node size:", - " 1", + " 24", "font node fallbackGlyph:", "", "font as child size:", @@ -802,8 +802,8 @@ describe("end to end brightscript functions", () => { expect(allArgs(outputStreams.stdout.write).filter((arg) => arg !== "\n")).toEqual([ "bar", - "invalid", - "invalid", + "", + "", "Node", ]); }); diff --git a/test/interpreter/Call.test.js b/test/interpreter/Call.test.js index 0d5d85ba..658b5bce 100644 --- a/test/interpreter/Call.test.js +++ b/test/interpreter/Call.test.js @@ -3,7 +3,7 @@ const Stmt = require("../../lib/parser/Statement"); const { Interpreter } = require("../../lib/interpreter"); const brs = require("../../lib"); const { Lexeme } = brs.lexer; -const { BrsString, Int32, roInt, ValueKind, BrsInvalid, roInvalid } = brs.types; +const { BrsString, Int32, roInt, ValueKind, BrsInvalid, RoInvalid } = brs.types; const { token, identifier, fakeLocation } = require("../parser/ParserTests"); @@ -235,7 +235,7 @@ describe("interpreter calls", () => { interpreter.exec(ast); let result = interpreter.environment.get(identifier("result")); expect(result.kind).toEqual(ValueKind.Object); - expect(result.value).toEqual(new roInvalid().value); + expect(result.value).toEqual(new RoInvalid().value); }); it("errors when returning from a void return", () => { diff --git a/test/interpreter/Interpreter.test.js b/test/interpreter/Interpreter.test.js index 5ea765be..0274a47b 100644 --- a/test/interpreter/Interpreter.test.js +++ b/test/interpreter/Interpreter.test.js @@ -44,7 +44,8 @@ describe("integration tests", () => { }); let interpreter = await Interpreter.withSubEnvsFromComponents( componentMap, - LexerParser.getLexerParserFn(new Map(), defaultExecutionOptions) + new Map(), + defaultExecutionOptions ); let baseComp = interpreter.environment.nodeDefMap.get("basecomponent");