View Javadoc

    1   /*
    2    * $Id: AutocompleterTest.java 508776 2007-02-17 16:33:57Z musachy $
    3    *
    4    * Licensed to the Apache Software Foundation (ASF) under one
    5    * or more contributor license agreements.  See the NOTICE file
    6    * distributed with this work for additional information
    7    * regarding copyright ownership.  The ASF licenses this file
    8    * to you under the Apache License, Version 2.0 (the
    9    * "License"); you may not use this file except in compliance
    10   * with the License.  You may obtain a copy of the License at
    11   *
    12   *  http://www.apache.org/licenses/LICENSE-2.0
    13   *
    14   * Unless required by applicable law or agreed to in writing,
    15   * software distributed under the License is distributed on an
    16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    17   * KIND, either express or implied.  See the License for the
    18   * specific language governing permissions and limitations
    19   * under the License.
    20   */
    21  package org.apache.struts2.views.jsp.ui;
    22
    23  import org.apache.struts2.views.jsp.AbstractUITagTest;
    24
    25  /***
    26   * @see org.apache.struts2.components.Autocompleter
    27   */
    28  public class AutocompleterTest extends AbstractUITagTest {
    29
    30      public void testAjax() throws Exception {
    31          AutocompleterTag tag = new AutocompleterTag();
    32          tag.setPageContext(pageContext);
    33          tag.setTheme("ajax");
    34          tag.setAutoComplete("true");
    35          tag.setDisabled("false");
    36          tag.setForceValidOption("false");
    37          tag.setHref("a");
    38          tag.setDropdownWidth("10");
    39          tag.setDropdownHeight("10");
    40          tag.setDelay("100");
    41          tag.setSearchType("b");
    42          tag.setDisabled("c");
    43          tag.setName("f");
    44          tag.setValue("g");
    45          tag.setIndicator("h");
    46          tag.setKeyName("i");
    47          tag.setLoadOnTextChange("true");
    48          tag.setLoadMinimumCount("3");
    49          tag.setShowDownArrow("false");
    50          tag.setIconPath("i");
    51          tag.setTemplateCssPath("j");
    52          tag.doStartTag();
    53          tag.doEndTag();
    54
    55          verify(AutocompleterTest.class.getResource("Autocompleter-1.txt"));
    56      }
    57
    58      public void testSimple() throws Exception {
    59          AutocompleterTag tag = new AutocompleterTag();
    60          tag.setPageContext(pageContext);
    61          tag.setTheme("simple");
    62          tag.setAutoComplete("true");
    63          tag.setDisabled("false");
    64          tag.setForceValidOption("false");
    65          tag.setList("{'d','e'}");
    66          tag.setHref("a");
    67          tag.setDropdownWidth("10");
    68          tag.setDropdownHeight("10");
    69          tag.setDelay("100");
    70          tag.setSearchType("b");
    71          tag.setDisabled("c");
    72          tag.setName("f");
    73          tag.setIconPath("i");
    74          tag.setTemplateCssPath("j");
    75          tag.doStartTag();
    76          tag.doEndTag();
    77
    78          verify(AutocompleterTest.class.getResource("Autocompleter-2.txt"));
    79      }
    80
    81  }