Search in sources :

Example 26 with WApplication

use of com.github.bordertech.wcomponents.WApplication in project wcomponents by BorderTech.

the class WApplicationRenderer_Test method testCssResources.

@Test
public void testCssResources() throws IOException, SAXException, XpathException {
    // No resource
    WApplication application = new WApplication();
    assertSchemaMatch(application);
    assertXpathNotExists("//ui:application/ui:css", application);
    // Add URL resource
    application.addCssUrl("URL");
    assertSchemaMatch(application);
    assertXpathEvaluatesTo("URL", "//ui:application/ui:css/@url", application);
}
Also used : WApplication(com.github.bordertech.wcomponents.WApplication) Test(org.junit.Test)

Example 27 with WApplication

use of com.github.bordertech.wcomponents.WApplication in project wcomponents by BorderTech.

the class WApplicationRenderer_Test method testRenderedFormatWithFocussedComponent.

@Test
public void testRenderedFormatWithFocussedComponent() throws XpathException, IOException, SAXException {
    MockWEnvironment environment = new MockWEnvironment();
    WApplication application = new WApplication();
    environment.setPostPath("WApplicationRendererTest.postPath");
    WTextField focussedComponent = new WTextField();
    application.add(focussedComponent);
    UIContext uic = createUIContext();
    uic.setEnvironment(environment);
    uic.setUI(application);
    uic.setFocusRequired(true);
    uic.setFocussed(focussedComponent);
    setActiveContext(uic);
    assertSchemaMatch(application);
    assertXpathEvaluatesTo(environment.getPostPath(), "//ui:application/@applicationUrl", application);
    assertXpathEvaluatesTo(WComponent.DEFAULT_APPLICATION_ID, "//ui:application/@id", application);
    assertXpathEvaluatesTo(environment.getWServletPath(), "//ui:application/@ajaxUrl", application);
    assertXpathEvaluatesTo(focussedComponent.getId(), "//ui:application/@defaultFocusId", application);
    uic.setFocusRequired(false);
    assertXpathNotExists("//ui:application/@defaultFocusId", application);
}
Also used : MockWEnvironment(com.github.bordertech.wcomponents.MockWEnvironment) WApplication(com.github.bordertech.wcomponents.WApplication) UIContext(com.github.bordertech.wcomponents.UIContext) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 28 with WApplication

use of com.github.bordertech.wcomponents.WApplication in project wcomponents by BorderTech.

the class WApplicationRenderer_Test method testJsResources.

@Test
public void testJsResources() throws IOException, SAXException, XpathException {
    // No resource
    WApplication application = new WApplication();
    assertSchemaMatch(application);
    assertXpathNotExists("//ui:application/ui:js", application);
    // Add URL resource
    application.addJsUrl("URL");
    assertSchemaMatch(application);
    assertXpathEvaluatesTo("URL", "//ui:application/ui:js/@url", application);
}
Also used : WApplication(com.github.bordertech.wcomponents.WApplication) Test(org.junit.Test)

Aggregations

WApplication (com.github.bordertech.wcomponents.WApplication)28 Test (org.junit.Test)14 UIContext (com.github.bordertech.wcomponents.UIContext)13 WComponent (com.github.bordertech.wcomponents.WComponent)8 MockWEnvironment (com.github.bordertech.wcomponents.MockWEnvironment)6 WButton (com.github.bordertech.wcomponents.WButton)4 WLabel (com.github.bordertech.wcomponents.WLabel)4 UIContextImpl (com.github.bordertech.wcomponents.UIContextImpl)3 WText (com.github.bordertech.wcomponents.WText)3 WebXmlRenderContext (com.github.bordertech.wcomponents.servlet.WebXmlRenderContext)3 PrintWriter (java.io.PrintWriter)3 ActionEscape (com.github.bordertech.wcomponents.ActionEscape)2 WTextField (com.github.bordertech.wcomponents.WTextField)2 WWindow (com.github.bordertech.wcomponents.WWindow)2 MockRequest (com.github.bordertech.wcomponents.util.mock.MockRequest)2 Map (java.util.Map)2 Before (org.junit.Before)2 AbstractWComponent (com.github.bordertech.wcomponents.AbstractWComponent)1 ComponentWithContext (com.github.bordertech.wcomponents.ComponentWithContext)1 Environment (com.github.bordertech.wcomponents.Environment)1