summaryrefslogtreecommitdiffstats
path: root/server/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/src')
-rw-r--r--server/tests/src/com/vaadin/tests/layoutparser/all-components.html31
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestSynchronizeFromDesign.java5
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/tabsheet/TestSynchronizeFromDesign.java137
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/tabsheet/TestSynchronizeToDesign.java109
4 files changed, 281 insertions, 1 deletions
diff --git a/server/tests/src/com/vaadin/tests/layoutparser/all-components.html b/server/tests/src/com/vaadin/tests/layoutparser/all-components.html
index f633b06cb3..3fdae56e76 100644
--- a/server/tests/src/com/vaadin/tests/layoutparser/all-components.html
+++ b/server/tests/src/com/vaadin/tests/layoutparser/all-components.html
@@ -47,6 +47,37 @@
<!-- text area -->
<v-text-area rows=5 wordwrap=false >test value</v-text-area>
+ <!-- tabsheet -->
+ <v-tab-sheet tabindex=5>
+ <tab visible=false closable caption="My first tab">
+ <v-vertical-layout>
+ <v-text-field/>
+ </v-vertical-layout>
+ </tab>
+ <tab enabled=false caption="Disabled second tab">
+ <v-button>In disabled tab - can’t be shown by default</v-button>
+ </tab>
+ <tab icon="theme://../runo/icons/16/ok.png" icon-alt="Ok png from Runo - very helpful" description="Click to show a text field" style-name="red" id="uniqueDomId">
+ <v-text-field input-prompt="Icon only in tab" />
+ </tab>
+ </v-tab-sheet>
+
+ <!-- accordion -->
+ <v-accordion tabindex=5>
+ <tab visible=false closable caption="My first tab">
+ <v-vertical-layout>
+ <v-text-field/>
+ </v-vertical-layout>
+ </tab>
+ <tab enabled=false caption="Disabled second tab">
+ <v-button>In disabled tab - can’t be shown by default</v-button>
+ </tab>
+ <tab icon="theme://../runo/icons/16/ok.png" icon-alt="Ok png from Runo - very helpful" description="Click to show a text field" style-name="red" id="uniqueDomId">
+ <v-text-field input-prompt="Icon only in tab" />
+ </tab>
+ </v-accordion>
+
+
</v-vertical-layout>
</body>
</html> \ No newline at end of file
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestSynchronizeFromDesign.java b/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestSynchronizeFromDesign.java
index 5153d92706..df6fb47bf2 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestSynchronizeFromDesign.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestSynchronizeFromDesign.java
@@ -81,6 +81,8 @@ public class TestSynchronizeFromDesign extends TestCase {
component.synchronizeFromDesign(design, ctx);
assertTrue("Incorrect resource type returned", component.getIcon()
.getClass().isAssignableFrom(ExternalResource.class));
+ assertEquals("http://example.com/example.gif",
+ ((ExternalResource) component.getIcon()).getURL());
}
public void testSynchronizeThemeIcon() {
@@ -115,7 +117,8 @@ public class TestSynchronizeFromDesign extends TestCase {
component.synchronizeFromDesign(design, ctx);
assertEquals(false, component.isImmediate());
assertEquals(Boolean.FALSE, getExplicitImmediate(component));
- // Synchronize with a design having immediate = "" - should correspond to
+ // Synchronize with a design having immediate = "" - should correspond
+ // to
// true.
design = createDesign("immediate", "");
component.synchronizeFromDesign(design, ctx);
diff --git a/server/tests/src/com/vaadin/tests/server/component/tabsheet/TestSynchronizeFromDesign.java b/server/tests/src/com/vaadin/tests/server/component/tabsheet/TestSynchronizeFromDesign.java
new file mode 100644
index 0000000000..4c0a2863f0
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/tabsheet/TestSynchronizeFromDesign.java
@@ -0,0 +1,137 @@
+/*
+ * 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.server.component.tabsheet;
+
+import junit.framework.TestCase;
+
+import org.jsoup.nodes.Attributes;
+import org.jsoup.nodes.Element;
+import org.jsoup.parser.Tag;
+
+import com.vaadin.server.ExternalResource;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TabSheet.Tab;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.declarative.DesignContext;
+
+/**
+ * Test case from reading TabSheet from design
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TestSynchronizeFromDesign extends TestCase {
+
+ private TabSheet sheet;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ sheet = createTabSheet();
+ }
+
+ public void testChildCount() {
+ assertEquals(1, sheet.getComponentCount());
+ }
+
+ public void testTabIndex() {
+ assertEquals(5, sheet.getTabIndex());
+ }
+
+ public void testTabAttributes() {
+ Tab tab = sheet.getTab(0);
+ assertEquals("test-caption", tab.getCaption());
+ assertEquals(false, tab.isVisible());
+ assertEquals(false, tab.isClosable());
+ assertEquals(false, tab.isEnabled());
+ assertEquals("http://www.vaadin.com/test.png",
+ ((ExternalResource) tab.getIcon()).getURL());
+ assertEquals("OK", tab.getIconAlternateText());
+ assertEquals("test-desc", tab.getDescription());
+ assertEquals("test-style", tab.getStyleName());
+ assertEquals("test-id", tab.getId());
+ }
+
+ public void testSelectedComponent() {
+ TabSheet tabSheet = new TabSheet();
+ tabSheet.synchronizeFromDesign(createFirstTabSelectedDesign(),
+ new DesignContext());
+ assertEquals(tabSheet.getTab(0).getComponent(),
+ tabSheet.getSelectedTab());
+ }
+
+ public void testTabContent() {
+ assertTrue("The child for the tabsheet should be textfield", sheet
+ .getTab(0).getComponent() instanceof TextField);
+ }
+
+ private TabSheet createTabSheet() {
+ TabSheet tabSheet = new TabSheet();
+ // add some tabs that should be cleared on sync
+ tabSheet.addComponent(new Label("tab1"));
+ tabSheet.addComponent(new Label("tab2"));
+ DesignContext ctx = new DesignContext();
+ Element design = createDesign();
+ tabSheet.synchronizeFromDesign(design, ctx);
+ return tabSheet;
+ }
+
+ private Element createDesign() {
+ // create root design
+ Attributes rootAttributes = new Attributes();
+ rootAttributes.put("tabindex", "5");
+ Element node = new Element(Tag.valueOf("v-tab-sheet"), "",
+ rootAttributes);
+ // create tab design
+ Attributes tabAttributes = new Attributes();
+ tabAttributes.put("caption", "test-caption");
+ tabAttributes.put("visible", "false");
+ tabAttributes.put("closable", "false");
+ tabAttributes.put("enabled", "false");
+ tabAttributes.put("icon", "http://www.vaadin.com/test.png");
+ tabAttributes.put("icon-alt", "OK");
+ tabAttributes.put("description", "test-desc");
+ tabAttributes.put("style-name", "test-style");
+ tabAttributes.put("id", "test-id");
+ Element tab = new Element(Tag.valueOf("tab"), "", tabAttributes);
+ // add child component to tab
+ tab.appendChild(new Element(Tag.valueOf("v-text-field"), "",
+ new Attributes()));
+ // add tab to root design
+ node.appendChild(tab);
+ return node;
+ }
+
+ private Element createFirstTabSelectedDesign() {
+ // create root design
+ Attributes rootAttributes = new Attributes();
+ Element node = new Element(Tag.valueOf("v-tab-sheet"), "",
+ rootAttributes);
+ // create tab design
+ Attributes tabAttributes = new Attributes();
+ tabAttributes.put("selected", "");
+ tabAttributes.put("caption", "test-caption");
+ Element tab = new Element(Tag.valueOf("tab"), "", tabAttributes);
+ // add child component to tab
+ tab.appendChild(new Element(Tag.valueOf("v-text-field"), "",
+ new Attributes()));
+ // add tab to root design
+ node.appendChild(tab);
+ return node;
+
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/tabsheet/TestSynchronizeToDesign.java b/server/tests/src/com/vaadin/tests/server/component/tabsheet/TestSynchronizeToDesign.java
new file mode 100644
index 0000000000..c33a1da4d7
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/tabsheet/TestSynchronizeToDesign.java
@@ -0,0 +1,109 @@
+/*
+ * 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.server.component.tabsheet;
+
+import junit.framework.TestCase;
+
+import org.jsoup.nodes.Attributes;
+import org.jsoup.nodes.Element;
+import org.jsoup.parser.Tag;
+
+import com.vaadin.server.ExternalResource;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TabSheet.Tab;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.declarative.DesignContext;
+
+/**
+ * Test case for writing TabSheet to design
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class TestSynchronizeToDesign extends TestCase {
+
+ private TabSheet sheet;
+ private Element design;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ sheet = createTabSheet();
+ design = createDesign();
+ sheet.synchronizeToDesign(design, createDesignContext());
+ }
+
+ public void testOnlyOneTab() {
+ assertEquals("There should be only one child", 1, design.children()
+ .size());
+ }
+
+ public void testAttributes() {
+ Element tabDesign = design.child(0);
+ assertEquals("5", design.attr("tabindex"));
+ assertEquals("test-caption", tabDesign.attr("caption"));
+ assertEquals("false", tabDesign.attr("visible"));
+ assertTrue(tabDesign.hasAttr("closable"));
+ assertTrue(tabDesign.attr("closable").equals("true")
+ || tabDesign.attr("closable").equals(""));
+ assertEquals("false", tabDesign.attr("enabled"));
+ assertEquals("http://www.vaadin.com/test.png", tabDesign.attr("icon"));
+ assertEquals("OK", tabDesign.attr("icon-alt"));
+ assertEquals("test-desc", tabDesign.attr("description"));
+ assertEquals("test-style", tabDesign.attr("style-name"));
+ assertEquals("test-id", tabDesign.attr("id"));
+ }
+
+ public void testContent() {
+ Element tabDesign = design.child(0);
+ Element content = tabDesign.child(0);
+ assertEquals("Tab must have only one child", 1, tabDesign.children()
+ .size());
+ assertEquals("v-text-field", content.tagName());
+ }
+
+ private Element createDesign() {
+ // make sure that the design node has old content that should be removed
+ Element node = new Element(Tag.valueOf("v-tab-sheet"), "",
+ new Attributes());
+ node.appendChild(new Element(Tag.valueOf("tab"), "", new Attributes()));
+ node.appendChild(new Element(Tag.valueOf("tab"), "", new Attributes()));
+ node.appendChild(new Element(Tag.valueOf("tab"), "", new Attributes()));
+ return node;
+ }
+
+ private DesignContext createDesignContext() {
+ return new DesignContext();
+ }
+
+ private TabSheet createTabSheet() {
+ TabSheet sheet = new TabSheet();
+ sheet.setTabIndex(5);
+ sheet.addTab(new TextField());
+ Tab tab = sheet.getTab(0);
+ tab.setCaption("test-caption");
+ tab.setVisible(false);
+ tab.setClosable(true);
+ tab.setEnabled(false);
+ tab.setIcon(new ExternalResource("http://www.vaadin.com/test.png"));
+ tab.setIconAlternateText("OK");
+ tab.setDescription("test-desc");
+ tab.setStyleName("test-style");
+ tab.setId("test-id");
+ return sheet;
+ }
+
+}
ble28 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/apps/accessibility/l10n/pt_BR.js
blob: 2c5f1d691ebe604a3356b6586b6b1db68dbe14f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24