From 35f353274f2132086f8ee0bb6e6e73712a59b173 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Tue, 28 May 2013 12:39:20 +0300 Subject: Fixes current text being overwritten in server update on RTA #11741 If the server happens to update the state of the RTA while a user is typing then the users text will be replaced by the value on the server. To fix this the RTA should not update if the value is the same as the one cached on the client side. Also moves blur handling and server<->client syncronization to the connector. Change-Id: Ia807b1e2aa210eb881e4b9cea0870c0c5a9254b2 --- .../RichTextAreaUpdateWhileTyping.html | 42 ++++++++++++++++++ .../RichTextAreaUpdateWhileTyping.java | 51 ++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.html create mode 100644 uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.java (limited to 'uitest/src') diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.html b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.html new file mode 100644 index 0000000000..6ddd1b4097 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.html @@ -0,0 +1,42 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.richtextarea.RichTextAreaUpdateWhileTyping?restartApplication
selectFramexpath=//div[@id='rta']/iframe
type//bodyThis text should be visible, even after an update while I type.
pause2000
assertText//bodyThis text should be visible, even after an update while I type.
+ + diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.java new file mode 100644 index 0000000000..df1d6df463 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.java @@ -0,0 +1,51 @@ +package com.vaadin.tests.components.richtextarea; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.progressindicator.ProgressIndicatorServerRpc; +import com.vaadin.tests.components.AbstractComponentTest; +import com.vaadin.tests.components.AbstractTestCase; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.ProgressIndicator; +import com.vaadin.ui.RichTextArea; + +public class RichTextAreaUpdateWhileTyping extends AbstractTestUI { + + private RichTextArea rta; + + @Override + protected void setup(VaadinRequest request) { + + // Progress indicator for changing the value of the RTA + ProgressIndicator pi = new ProgressIndicator() { + { + registerRpc(new ProgressIndicatorServerRpc() { + + @Override + public void poll() { + rta.markAsDirty(); + } + }); + } + }; + pi.setHeight("0px"); + addComponent(pi); + + rta = new RichTextArea(); + rta.setId("rta"); + rta.setImmediate(true); + addComponent(rta); + } + + @Override + protected String getTestDescription() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Integer getTicketNumber() { + return 11741; + } +} -- cgit v1.2.3