summaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2014-03-13 08:56:31 +0200
committerDenis Anisimov <denis@vaadin.com>2014-04-30 12:58:06 +0000
commitc98286e22c32b56a75b21d629c8b5968856d1ae1 (patch)
treea22601f58aeb495c8a091602bda84023de4679c2 /uitest/src
parent16bcacd5eb5d56491b4fb4777bab950880b644f3 (diff)
downloadvaadin-framework-c98286e22c32b56a75b21d629c8b5968856d1ae1.tar.gz
vaadin-framework-c98286e22c32b56a75b21d629c8b5968856d1ae1.zip
Set explicit left alignment instead of removing text-align style (#13399).
Change-Id: I3407555739ff443055e2e61aa14327d44a65cd8e
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/com/vaadin/tests/components/table/LeftColumnAlignment.java90
-rw-r--r--uitest/src/com/vaadin/tests/components/table/LeftColumnAlignmentTest.java58
2 files changed, 148 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignment.java b/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignment.java
new file mode 100644
index 0000000000..e783951d86
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignment.java
@@ -0,0 +1,90 @@
+/*
+ * 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 com.vaadin.annotations.Theme;
+import com.vaadin.data.util.BeanItemContainer;
+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.Button.ClickListener;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.Align;
+
+/**
+ * Test UI for issue #13399 : Left alignment should not be set explicitly
+ * instead of relying on default behavior
+ *
+ * @author Vaadin Ltd
+ */
+@Theme("tests-table")
+public class LeftColumnAlignment extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Table table = new Table();
+
+ BeanItemContainer<Bean> container = new BeanItemContainer<Bean>(
+ Bean.class);
+ Bean bean = new Bean();
+ bean.setName("property");
+ container.addBean(bean);
+ table.setContainerDataSource(container);
+
+ table.setFooterVisible(true);
+
+ table.setWidth(100, Unit.PIXELS);
+
+ table.setColumnAlignment("name", Align.RIGHT);
+
+ addComponent(table);
+
+ Button button = new Button("Align to Left");
+ button.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ table.setColumnAlignment("name", Align.LEFT);
+ }
+ });
+ addComponent(button);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Left alignment should not be set explicitly instead of relying on default behavior";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 13399;
+ }
+
+ public static class Bean {
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignmentTest.java b/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignmentTest.java
new file mode 100644
index 0000000000..3d613fd726
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/LeftColumnAlignmentTest.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.table;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Test class for issue #13399 : Left alignment should not be set explicitly
+ * instead of relying on default behavior
+ *
+ * @author Vaadin Ltd
+ */
+public class LeftColumnAlignmentTest extends MultiBrowserTest {
+
+ @Test
+ public void testLeftColumnAlignment() throws Exception {
+ openTestURL();
+
+ // Do align columns to the left
+ WebElement webElement = driver.findElement(By.className("v-button"));
+ webElement.click();
+
+ Assert.assertTrue("Table caption is not aligned to the left",
+ isElementPresent(By
+ .className("v-table-caption-container-align-left")));
+
+ WebElement footer = driver.findElement(By
+ .className("v-table-footer-container"));
+
+ Assert.assertEquals("Table footer is not aligned to the left", "left",
+ footer.getCssValue("text-align"));
+
+ WebElement cell = driver.findElement(By
+ .className("v-table-cell-wrapper"));
+
+ Assert.assertEquals("Table cell is not aligned to the left", "left",
+ cell.getCssValue("text-align"));
+ }
+
+}