mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Attempt to fix tests (reimplement get_children)
This commit is contained in:
parent
0d8abd884d
commit
3ce99b2c6e
2 changed files with 10 additions and 1 deletions
|
|
@ -279,6 +279,14 @@ local function create_source_node<T>(value: T): SourceNode<T>
|
|||
return { cache = value, children = {} }
|
||||
end
|
||||
|
||||
local function get_children_as_array<T>(node: Node<T>): { Node<unknown> }
|
||||
local arr = {}
|
||||
for child, _ in node.children do
|
||||
table.insert(arr, child)
|
||||
end
|
||||
return arr
|
||||
end
|
||||
|
||||
local function set_context<T>(node: Node<T>, key: number, value: unknown)
|
||||
if node.context then
|
||||
node.context[key] = value
|
||||
|
|
@ -301,6 +309,7 @@ return table.freeze {
|
|||
push_child = push_child,
|
||||
create_node = create_node,
|
||||
create_source_node = create_source_node,
|
||||
get_children_as_array = get_children_as_array,
|
||||
flush_update_queue = flush_update_queue,
|
||||
get_update_queue_length = get_update_queue_length,
|
||||
set_context = set_context,
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ TEST("graph", function()
|
|||
local get_scope = graph.get_scope
|
||||
local push_scope = graph.push_scope
|
||||
local pop_scope = graph.pop_scope
|
||||
local get_children = graph.get_children
|
||||
local get_children = graph.get_children_as_array
|
||||
local push_cleanup = graph.push_cleanup
|
||||
local destroy = graph.destroy
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue