2 * Copyright 2000-2016 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com.vaadin.v7.tests.server.component.textarea;
18 import java.io.IOException;
20 import org.jsoup.nodes.Element;
21 import org.jsoup.parser.Tag;
22 import org.junit.Assert;
23 import org.junit.Test;
25 import com.vaadin.tests.design.DeclarativeTestBase;
26 import com.vaadin.ui.declarative.DesignContext;
27 import com.vaadin.v7.ui.TextArea;
30 * Tests declarative support for implementations of {@link TextArea}.
35 public class TextAreaDeclarativeTest extends DeclarativeTestBase<TextArea> {
38 public void testTextArea() {
39 String design = "<vaadin7-text-area rows=6 wordwrap=false>Hello World!</vaadin7-text-area>";
40 TextArea ta = new TextArea();
42 ta.setWordwrap(false);
43 ta.setValue("Hello World!");
45 testWrite(design, ta);
49 public void testHtmlEntities() throws IOException {
50 String design = "<vaadin7-text-area>& Test</vaadin7-text-area>";
51 TextArea read = read(design);
52 assertEquals("& Test", read.getValue());
54 read.setValue("& Test");
56 DesignContext dc = new DesignContext();
57 Element root = new Element(Tag.valueOf("vaadin-text-area"), "");
58 read.writeDesign(root, dc);
60 assertEquals("&amp; Test", root.html());
64 public void testReadOnlyValue() {
65 String design = "<vaadin7-text-area readonly rows=6 wordwrap=false>Hello World!</vaadin7-text-area>";
66 TextArea ta = new TextArea();
68 ta.setWordwrap(false);
69 ta.setValue("Hello World!");
72 testWrite(design, ta);