diff options
author | Tomi Virkki <virkki@vaadin.com> | 2014-04-09 07:24:20 +0300 |
---|---|---|
committer | Tomi Virkki <virkki@vaadin.com> | 2014-06-21 13:11:53 +0300 |
commit | 6e109e4d73b7e3c09da3000a813904b52ea89991 (patch) | |
tree | 6e6c67082e4719a3f16e1de6aaf05934cf59e1d9 /uitest | |
parent | 2da9b502f0b76020ca6bd094e5d53c77d1acd9fb (diff) | |
download | vaadin-framework-6e109e4d73b7e3c09da3000a813904b52ea89991.tar.gz vaadin-framework-6e109e4d73b7e3c09da3000a813904b52ea89991.zip |
Update RichTextArea editor height on resize (#11320)
Change-Id: I4d4d054c2e4f068aacd9b324350be4ee696cf3d3
Diffstat (limited to 'uitest')
2 files changed, 113 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResize.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResize.java new file mode 100644 index 0000000000..870c6cb8cb --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResize.java @@ -0,0 +1,58 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.richtextarea; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.RichTextArea; +import com.vaadin.ui.VerticalLayout; + +public class RichTextAreaRelativeHeightResize extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final VerticalLayout layout = new VerticalLayout(); + layout.setSizeFull(); + layout.setHeight("300px"); + + RichTextArea richTextArea = new RichTextArea(); + richTextArea.setSizeFull(); + layout.addComponent(richTextArea); + + addComponent(layout); + addComponent(new Button("Increase height", new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + layout.setHeight("400px"); + } + })); + + } + + @Override + protected String getTestDescription() { + return "Tests that a RichTextArea with dynamic height " + + "updates its editor elements height on resize"; + } + + @Override + protected Integer getTicketNumber() { + return 11320; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResizeTest.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResizeTest.java new file mode 100644 index 0000000000..5c31ce4dc7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaRelativeHeightResizeTest.java @@ -0,0 +1,55 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.richtextarea; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class RichTextAreaRelativeHeightResizeTest extends MultiBrowserTest { + + @Test + public void testCenteredClosingAndPostLayout() { + openTestURL(); + + int originalHeight = driver + .findElement(By.cssSelector(".v-richtextarea")).getSize() + .getHeight(); + int originalEditorHeight = driver + .findElement(By.cssSelector(".v-richtextarea iframe")) + .getSize().getHeight(); + + // Increase the component height + driver.findElement(By.cssSelector(".v-button")).click(); + + int newHeight = driver.findElement(By.cssSelector(".v-richtextarea")) + .getSize().getHeight(); + int newEditorHeight = driver + .findElement(By.cssSelector(".v-richtextarea iframe")) + .getSize().getHeight(); + + // Check that the component height changed and that the editor height + // changed equally as much + Assert.assertTrue("RichTextArea height didn't change", + newHeight != originalHeight); + Assert.assertEquals( + "Editor height change didn't match the Component height change", + newHeight - originalHeight, newEditorHeight + - originalEditorHeight); + } +} |