Bonsai_web_test.Handleinclude module type of struct include Bonsai_test.Handle endval show : ?simulate_diff_patch:('result -> unit) -> ('result, _) t -> unitshow runs recompute_view, then prints the result of the computation as specified by the Result_spec that was passed into Handle.create.
simulate_diff_patch runs between recomputing the view and triggering lifecycles.
val show_into_string :
?simulate_diff_patch:('result -> unit) ->
('result, _) t ->
stringshow_into_string is the same as show, except it returns the view of the component as a string instead of printing it.
simulate_diff_patch runs between recomputing the view and triggering lifecycles.
val show_diff :
?location_style:Patdiff_kernel.Format.Location_style.t ->
?diff_context:int ->
?simulate_diff_patch:('result -> unit) ->
('result, _) t ->
unitshow_diff will print the diff of the view between now and the last time that show or show_diff was called.
diff_context can be used to adjust the number of unchanged lines before and after the diffed content. Defaults to 16.
simulate_diff_patch runs between recomputing the view and triggering lifecycles.
val recompute_view :
?simulate_diff_patch:('result -> unit) ->
('result, _) t ->
unitrecompute_view simulates running one frame of a Bonsai app. In particular, it will
The resulting view will not be printed, or stored for show_diff. If you want to print the resulting view, use show instead.
simulate_diff_patch runs between recomputing the view and triggering lifecycles.
val recompute_view_until_stable :
?max_computes:int ->
?simulate_diff_patch:('result -> unit) ->
('result, _) t ->
unitThis function calls recompute_view until either max_computes is reached (defaults to 100), or there are no more after-display lifecycle events for processing.
This can be useful when using e.g. Bonsai.Edge.on_change, which might otherwise delay their effects until the next frame.
simulate_diff_patch runs between recomputing the view and triggering lifecycles.
val store_view : (_, _) t -> unitstore_view is like show except that instead of printing the view to stdout, it only stores the current view for use with show_diff. This can be useful if you want to print the diff of "before->after" without being required to print the entirety of "before".
val last_result : ('result, _) t -> 'resultval do_actions : (_, 'incoming) t -> 'incoming list -> unitval time_source : (_, _) t -> Bonsai.Time_source.tval advance_clock_by : (_, _) t -> Core.Time_ns.Span.t -> unitval advance_clock : to_:Core.Time_ns.t -> (_, _) t -> unitval show_model : (_, _) t -> unitval lifecycle_incr : (_, _) t -> Ui_incr.Packed.tval action_input_incr : (_, _) t -> Ui_incr.Packed.tval has_after_display_events : ('result, 'incoming) t -> boolval print_actions : (_, _) t -> unitval print_stabilizations : (_, _) t -> unitval print_stabilization_tracker_stats : (_, _) t -> unitval print_computation_structure : (_, _) t -> unitval create :
(module Bonsai_web_test__.Proc.Result_spec.S
with type incoming = 'b
and type t = 'a) ->
?rpc_implementations:
Async_rpc_kernel.Rpc.Connection.t Async_rpc_kernel.Rpc.Implementation.t
list ->
?connectors:
(Bonsai_web.Rpc_effect.Where_to_connect.t ->
Bonsai_web.Rpc_effect.Connector.t) ->
?start_time:Core.Time_ns.t ->
?optimize:bool ->
(Bonsai_web.Bonsai.graph @ local -> 'a Bonsai_web.Bonsai.t) ->
('a, 'b) tval flush_async_and_bonsai :
?max_iterations:int ->
?silence_between_frames:bool ->
('a, 'b) t ->
unit Async_kernel.Deferred.tRuns [recompute_view] and [Async_kernel_scheduler.yield_until_no_jobs_remain]
in a loop until nothing remains to be done. This is a good sledgehammer
function to use if you want to wait until all the effects of a user-action
have completed.
By default, this function prints "------ between bonsai frame ------" in between
each iteration to demonstrate when side-effects occur, and how long it took for a
stable state to be reached. This line is just extra documentation; it is not
necessarily a sign that something is wrong (unless, of course, the behavior of the
thing you're trying to test shouldn't result in an extra frame). These lines can be
removed by passing [~silence_between_frames:true] in case your tests take a
non-deterministic number of iterations to stabilize.
[max_iterations] controls how many loop iterations are allowed before the
function aborts with an exception, in case the default of 100 is too low.
However, you should rarely, if ever need this parameter.val lint_vdom :
?min_severity:Virtual_dom_test_helpers.Node_helpers.Linter.Severity.t ->
?expected_failures:Virtual_dom_test_helpers.Node_helpers.Linter.Rule.t list ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
unitmin_severity defaults to High.
val click_on :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
?shift_key_down:bool ->
?alt_key_down:bool ->
?ctrl_key_down:bool ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
unitval mousedown :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
?shift_key_down:bool ->
?alt_key_down:bool ->
?ctrl_key_down:bool ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
unitval submit_form :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
unitval set_checkbox :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
?shift_key_down:bool ->
?alt_key_down:bool ->
?ctrl_key_down:bool ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
checked:bool ->
unitval input_text :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
text:string ->
unitval input_files :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
files:Js_of_ocaml.File.file Js_of_ocaml.Js.t list ->
unitval keydown :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
?shift_key_down:bool ->
?alt_key_down:bool ->
?ctrl_key_down:bool ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
key:Js_of_ocaml.Dom_html.Keyboard_code.t ->
unitval global_keydown :
?shift_key_down:bool ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
key:Js_of_ocaml.Dom_html.Keyboard_code.t ->
selector:string ->
unitNotably, global_keydown must be given a selector for the node where the global listener attr was attached, because Bonsai_web_test does not simulate event propagation.
val change :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
value:string ->
unitval focus :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
unitval blur :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
?related_target:string ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
unitval mousemove :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
unitval mouseenter :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
unitval wheel :
?extra_event_fields:(string * Js_of_ocaml.Js.Unsafe.any) list ->
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
delta_y:float ->
unitval trigger_hook :
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
name:string ->
('c -> unit Bonsai_web.Vdom.Effect.t) Core.Type_equal.Id.t ->
'c ->
unitval trigger_hook_via :
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
name:string ->
't Core.Type_equal.Id.t ->
f:('t -> 'c -> unit Bonsai_web.Vdom.Effect.t) ->
'c ->
unitval get_hook_value :
('a, 'b) t ->
get_vdom:('a -> Bonsai_web.Vdom.Node.t) ->
selector:string ->
name:string ->
'c Core.Type_equal.Id.t ->
'c