From e1c3713e1e10e2c9f21a2238b85249023a8d8b49 Mon Sep 17 00:00:00 2001 From: Michael Ruoss Date: Thu, 5 Sep 2024 06:09:01 +0200 Subject: [PATCH] Add Kino.Test.push_smart_cell_editor_source/2 to test editor changes (#468) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jonatan KÅ‚osko --- lib/kino/test.ex | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/kino/test.ex b/lib/kino/test.ex index 5ea65e8e..c4df05c3 100644 --- a/lib/kino/test.ex +++ b/lib/kino/test.ex @@ -185,4 +185,19 @@ defmodule Kino.Test do unquote(timeout) end end + + @doc """ + Sends a changed smart cell editor source to a `Kino.JS.Live` kino. + + This is going to call `c:Kino.SmartCell.handle_editor_change/2` implementation + in the smart cell module. + + ## Examples + + push_smart_cell_editor_source(kino, "source code") + + """ + def push_smart_cell_editor_source(kino, source) do + send(kino.pid, {:editor_source, source}) + end end