From 44f2a899649cc98301925fa9130089d596339505 Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Tue, 2 Jan 2024 12:15:27 +0200 Subject: [PATCH] Added test case for #26 --- .../tinymce/UpdateValueOnDetachedEditor.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/test/java/org/vaadin/tinymce/UpdateValueOnDetachedEditor.java diff --git a/src/test/java/org/vaadin/tinymce/UpdateValueOnDetachedEditor.java b/src/test/java/org/vaadin/tinymce/UpdateValueOnDetachedEditor.java new file mode 100644 index 0000000..758807b --- /dev/null +++ b/src/test/java/org/vaadin/tinymce/UpdateValueOnDetachedEditor.java @@ -0,0 +1,25 @@ +package org.vaadin.tinymce; + +import com.vaadin.flow.component.button.Button; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.Route; + +import java.time.LocalDateTime; + +@Route +public class UpdateValueOnDetachedEditor extends VerticalLayout { + public UpdateValueOnDetachedEditor() { + + TinyMce tinyMce = new TinyMce(); + + Button b = new Button("Replace value while detached"); + b.addClickListener(e -> { + tinyMce.removeFromParent(); + tinyMce.setValue("Now: " + LocalDateTime.now()); + add(tinyMce); + }); + + add(b, tinyMce); + + } +}