diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2014-12-29 13:39:51 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2014-12-29 13:39:51 +0200 |
commit | 181b598714e979ad26236a3677f9e825f74ca282 (patch) | |
tree | cc178f0c3e5e971f2d7e071ea46f88d6aea0cdbe /uitest | |
parent | 0d93598759d2a1a95a25cc84e75cfa03f154590e (diff) | |
parent | b89213ee880dd1197bc7696f6f5a1919c0ff02c1 (diff) | |
download | vaadin-framework-181b598714e979ad26236a3677f9e825f74ca282.tar.gz vaadin-framework-181b598714e979ad26236a3677f9e825f74ca282.zip |
Merge remote-tracking branch 'origin/master' into grid
Change-Id: Id00b3893951bc669fcc8e234f09909d480e249ab
Diffstat (limited to 'uitest')
9 files changed, 190 insertions, 210 deletions
diff --git a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java index f00a05e810..871111ad8b 100644 --- a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java +++ b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java @@ -48,7 +48,6 @@ import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.ssl.SslSocketConnector; -import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.util.Scanner; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.webapp.WebAppContext; @@ -257,7 +256,6 @@ public class DevelopmentServerLauncher { webappcontext.stop(); server.stop(); webappcontext.start(); - disableAtmosphereAnnotationScan(webappcontext); server.start(); } }); @@ -278,8 +276,6 @@ public class DevelopmentServerLauncher { // Read web.xml to find all configured servlets webappcontext.start(); - disableAtmosphereAnnotationScan(webappcontext); - try { server.start(); @@ -351,19 +347,6 @@ public class DevelopmentServerLauncher { return "http://localhost:" + port + serverArgs.get("context"); } - private static void disableAtmosphereAnnotationScan( - WebAppContext webappcontext) { - // Reconfigure all servlets to avoid startup delay - for (ServletHolder servletHolder : webappcontext.getServletHandler() - .getServlets()) { - if (servletHolder - .getInitParameter("org.atmosphere.cpr.scanClassPath") == null) { - servletHolder.setInitParameter( - "org.atmosphere.cpr.scanClassPath", "false"); - } - } - } - /** * Assign default value for given key. * diff --git a/uitest/src/com/vaadin/tests/actions/ActionsWithoutKeyCode.java b/uitest/src/com/vaadin/tests/actions/ActionsWithoutKeyCode.java new file mode 100644 index 0000000000..e94a4b1ade --- /dev/null +++ b/uitest/src/com/vaadin/tests/actions/ActionsWithoutKeyCode.java @@ -0,0 +1,39 @@ +package com.vaadin.tests.actions; + +import com.vaadin.event.Action; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.TextField; + +@SuppressWarnings("serial") +public class ActionsWithoutKeyCode extends AbstractTestUIWithLog { + + @Override + protected void setup(VaadinRequest request) { + TextField tf = new TextField(); + tf.setWidth("100%"); + tf.setInputPrompt("Enter text with å,ä or ä or press windows key while textfield is focused"); + addComponent(tf); + + addActionHandler(new Action.Handler() { + + private Action[] actions; + { + actions = new Action[] { new Action("test1") }; + } + + @Override + public Action[] getActions(Object target, Object sender) { + return actions; + } + + @Override + public void handleAction(Action action, Object sender, Object target) { + log("action " + action.getCaption() + " triggered by " + + sender.getClass().getSimpleName() + " on " + + target.getClass().getSimpleName()); + } + }); + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.java b/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.java index 4bdec81ccf..64f1a64558 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.java +++ b/uitest/src/com/vaadin/tests/components/table/TableClickAndDragOnIconAndComponents.java @@ -38,7 +38,7 @@ public class TableClickAndDragOnIconAndComponents extends AbstractTestUI { table.setId("testable-table"); addComponent(table); for (int i = 0; i < 5; i++) { - addItemAfter(i + "foo", null, false); + addItemAfter(i + "foo", null); } table.addGeneratedColumn("Label", new ColumnGenerator() { @@ -118,15 +118,14 @@ public class TableClickAndDragOnIconAndComponents extends AbstractTestUI { IndexedContainer container = (IndexedContainer) table .getContainerDataSource(); - boolean selected = table.getValue().equals(dragged); container.removeItem(dragged); - addItemAfter(dragged, target, selected); + addItemAfter(dragged, target); } }); } @SuppressWarnings("unchecked") - private void addItemAfter(Object itemId, Object afterItemId, boolean select) { + private void addItemAfter(Object itemId, Object afterItemId) { Item item; if (afterItemId != null) { item = table.addItemAfter(afterItemId, itemId); @@ -137,9 +136,6 @@ public class TableClickAndDragOnIconAndComponents extends AbstractTestUI { item.getItemProperty("red").setValue("red " + itemId); item.getItemProperty("icon").setValue( new ThemeResource("../runo/icons/16/ok.png")); - if (select) { - table.select(itemId); - } } @Override diff --git a/uitest/src/com/vaadin/tests/components/table/TableDeleteSelectedRow.java b/uitest/src/com/vaadin/tests/components/table/TableDeleteSelectedRow.java deleted file mode 100644 index 349fbc73fe..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/TableDeleteSelectedRow.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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.table; - -import java.util.Collection; - -import com.vaadin.data.util.BeanItemContainer; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.MultiSelectMode; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Label; -import com.vaadin.ui.Table; - -/** - * Test UI for delete rows operation in multiselect table. - * - * @author Vaadin Ltd - */ -public class TableDeleteSelectedRow extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - final Table table = new Table(); - table.setSelectable(true); - table.setImmediate(true); - - BeanItemContainer<TableBean> container = createContainer(); - - table.setContainerDataSource(container); - - final Label selectedSize = new Label(); - selectedSize.addStyleName("selected-rows"); - - Button changeMode = new Button("Set multiselect", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - table.setMultiSelect(true); - table.setMultiSelectMode(MultiSelectMode.SIMPLE); - - BeanItemContainer<TableBean> container = createContainer(); - - table.setContainerDataSource(container); - } - }); - changeMode.addStyleName("multiselect"); - - Button delete = new Button("Delete selected", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - if (table.getValue() instanceof Collection) { - Collection<?> rows = (Collection<?>) table.getValue(); - for (Object row : rows) { - table.getContainerDataSource().removeItem(row); - } - rows = (Collection<?>) table.getValue(); - selectedSize.setValue(String.valueOf(rows.size())); - } else { - table.getContainerDataSource().removeItem(table.getValue()); - selectedSize.setValue(table.getValue() == null ? "0" : "1"); - } - } - }); - delete.addStyleName("delete"); - - addComponents(delete, changeMode, selectedSize, table); - } - - @Override - protected String getTestDescription() { - return "Items deleted via container data source should not be available as selected in the table."; - } - - @Override - protected Integer getTicketNumber() { - return 13580; - } - - private BeanItemContainer<TableBean> createContainer() { - BeanItemContainer<TableBean> container = new BeanItemContainer<TableBean>( - TableBean.class); - container.addBean(new TableBean("first")); - container.addBean(new TableBean("second")); - container.addBean(new TableBean("third")); - return container; - } - - public static class TableBean { - - TableBean(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - private String name; - } -} diff --git a/uitest/src/com/vaadin/tests/components/table/TableDeleteSelectedRowTest.java b/uitest/src/com/vaadin/tests/components/table/TableDeleteSelectedRowTest.java deleted file mode 100644 index 0e807edf14..0000000000 --- a/uitest/src/com/vaadin/tests/components/table/TableDeleteSelectedRowTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.table; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; - -import com.vaadin.tests.tb3.MultiBrowserTest; - -/** - * Test to check selected rows in multiselect table after deletion. - * - * @author Vaadin Ltd - */ -public class TableDeleteSelectedRowTest extends MultiBrowserTest { - - @Test - public void deleteSelectedRows() { - openTestURL(); - - // Select row in the table - findElement(By.className("v-table-row-odd")).click(); - - // Delete selected row - findElement(By.className("delete")).click(); - - WebElement selectedSize = findElement(By.className("selected-rows")); - int size = Integer.parseInt(selectedSize.getText()); - - Assert.assertEquals( - "Non empty collection of selected rows after remove via container", - 0, size); - - // Reset table and set multiselect mode - findElement(By.className("multiselect")).click(); - - // Select row in the table - findElement(By.className("v-table-row-odd")).click(); - - // Delete selected row - findElement(By.className("delete")).click(); - - selectedSize = findElement(By.className("selected-rows")); - size = Integer.parseInt(selectedSize.getText()); - - Assert.assertEquals( - "Non empty collection of selected rows after remove via container", - 0, size); - } -} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/HtmlInTabCaption.java b/uitest/src/com/vaadin/tests/components/tabsheet/HtmlInTabCaption.java new file mode 100644 index 0000000000..66a27a10b5 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tabsheet/HtmlInTabCaption.java @@ -0,0 +1,72 @@ +/* + * 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.tabsheet; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Accordion; +import com.vaadin.ui.Label; +import com.vaadin.ui.TabSheet; + +public class HtmlInTabCaption extends AbstractTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + getLayout().setSpacing(true); + TabSheet ts = new TabSheet(); + ts.setCaption("TabSheet - no <u>html</u> in tab captions"); + ts.setCaptionAsHtml(true); + ts.addTab(new Label(), "<font color='red'>red</font>"); + ts.addTab(new Label(), "<font color='blue'>blue</font>"); + addComponent(ts); + + ts = new TabSheet(); + ts.setCaption("TabSheet - <b>html</b> in tab captions"); + ts.setCaptionAsHtml(false); + ts.setTabCaptionsAsHtml(true); + ts.addTab(new Label(), "<font color='red'>red</font>"); + ts.addTab(new Label(), "<font color='blue'>blue</font>"); + addComponent(ts); + + Accordion acc = new Accordion(); + acc.setCaption("Accordion - no <u>html</u> in tab captions"); + acc.setCaptionAsHtml(true); + acc.addTab(new Label(), "<font color='red'>red</font>"); + acc.addTab(new Label(), "<font color='blue'>blue</font>"); + addComponent(acc); + + acc = new Accordion(); + acc.setCaption("Accordion - <b>html</b> in tab captions"); + acc.setCaptionAsHtml(false); + acc.setTabCaptionsAsHtml(true); + acc.addTab(new Label(), "<font color='red'>red</font>"); + acc.addTab(new Label(), "<font color='blue'>blue</font>"); + addComponent(acc); + + } + + @Override + protected Integer getTicketNumber() { + return 14609; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/HtmlInTabCaptionTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/HtmlInTabCaptionTest.java new file mode 100644 index 0000000000..41b7037b09 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tabsheet/HtmlInTabCaptionTest.java @@ -0,0 +1,73 @@ +/* + * 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.tabsheet; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.AccordionElement; +import com.vaadin.testbench.elements.TabSheetElement; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class HtmlInTabCaptionTest extends SingleBrowserTest { + static final String PLAIN_TEXT_RED = "<font color='red'>red</font>"; + static final String HTML_TEXT_RED = "red"; + static final String PLAIN_TEXT_BLUE = "<font color='blue'>blue</font>"; + static final String HTML_TEXT_BLUE = "blue"; + + @Test + public void tabsheetWithoutHtmlCaptions() { + openTestURL(); + TabSheetElement ts = $(TabSheetElement.class).get(0); + Assert.assertEquals(PLAIN_TEXT_RED, getTab(ts, 0).getText()); + Assert.assertEquals(PLAIN_TEXT_BLUE, getTab(ts, 1).getText()); + } + + private WebElement getTab(TabSheetElement tabSheetElement, int i) { + String className = "v-tabsheet-tabitem"; + if (tabSheetElement instanceof AccordionElement) { + className = "v-accordion-item"; + } + return tabSheetElement.findElements(By.className(className)).get(i); + } + + @Test + public void tabsheetWithHtmlCaptions() { + openTestURL(); + TabSheetElement ts = $(TabSheetElement.class).get(1); + Assert.assertEquals(HTML_TEXT_RED, getTab(ts, 0).getText()); + Assert.assertEquals(HTML_TEXT_BLUE, getTab(ts, 1).getText()); + } + + @Test + public void accordionWithoutHtmlCaptions() { + openTestURL(); + AccordionElement acc = $(AccordionElement.class).get(0); + Assert.assertEquals(PLAIN_TEXT_RED, getTab(acc, 0).getText()); + Assert.assertEquals(PLAIN_TEXT_BLUE, getTab(acc, 1).getText()); + + } + + @Test + public void accordionWithHtmlCaptions() { + openTestURL(); + AccordionElement acc = $(AccordionElement.class).get(1); + Assert.assertEquals(HTML_TEXT_RED, getTab(acc, 0).getText()); + Assert.assertEquals(HTML_TEXT_BLUE, getTab(acc, 1).getText()); + } +} diff --git a/uitest/src/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java b/uitest/src/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java index f66d822495..6caa8f3e26 100644 --- a/uitest/src/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java +++ b/uitest/src/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java @@ -31,8 +31,8 @@ public class FormWithNestedProperties extends AbstractBeanFieldGroupTest { super.setup(); setFieldBinder(new BeanFieldGroup<Person>(Person.class)); - country = getFieldBinder().buildAndBind("country", "address.country", - NativeSelect.class); + country = (NativeSelect) getFieldBinder().buildAndBind("country", + "address.country", NativeSelect.class); getFieldBinder().bindMemberFields(this); addComponent(firstName); addComponent(lastName); diff --git a/uitest/tb2/com/vaadin/tests/components/tabsheet/TabSheetBasicOperations.html b/uitest/tb2/com/vaadin/tests/components/tabsheet/TabSheetBasicOperations.html index 357455545e..f0f08efb58 100644 --- a/uitest/tb2/com/vaadin/tests/components/tabsheet/TabSheetBasicOperations.html +++ b/uitest/tb2/com/vaadin/tests/components/tabsheet/TabSheetBasicOperations.html @@ -300,7 +300,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetTest::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td> - <td>11. Tab 0 selected</td> + <td>11. Tab 2 selected</td> </tr> <!--select tab 1--> <tr> @@ -324,7 +324,6 @@ <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetTest::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td> <td>13. Tab 2 selected</td> </tr> - </tbody></table> </body> </html> |