Skip to content

Commit

Permalink
Make table default visualisation (#10128)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdRiley authored May 31, 2024
1 parent 500e398 commit af4177e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ import project.Table as Table_Visualization
from project.Text import get_lazy_visualization_text_window

## PRIVATE
Specifies that the builtin JSON visualization should be used for any type,
Specifies that the builtin Table visualization should be used for any type,
unless specified otherwise.
Any.default_visualization self = Id.json
Any.default_visualization self = Id.table

## PRIVATE
Specifies that the builtin JSON visualization should be used for any JS_Objects
JS_Object.default_visualization self = Id.json

## PRIVATE
Returns a Text used to display this value in the IDE.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2027,7 +2027,7 @@ class RuntimeVisualizationsTest extends AnyFlatSpec with Matchers {
data
}

new String(data) shouldEqual "(Builtin 'JSON')"
new String(data) shouldEqual "(Builtin 'Table')"

val loadedLibraries = attachVisualizationResponses
.collect {
Expand Down
11 changes: 7 additions & 4 deletions test/Visualization_Tests/src/Id_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ add_specs suite_builder = suite_builder.group "Serializable Visualization Identi
v_1.to_json.should_equal (expected "enso_dev.Visualization_Tests" "My Vis")
v_2.to_json.should_equal (expected "Standard.Base" "Other Vis")

group_builder.specify "specifies default JSON visualization for any type" <|
My_Type.Value 30 . default_visualization . should_equal Visualization.Id.json
"foobar".default_visualization.should_equal Visualization.Id.json
True.default_visualization.should_equal Visualization.Id.json
group_builder.specify "specifies default Table visualization for any type" <|
My_Type.Value 30 . default_visualization . should_equal Visualization.Id.table
"foobar".default_visualization.should_equal Visualization.Id.table
True.default_visualization.should_equal Visualization.Id.table

group_builder.specify "specifies default json visualization JS_Object type" <|
(Json.parse '{"name":"John","age":25,"email":"john@example.com"}') . default_visualization . should_equal Visualization.Id.json

group_builder.specify "specifies default Table visualization for Vector and Array type" <|
[1,2,3].default_visualization.should_equal Visualization.Id.table
Expand Down

0 comments on commit af4177e

Please sign in to comment.