From 189c5b44a2c1be077a27bbf5535e4f042ea55a94 Mon Sep 17 00:00:00 2001 From: Sarah Wang <55766946+sarahsonder@users.noreply.github.com> Date: Fri, 31 May 2024 23:21:12 -0400 Subject: [PATCH] Change "class" attribute to "type" for objects (#39) --- CHANGELOG.md | 2 + README.md | 4 +- demo/src/__tests__/SvgDisplay.spec.tsx | 4 +- demo/src/sample/automated-layout/data.json | 4 +- demo/src/sample/blanks/data.json | 18 ++--- demo/src/sample/manual-layout/data.json | 6 +- demo/src/sample/simple/data.json | 4 +- demo/src/sample/styling/data.json | 10 +-- docs/docs/02-object_structure.md | 26 +++---- .../automation_demo/automation_demo.json | 4 +- .../more_specific_demos/demo_A.js | 4 +- .../blankspaces_demo/blankspaces_demo.js | 20 ++--- .../examples/manual_demo/manual_demo.json | 6 +- .../examples/simple_demo/simple_demo.js | 4 +- .../examples/style_demo/nostyle_demo.js | 10 +-- .../examples/style_demo/presets_demo.js | 8 +- .../99-api/examples/style_demo/style_demo.js | 10 +-- docs/src/pages/index.md | 4 +- memory-viz/README.md | 4 +- memory-viz/src/automate.ts | 6 +- memory-viz/src/memory_model.ts | 9 ++- memory-viz/src/style.ts | 4 +- memory-viz/src/tests/draw.spec.tsx | 78 +++++++++---------- 23 files changed, 127 insertions(+), 122 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ed3206b..8ca450d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### 🚨 Breaking changes +- Changed the `name` attribute to `type` when drawing objects. + ### ✨ Enhancements ### 🐛 Bug fixes diff --git a/README.md b/README.md index e4125b17..f13bf7b6 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,13 @@ const objects = [ stack_frame: true, }, { - name: "str", + type: "str", id: 19, value: "David is cool!", style: ["highlight"], }, { - name: "int", + type: "int", id: 13, value: 7, }, diff --git a/demo/src/__tests__/SvgDisplay.spec.tsx b/demo/src/__tests__/SvgDisplay.spec.tsx index 02db04f4..bbb8ebd0 100644 --- a/demo/src/__tests__/SvgDisplay.spec.tsx +++ b/demo/src/__tests__/SvgDisplay.spec.tsx @@ -36,13 +36,13 @@ describe("SvgDisplay", () => { stack_frame: true, }, { - name: "str", + type: "str", id: 19, value: "David is cool!", style: ["highlight"], }, { - name: "int", + type: "int", id: 13, value: 7, }, diff --git a/demo/src/sample/automated-layout/data.json b/demo/src/sample/automated-layout/data.json index 55133685..ea1efcbc 100644 --- a/demo/src/sample/automated-layout/data.json +++ b/demo/src/sample/automated-layout/data.json @@ -14,10 +14,10 @@ "stack_frame": true }, { - "name": "list", + "type": "list", "id": 84, "value": [32, 10, 90, 57], "show_indexes": true }, - { "name": "None", "id": 13, "value": "None" } + { "type": "None", "id": 13, "value": "None" } ] diff --git a/demo/src/sample/blanks/data.json b/demo/src/sample/blanks/data.json index 41752dab..4b8e1d0d 100644 --- a/demo/src/sample/blanks/data.json +++ b/demo/src/sample/blanks/data.json @@ -7,7 +7,7 @@ "stack_frame": true }, { - "name": "BLANK", + "type": "BLANK", "width": 100, "height": 200, "stack_frame": true @@ -20,43 +20,43 @@ "stack_frame": true }, { - "name": "list", + "type": "list", "id": 82, "value": [19, 43, 28, 49] }, { - "name": "list", + "type": "list", "id": 84, "value": [32, 10, 90, 57], "show_indexes": true }, { - "name": "int", + "type": "int", "id": 19, "value": 1969 }, { - "name": "BLANK", + "type": "BLANK", "width": 100, "height": 200 }, { - "name": "bool", + "type": "bool", "id": 32, "value": true }, { - "name": "str", + "type": "str", "id": 43, "value": "David is cool" }, { - "name": "BLANK", + "type": "BLANK", "width": 200, "height": 150 }, { - "name": "tuple", + "type": "tuple", "id": 11, "value": [82, 76] } diff --git a/demo/src/sample/manual-layout/data.json b/demo/src/sample/manual-layout/data.json index 04d513a9..9bd28849 100644 --- a/demo/src/sample/manual-layout/data.json +++ b/demo/src/sample/manual-layout/data.json @@ -11,21 +11,21 @@ { "x": 1050, "y": 500, - "name": "dict", + "type": "dict", "id": 10, "value": { "x": 81, "y": 100, "z": 121 } }, { "x": 1050, "y": 40, - "name": "tuple", + "type": "tuple", "id": 11, "value": [82, 76] }, { "x": 750, "y": 250, - "name": "bool", + "type": "bool", "id": 32, "value": true } diff --git a/demo/src/sample/simple/data.json b/demo/src/sample/simple/data.json index 1b008c6f..085b14be 100644 --- a/demo/src/sample/simple/data.json +++ b/demo/src/sample/simple/data.json @@ -7,13 +7,13 @@ "stack_frame": true }, { - "name": "str", + "type": "str", "id": 19, "value": "David is cool!", "style": ["highlight"] }, { - "name": "int", + "type": "int", "id": 13, "value": 7 } diff --git a/demo/src/sample/styling/data.json b/demo/src/sample/styling/data.json index ae9674a2..0839e29a 100644 --- a/demo/src/sample/styling/data.json +++ b/demo/src/sample/styling/data.json @@ -12,7 +12,7 @@ { "x": 350, "y": 350, - "name": "list", + "type": "list", "id": 54, "value": [19, 43, 28, 49], "style": { @@ -22,7 +22,7 @@ { "x": 750, "y": 500, - "name": "str", + "type": "str", "id": 43, "value": "David is cool", "style": "highlight" @@ -30,14 +30,14 @@ { "x": 1050, "y": 260, - "name": "set", + "type": "set", "id": 90, "value": [36, 49, 64] }, { "x": 1050, "y": 500, - "name": "dict", + "type": "dict", "id": 10, "value": { "x": 81, "y": 100, "z": 121 }, "style": { "text_id": { "font-style": "italic" } } @@ -45,7 +45,7 @@ { "x": 750, "y": 750, - "name": "None", + "type": "None", "id": 13, "value": "None", "style": { diff --git a/docs/docs/02-object_structure.md b/docs/docs/02-object_structure.md index 8ed7f374..7fd3c8e0 100644 --- a/docs/docs/02-object_structure.md +++ b/docs/docs/02-object_structure.md @@ -12,8 +12,8 @@ must contain the following attributes: - `isClass` - `boolean`: denotes whether the object to be drawn is a user-defined class (or a stack frame) or a built-in object. This has a default value of `false` and should be manually set to `true` only when drawing a class or stack frame. -- `name` - `string`: denotes the type of the object to draw (if `isClass===true`, then this is the name of the - corresponding class or stack frame). +- `name` - `string`: The name of the class or stack frame to be drawn. Note that this attribute is only applicable if the object's `isClass` attribute is true. Otherwise, this attribute can be excluded from the input. +- `type` - `string`: The type of the object to be drawn. If no objects are being drawn, this attribute can be excluded from the input. - If the user wants to hardcode the coordinates (implying the `automation` parameter of `draw` is false), each object must include `x` and `y` attributes (for x-y coordinates). - `id` - `string`|`number`: denotes the id value of this object. If we are to draw a stack frame, then this MUST be `null`. @@ -56,27 +56,27 @@ must contain the following attributes: "stack_frame": true } -{"name": "BLANK", "width": 100, "height": 200, "stack_frame" : true} +{"type": "BLANK", "width": 100, "height": 200, "stack_frame" : true} -{"name": "list", "id": 82, "value": [19, 43, 28, 49]} +{"type": "list", "id": 82, "value": [19, 43, 28, 49]} -{"name": "list", "id": 84, "value": [32, 10, 90, 57], "show_indexes": true} +{"type": "list", "id": 84, "value": [32, 10, 90, 57], "show_indexes": true} -{"name": "int", "id": 19, "value": 1969} +{"type": "int", "id": 19, "value": 1969} -{"name": "bool", "id": 32, "value": true} +{"type": "bool", "id": 32, "value": true} -{"name": "BLANK", "width": 200, "height": 100} +{"type": "BLANK", "width": 200, "height": 100} -{"name": "str", "id": 43, "value": "David is cool"} +{"type": "str", "id": 43, "value": "David is cool"} -{"name": "tuple", "id": 11, "value": [82, 76]} +{"type": "tuple", "id": 11, "value": [82, 76]} -{"name": "set", "id": 90, "value": [36, 49, 64]} +{"type": "set", "id": 90, "value": [36, 49, 64]} -{"name": "dict", "id": 10, "value": {"x": 81, "y": 100, "z": 121}} +{"type": "dict", "id": 10, "value": {"x": 81, "y": 100, "z": 121}} -{"name": "None", "id": 13, "value": "None", +{"type": "None", "id": 13, "value": "None", "style": { "text_value" : {"font-style": "italic"}, "box_id": {"fill": "red", "fillStyle": "dots"}, diff --git a/docs/docs/99-api/examples/automation_demo/automation_demo.json b/docs/docs/99-api/examples/automation_demo/automation_demo.json index 55133685..ea1efcbc 100644 --- a/docs/docs/99-api/examples/automation_demo/automation_demo.json +++ b/docs/docs/99-api/examples/automation_demo/automation_demo.json @@ -14,10 +14,10 @@ "stack_frame": true }, { - "name": "list", + "type": "list", "id": 84, "value": [32, 10, 90, 57], "show_indexes": true }, - { "name": "None", "id": 13, "value": "None" } + { "type": "None", "id": 13, "value": "None" } ] diff --git a/docs/docs/99-api/examples/automation_demo/more_specific_demos/demo_A.js b/docs/docs/99-api/examples/automation_demo/more_specific_demos/demo_A.js index 8e506214..20467e56 100644 --- a/docs/docs/99-api/examples/automation_demo/more_specific_demos/demo_A.js +++ b/docs/docs/99-api/examples/automation_demo/more_specific_demos/demo_A.js @@ -20,8 +20,8 @@ const listOfObjs = [ value: { age: 12, name: 17 }, stack_frame: false, }, - { name: "list", id: 82, value: [19, 43, 28, 49] }, - { name: "int", id: 19, value: 1969 }, + { type: "list", id: 82, value: [19, 43, 28, 49] }, + { type: "int", id: 19, value: 1969 }, ]; const { objs, canvas_height, canvas_width } = drawAutomatedOtherItems( diff --git a/docs/docs/99-api/examples/blankspaces_demo/blankspaces_demo.js b/docs/docs/99-api/examples/blankspaces_demo/blankspaces_demo.js index 15191897..bc822d16 100644 --- a/docs/docs/99-api/examples/blankspaces_demo/blankspaces_demo.js +++ b/docs/docs/99-api/examples/blankspaces_demo/blankspaces_demo.js @@ -2,7 +2,7 @@ * This file demonstrates the ability to leave "blanks" when the 'automated.md' option is on. * * To define a blank box, you specify it as an object in the array (the classic array of objects) with three attributes: - * - name: This must be equal to "BLANK" + * - type: This must be equal to "BLANK" * - width: the desired width of the blank box (I say box but in reality there aren't any borders) * - height: the desired height of the blank box * @@ -27,7 +27,7 @@ const listOfObjs = [ value: { lst1: 82, lst2: 84, p: 99, d: 10, t: 11 }, stack_frame: true, }, - { name: "BLANK", width: 100, height: 200, stack_frame: true }, + { type: "BLANK", width: 100, height: 200, stack_frame: true }, { isClass: true, name: "func", @@ -35,19 +35,19 @@ const listOfObjs = [ value: { age: 12, name: 17 }, stack_frame: true, }, - { name: "list", id: 82, value: [19, 43, 28, 49] }, + { type: "list", id: 82, value: [19, 43, 28, 49] }, { - name: "list", + type: "list", id: 84, value: [32, 10, 90, 57], show_indexes: true, }, - { name: "int", id: 19, value: 1969 }, - { name: "BLANK", width: 100, height: 200 }, - { name: "bool", id: 32, value: true }, - { name: "str", id: 43, value: "David is cool" }, - { name: "BLANK", width: 200, height: 150 }, - { name: "tuple", id: 11, value: [82, 76] }, + { type: "int", id: 19, value: 1969 }, + { type: "BLANK", width: 100, height: 200 }, + { type: "bool", id: 32, value: true }, + { type: "str", id: 43, value: "David is cool" }, + { type: "BLANK", width: 200, height: 150 }, + { type: "tuple", id: 11, value: [82, 76] }, ]; const configuration = { diff --git a/docs/docs/99-api/examples/manual_demo/manual_demo.json b/docs/docs/99-api/examples/manual_demo/manual_demo.json index 04d513a9..9bd28849 100644 --- a/docs/docs/99-api/examples/manual_demo/manual_demo.json +++ b/docs/docs/99-api/examples/manual_demo/manual_demo.json @@ -11,21 +11,21 @@ { "x": 1050, "y": 500, - "name": "dict", + "type": "dict", "id": 10, "value": { "x": 81, "y": 100, "z": 121 } }, { "x": 1050, "y": 40, - "name": "tuple", + "type": "tuple", "id": 11, "value": [82, 76] }, { "x": 750, "y": 250, - "name": "bool", + "type": "bool", "id": 32, "value": true } diff --git a/docs/docs/99-api/examples/simple_demo/simple_demo.js b/docs/docs/99-api/examples/simple_demo/simple_demo.js index 68c68a45..cb982fff 100644 --- a/docs/docs/99-api/examples/simple_demo/simple_demo.js +++ b/docs/docs/99-api/examples/simple_demo/simple_demo.js @@ -16,12 +16,12 @@ const objects = [ stack_frame: true, }, { - name: "str", + type: "str", id: 19, value: "David is cool!", style: ["highlight"], }, - { name: "int", id: 13, value: 7 }, + { type: "int", id: 13, value: 7 }, ]; const m = draw(objects, true, { width: 1300 }); diff --git a/docs/docs/99-api/examples/style_demo/nostyle_demo.js b/docs/docs/99-api/examples/style_demo/nostyle_demo.js index c16393eb..3b793bee 100644 --- a/docs/docs/99-api/examples/style_demo/nostyle_demo.js +++ b/docs/docs/99-api/examples/style_demo/nostyle_demo.js @@ -32,32 +32,32 @@ const objs = [ { x: 350, y: 350, - name: "list", + type: "list", id: 54, value: [19, 43, 28, 49], }, { x: 750, y: 500, - name: "str", + type: "str", id: 43, value: "David is cool", }, { x: 1050, y: 260, - name: "set", + type: "set", id: 90, value: [36, 49, 64], }, { x: 1050, y: 500, - name: "dict", + type: "dict", id: 10, value: { x: 81, y: 100, z: 121 }, }, - { x: 750, y: 750, name: "None", id: 13, value: "None" }, + { x: 750, y: 750, type: "None", id: 13, value: "None" }, ]; const m = draw(objs, true, configuration); diff --git a/docs/docs/99-api/examples/style_demo/presets_demo.js b/docs/docs/99-api/examples/style_demo/presets_demo.js index fd10925f..01b0ded5 100644 --- a/docs/docs/99-api/examples/style_demo/presets_demo.js +++ b/docs/docs/99-api/examples/style_demo/presets_demo.js @@ -33,7 +33,7 @@ const objs = [ { x: 350, y: 350, - name: "list", + type: "list", id: 54, value: [19, 43, 28, 49], style: ["hide_type"], @@ -42,7 +42,7 @@ const objs = [ { x: 750, y: 500, - name: "str", + type: "str", id: 43, value: "David is cool", style: ["highlight", "hide_type"], @@ -51,7 +51,7 @@ const objs = [ { x: 1050, y: 40, - name: "tuple", + type: "tuple", id: 11, value: [82, 76], style: ["highlight"], @@ -60,7 +60,7 @@ const objs = [ { x: 1050, y: 260, - name: "set", + type: "set", id: 90, value: [36, 49, 64], style: ["fade"], diff --git a/docs/docs/99-api/examples/style_demo/style_demo.js b/docs/docs/99-api/examples/style_demo/style_demo.js index ed25d82d..ee58bddd 100644 --- a/docs/docs/99-api/examples/style_demo/style_demo.js +++ b/docs/docs/99-api/examples/style_demo/style_demo.js @@ -40,7 +40,7 @@ const objs = [ { x: 350, y: 350, - name: "list", + type: "list", id: 54, value: [19, 43, 28, 49], style: { text_id: { "font-style": "italic", "font-size": "x-large" } }, @@ -48,7 +48,7 @@ const objs = [ { x: 750, y: 500, - name: "str", + type: "str", id: 43, value: "David is cool", style: "highlight", @@ -56,14 +56,14 @@ const objs = [ { x: 1050, y: 260, - name: "set", + type: "set", id: 90, value: [36, 49, 64], }, { x: 1050, y: 500, - name: "dict", + type: "dict", id: 10, value: { x: 81, y: 100, z: 121 }, style: { text_id: { "font-style": "italic" } }, @@ -71,7 +71,7 @@ const objs = [ { x: 750, y: 750, - name: "None", + type: "None", id: 13, value: "None", style: { diff --git a/docs/src/pages/index.md b/docs/src/pages/index.md index afbf26a7..96f43644 100644 --- a/docs/src/pages/index.md +++ b/docs/src/pages/index.md @@ -35,12 +35,12 @@ const objects = [ stack_frame: true, }, { - name: "str", + type: "str", id: 19, value: "David is cool!", style: ["highlight"], }, - { name: "int", id: 13, value: 7 }, + { type: "int", id: 13, value: 7 }, ]; const m = draw(objects, true, { width: 1300 }); diff --git a/memory-viz/README.md b/memory-viz/README.md index 6f34b6fb..f8c43e6f 100644 --- a/memory-viz/README.md +++ b/memory-viz/README.md @@ -30,13 +30,13 @@ const objects = [ stack_frame: true, }, { - name: "str", + type: "str", id: 19, value: "David is cool!", style: ["highlight"], }, { - name: "int", + type: "int", id: 13, value: 7, }, diff --git a/memory-viz/src/automate.ts b/memory-viz/src/automate.ts index 4b285f64..6f42b770 100644 --- a/memory-viz/src/automate.ts +++ b/memory-viz/src/automate.ts @@ -149,7 +149,7 @@ function drawAutomatedOtherItems( const START_X = sf_endpoint + PADDING; for (const item of objs) { - if (item.name !== "BLANK") { + if (item.type !== "BLANK") { const dimensions = getSize(item); item.height = dimensions.height; item.width = dimensions.width; @@ -232,7 +232,7 @@ function drawAutomatedOtherItems( // Additional -- to extend the program for the BLANK option. const objs_filtered = objs.filter((item) => { - return item.name !== "BLANK"; + return item.type !== "BLANK"; }); objs = objs_filtered; @@ -254,7 +254,7 @@ function separateObjects(objects) { for (const item of objects) { if ( - item.name === "BLANK" && + item.type === "BLANK" && (item.width === undefined || item.height === undefined) ) { console.log( diff --git a/memory-viz/src/memory_model.ts b/memory-viz/src/memory_model.ts index 50879a8c..5b21fc51 100644 --- a/memory-viz/src/memory_model.ts +++ b/memory-viz/src/memory_model.ts @@ -765,8 +765,11 @@ export class MemoryModel { * be manually set to true only when drawing a class or stack-frame. * @param {number} objects[*].x - Value for x coordinate of top left corner * @param {number} objects[*].y - Value for y coordinate of top left corner - * @param {string} objects[*].name - The type of the object to draw (if isClass===true, then this is the name of the - * corresponding class or stackframe). + * @param {string} objects[*].name - The name of the class or stack frame to be drawn. Note that this attribute is only + * applicable if the object's 'isClass' attribute is true. If no classes or stack frames + * are being drawn, this attribute can be excluded from the input. + * @param {string} objects[*].type - The type of the object to be drawn. If no objects are being drawn, this attribute + * can be excluded from the input. * @param {number} objects[*].id - The id value of this object. If we are to draw a StackFrame, then this MUST be 'null'. * @param {*} objects[*].value - The value of the object. This could be anything, from an empty string to a JS object, * which would be passed for the purpose of drawing a user-defined class object, a @@ -829,7 +832,7 @@ export class MemoryModel { const size = this.drawObject( obj.x, obj.y, - obj.name, + obj.type, obj.id, obj.value, obj.show_indexes, diff --git a/memory-viz/src/style.ts b/memory-viz/src/style.ts index 407409dc..84734741 100644 --- a/memory-viz/src/style.ts +++ b/memory-viz/src/style.ts @@ -68,9 +68,9 @@ function populateStyleObject(object, seed) { let object_type; - if (primitives.includes(object.name)) { + if (primitives.includes(object.type)) { object_type = "primitive"; - } else if (collections.includes(object.name)) { + } else if (collections.includes(object.type)) { object_type = "collection"; } else if (object.stack_frame) { object_type = "stackframe"; diff --git a/memory-viz/src/tests/draw.spec.tsx b/memory-viz/src/tests/draw.spec.tsx index bd7200a3..63a43f15 100644 --- a/memory-viz/src/tests/draw.spec.tsx +++ b/memory-viz/src/tests/draw.spec.tsx @@ -12,12 +12,12 @@ describe("draw function", () => { stack_frame: true, }, { - name: "str", + type: "str", id: 19, value: "David is cool!", style: ["highlight"], }, - { name: "int", id: 13, value: 7 }, + { type: "int", id: 13, value: 7 }, ]; const m: InstanceType = draw(objects, true, { width: 1300, @@ -28,7 +28,7 @@ describe("draw function", () => { }); it("renders a bool", () => { - const objects: Array = [{ name: "bool", id: 32, value: true }]; + const objects: Array = [{ type: "bool", id: 32, value: true }]; const m: InstanceType = draw(objects, true, { width: 1300, seed: 12345, @@ -38,7 +38,7 @@ describe("draw function", () => { }); it("renders an int", () => { - const objects: Array = [{ name: "int", id: 32, value: 7 }]; + const objects: Array = [{ type: "int", id: 32, value: 7 }]; const m: InstanceType = draw(objects, true, { width: 1300, seed: 12345, @@ -48,7 +48,7 @@ describe("draw function", () => { }); it("renders a float", () => { - const objects: Array = [{ name: "float", id: 32, value: 7.0 }]; + const objects: Array = [{ type: "float", id: 32, value: 7.0 }]; const m: InstanceType = draw(objects, true, { width: 1300, seed: 12345, @@ -59,7 +59,7 @@ describe("draw function", () => { it("renders a str", () => { const objects: Array = [ - { name: "str", id: 32, value: "winter" }, + { type: "str", id: 32, value: "winter" }, ]; const m: InstanceType = draw(objects, true, { width: 1300, @@ -71,7 +71,7 @@ describe("draw function", () => { it("renders a set", () => { const objects: Array = [ - { name: "set", id: 32, value: [10, 11, 12] }, + { type: "set", id: 32, value: [10, 11, 12] }, ]; const m: InstanceType = draw(objects, true, { width: 1300, @@ -82,7 +82,7 @@ describe("draw function", () => { }); it("renders an empty set", () => { - const objects: Array = [{ name: "set", id: 32, value: [] }]; + const objects: Array = [{ type: "set", id: 32, value: [] }]; const m: InstanceType = draw(objects, true, { width: 1300, seed: 12345, @@ -94,7 +94,7 @@ describe("draw function", () => { it("renders a list with indexes showing", () => { const objects: Array = [ { - name: "list", + type: "list", id: 32, value: [10, 11, 12], show_indexes: true, @@ -110,7 +110,7 @@ describe("draw function", () => { it("renders a list without indexes showing", () => { const objects: Array = [ - { name: "list", id: 32, value: [10, 11, 12] }, + { type: "list", id: 32, value: [10, 11, 12] }, ]; const m: InstanceType = draw(objects, true, { width: 1300, @@ -121,7 +121,7 @@ describe("draw function", () => { }); it("renders an empty list", () => { - const objects: Array = [{ name: "list", id: 32, value: [] }]; + const objects: Array = [{ type: "list", id: 32, value: [] }]; const m: InstanceType = draw(objects, true, { width: 1300, seed: 12345, @@ -133,7 +133,7 @@ describe("draw function", () => { it("renders a tuple with indexes showing", () => { const objects: Array = [ { - name: "tuple", + type: "tuple", id: 32, value: [10, 11, 12], show_indexes: true, @@ -149,7 +149,7 @@ describe("draw function", () => { it("renders a tuple without indexes showing", () => { const objects: Array = [ - { name: "tuple", id: 32, value: [10, 11, 12] }, + { type: "tuple", id: 32, value: [10, 11, 12] }, ]; const m: InstanceType = draw(objects, true, { width: 1300, @@ -160,7 +160,7 @@ describe("draw function", () => { }); it("renders an empty tuple", () => { - const objects: Array = [{ name: "tuple", id: 32, value: [] }]; + const objects: Array = [{ type: "tuple", id: 32, value: [] }]; const m: InstanceType = draw(objects, true, { width: 1300, seed: 12345, @@ -172,7 +172,7 @@ describe("draw function", () => { it("renders a dict", () => { const objects: Array = [ { - name: "dict", + type: "dict", id: 10, value: { x: 81, y: 100, z: 121 }, }, @@ -186,7 +186,7 @@ describe("draw function", () => { }); it("renders an empty dict", () => { - const objects: Array = [{ name: "dict", id: 32, value: {} }]; + const objects: Array = [{ type: "dict", id: 32, value: {} }]; const m: InstanceType = draw(objects, true, { width: 1300, seed: 12345, @@ -197,7 +197,7 @@ describe("draw function", () => { it("renders an object with no type and no value", () => { const objects: Array = [ - { name: "None", id: 13, value: "None" }, + { type: "None", id: 13, value: "None" }, ]; const m: InstanceType = draw(objects, true, { width: 1300, @@ -209,7 +209,7 @@ describe("draw function", () => { it("renders a blank space", () => { const objects: Array = [ - { name: "BLANK", width: 100, height: 200 }, + { type: "BLANK", width: 100, height: 200 }, ]; const m: InstanceType = draw(objects, true, { width: 1300, @@ -231,7 +231,7 @@ describe("draw function", () => { stack_frame: true, }, { - name: "int", + type: "int", id: 13, value: 7, }, @@ -271,7 +271,7 @@ describe("draw function", () => { { x: 750, y: 250, - name: "bool", + type: "bool", id: 32, value: true, }, @@ -286,17 +286,17 @@ describe("draw function", () => { it("renders blank spaces in automatic layout", () => { const objects: Array = [ { - name: "int", + type: "int", id: 98, value: 42, }, { - name: "BLANK", + type: "BLANK", width: 100, height: 200, }, { - name: "str", + type: "str", id: 99, value: "life", }, @@ -312,7 +312,7 @@ describe("draw function", () => { it("formats non-stack frame objects in automatic layout", () => { const objects: Array = [ { - name: "int", + type: "int", id: 98, value: 42, }, @@ -325,12 +325,12 @@ describe("draw function", () => { }, }, { - name: "list", + type: "list", id: 54, value: [19, 42, 22, 63], }, { - name: "str", + type: "str", id: 12, value: "banana", }, @@ -365,13 +365,13 @@ describe("draw function", () => { stack_frame: true, }, { - name: "list", + type: "list", id: 84, value: [17, 8], show_indexes: true, }, { - name: "None", + type: "None", id: 10, value: "None", }, @@ -387,7 +387,7 @@ describe("draw function", () => { it("renders custom style (without presets)", () => { const objects: Array = [ { - name: "str", + type: "str", id: 19, value: "David is cool!", style: { @@ -421,7 +421,7 @@ describe("draw function", () => { style: ["highlight"], }, { - name: "str", + type: "str", id: 42, value: "highlight!", style: ["highlight"], @@ -448,7 +448,7 @@ describe("draw function", () => { style: ["highlight_id"], }, { - name: "str", + type: "str", id: 42, value: "highlight id!", style: ["highlight_id"], @@ -475,7 +475,7 @@ describe("draw function", () => { style: ["highlight_type"], }, { - name: "str", + type: "str", id: 42, value: "highlight type!", style: ["highlight_type"], @@ -502,7 +502,7 @@ describe("draw function", () => { style: ["hide"], }, { - name: "str", + type: "str", id: 42, value: "hide!", style: ["hide"], @@ -529,7 +529,7 @@ describe("draw function", () => { style: ["hide_id"], }, { - name: "str", + type: "str", id: 42, value: "hide id!", style: ["hide_id"], @@ -556,7 +556,7 @@ describe("draw function", () => { style: ["hide_container"], }, { - name: "str", + type: "str", id: 42, value: "hide container!", style: ["hide_container"], @@ -583,7 +583,7 @@ describe("draw function", () => { style: ["fade"], }, { - name: "str", + type: "str", id: 42, value: "fade!", style: ["fade"], @@ -610,7 +610,7 @@ describe("draw function", () => { style: ["fade_type"], }, { - name: "str", + type: "str", id: 42, value: "fade_type!", style: ["fade_type"], @@ -637,7 +637,7 @@ describe("draw function", () => { style: ["fade_id"], }, { - name: "str", + type: "str", id: 42, value: "fade id!", style: ["fade_id"], @@ -663,7 +663,7 @@ describe("draw function", () => { style: ["highlight", "fade", "hide_id"], }, { - name: "str", + type: "str", id: 42, value: "combination!", style: ["hide_id", "highlight_type"],