Facelet Functional Test

From Eclipsepedia

Jump to: navigation, search

Contents

Project Creation and Facet Installation

XHTML Editor

For all these tests, start with a Dynamic Web Project with the JSF 1.2/Facelet facets. Ensure that JSF runtime, JSTL 1.2 and the facelet jars in the classpath. Create an XHTML 1.0 Transitional file in the WebContent root directory.

Content Assist

Namespace Assist

Basic insertion

  1. Place the cursor inside the html tag.
  2. Add the text xmlns:f=. Verify that content assist activates after the equals sign.
  3. With the cursor after the = sign, and Ctrl-Space.
  4. Verify again the content assist is activated with the following options:
  5. Select on of the options and verify that it is correctly inserted.

FaceletNamespaceContentAssist.png

No duplicate insertion

  1. With one of the namespace options inserted into the HTML from the test above.
  2. Create a new attribute for xmlns:h=
  3. Verify that the options list for content assist (which should again appear after entering hitting the = sign) includes all valid namespace options 'except' the one already inserted.
  4. Select an option and verify that it inserts correctly.

Tag Assist

Basic insertion

  1. Create an XHTML document and add the core and html namespaces to the page.
  2. Save the page.
  3. Create an opening less-than (<) and hit Ctrl-Space.
  4. Verify that all the core and html tags are present.
  5. Select h:form and verify it is correctly inserted.

Prefix selection

  1. Add the text <f: to a document with core declared with the f prefix.
  2. Hit Ctrl-Space after the : and verify that only the core tags are listed in the content assist.
  3. Add the text <h:in to a document with html declared with the h prefix.
  4. Hit Ctrl-Space after the text and verify that only inputHidden, inputSecret, inputText, inputTextarea are present.

Attribute Name Assist

Basic insert

  1. In a no-attribute h:outputText tag, activate content assist.
  2. Verify that the attribute options are listed.
  3. Select value and verify it inserts correctly.
  4. In an h:message tag, activate content assist for attributes.
  5. Verify that the attribute for is marked to indicate it is required.\
  6. Select for and verify it inserts correctly.

Attribute Name Prefix

  1. In a no-attribute h:outputText tag, add the a v at the beginning of an attribute.
  2. Activate content assist after the v.
  3. Verify that only assists for validator, validatorMessage, value, valueChangeListener.
  4. Select the validator and verify it inserts correctly.

Static Attribute Value Assist

  1. Starting with the tag, <h:outputText dir=""> activate content assist inside the double-quotes.
  2. Verify that assists for ltr and rtl are present.
  3. Select ltr and verify that it inserts correctly.

Dynamic Attribute Value, Non-EL Assist

  1. Create a page navigation from login.xhtml to welcome.xhtml in the faces-config (pages must exist). Call the outcome login in the faces-config file.
  2. In login.xhtml, add an h:commandButton.
  3. Add an action attribute to the commandButton tag.
  4. In the value for the action attribute, activate content assist.
  5. Verify that an assist is included: login: goto /welcome.xhtml.
  6. Use the assist and verify that it inserts login into the attribute value.

EL Content Assist

For these tests, add a beans.LoginBean class to the src folder and create a session bean of that type called loginBean to the faces-config. Also, create a login.xhtml Transitional XHTML file in a Facelet faceted project. Add name and password bean properties to the LoginBean type.

Variable Assist, Blank EL

  1. Create an h:inputText tag and add a value attribute to it.
  2. Set the value of the value attribute to "#{}".
  3. Activate content assist inside the braces.
  4. Verify that loginBean and all the implicit variables are present
  5. Scroll in the list to loginBean
  6. Verify that additionalInfo appears with name, type and scope correctly set.
  7. Select the loginBean action and verify it is correctly inserted.

Variable Assist, Variable Present

  1. Start with <h:inputText value="#{p}"/> in an XHTML document.
  2. After the p in the EL expression, activate content assist.
  3. Verify that only param and paramValue (the only ones starting with p) are present.
  4. Verify the correct insertion for paramValue.

Property Assist, No Property

  1. Add an <h:inputText value="#{loginBean.}"/>.
  2. Position the cursor after the . and hit Ctrl-Space.
  3. Verify that name and password and class appear as options.
  4. Backspace to delete the ..
  5. Re-enter the . and verify that the same assist options as above appear automatically.
  6. Select the name property in the list and verify that the additional info provides correct type and assignability.
  7. Select name and verify it inserts properly.

Property Assist, Existing Property

  1. Add an <h:inputText value="#{facesContext.r}"/>.
  2. After the r, press Ctrl-Space.
  3. Verify that only assists starting with r are present: renderKit, renderResponse, responseComplete, responseStream, responseWriter.
  4. Scroll through each and verify in the additionalInfo window in order: javax.faces.render.RenderKit, read-only, boolean, read-only, boolean, read-only, javax.faces.context.ResponseStream, read/write, javax.faces.context.ResponseWriter, read/write.
  5. Select the renderKit property and verify it inserts correctly.

Property Assist, Property of Property

  1. Starting from the result of the above, Property Assist, Existing Property.
  2. Activate content assist after renderKit by entering a . character.
  3. Verify that the assist window opens with class and responseStateManager present.
  4. Verify additionalInfo on the responseStateManager property as javax.faces.render.ResponseStateManager, read-only.
  5. Verify that the responseStateManager property inserts correctly.

EL Hover Help

For all hover help tests, start with a <h:inputText value="#{loginBean.name}"/> in an xhtml file.

Simple variable hover

  1. Place mouse over the loginBean. Verify that a hover help window appears with correct name, type and scope.

Simple property hover

  1. Place mouse over name.
  2. Verify that type and accessibility are correct.

Simple property hover with Javadoc

  1. Add Javadoc with a @return statement to the getter for the name property.
  2. Save and rebuild.
  3. Place mouse over the name property in the xhtml document.
  4. Verify that the return text appears in the hover help in addition to the basic type and accessibility information.

Hyperlink

Start with <h:inputText value="#{loginBean.name}"/>.

Variable

  1. Position mouse cursor over loginBean.
  2. Hold down ctrl and verify that a hyperlink appears under the text.
  3. Left mouse click and verify that the LoginBean class is opened in a Java editor with the class name selected.

Property

  1. Position mouse cursor over name.
  2. Hold down ctrl and verify that a hyperlink appears under the text.
  3. Left mouse click and verify that the LoginBean class is opened in a Java editor with the getName() method is selected.

Validation

Non-EL validation, Static

Non-EL validation, Dynamic

EL validation, no EL

EL validation, no variable

EL validation, no property

EL validation, valid variable.property