Examples of JavaScriptSupport


Examples of org.apache.tapestry5.services.javascript.JavaScriptSupport

{
    @Test
    public void render_simple()
    {
        ComponentResources resources = mockComponentResources();
        JavaScriptSupport support = mockJavaScriptSupport();

        MarkupWriter writer = new MarkupWriterImpl(new DefaultMarkupModel());

        resources.renderInformalParameters(writer);
View Full Code Here

Examples of org.apache.tapestry5.services.javascript.JavaScriptSupport

    @Test
    public void render_with_id()
    {
        ComponentResources resources = mockComponentResources();
        JavaScriptSupport support = mockJavaScriptSupport();

        MarkupWriter writer = new MarkupWriterImpl(new DefaultMarkupModel());

        resources.renderInformalParameters(writer);

        String clientId = "bar";
        String uniqueId = "bar_0";

        expect(support.allocateClientId(clientId)).andReturn(uniqueId);

        replay();

        Any component = new Any();
        component.inject(support, resources, "div", clientId);
View Full Code Here

Examples of org.apache.tapestry5.services.javascript.JavaScriptSupport

    @Test
    public void attempt_to_get_client_id_before_render()
    {
        ComponentResources resources = mockComponentResources();
        JavaScriptSupport support = mockJavaScriptSupport();

        train_getCompleteId(resources, "Foo/bar.baz");

        replay();
View Full Code Here

Examples of org.apache.tapestry5.services.javascript.JavaScriptSupport

    @Test
    public void add_links()
    {
        Link link1 = mockLink("/link1");
        JavaScriptSupport js = mockJavaScriptSupport();

        js.addInitializerCall("linkZone", new JSONObject("linkId", "client1", "zoneId", "zone1", "url", "/link1"));

        replay();

        ClientBehaviorSupportImpl setup = new ClientBehaviorSupportImpl(js, null);
View Full Code Here

Examples of org.apache.tapestry5.services.javascript.JavaScriptSupport

    }

    @Test
    public void add_zones()
    {
        JavaScriptSupport js = mockJavaScriptSupport();
        Environment environment = mockEnvironment();

        expect(environment.peek(FormSupport.class)).andReturn(null).atLeastOnce();

        js.addInitializerCall("zone", new JSONObject("element", "client1"));
        js.addInitializerCall("zone", new JSONObject("element", "client2"));

        replay();

        ClientBehaviorSupportImpl setup = new ClientBehaviorSupportImpl(js, environment);
View Full Code Here

Examples of org.apache.tapestry5.services.javascript.JavaScriptSupport

    }

    @Test
    public void add_zone_inside_form()
    {
        JavaScriptSupport js = mockJavaScriptSupport();
        Environment environment = mockEnvironment();
        FormSupport fs = mockFormSupport();

        expect(environment.peek(FormSupport.class)).andReturn(fs).atLeastOnce();

        expect(fs.getClientId()).andReturn("myform");
        expect(fs.getFormComponentId()).andReturn("MyPage.myform");

        JSONObject expected = new JSONObject(String.format(
                "{element:'client1', parameters:{'%s': 'myform', '%s': 'MyPage.myform' }}",
                RequestConstants.FORM_CLIENTID_PARAMETER, RequestConstants.FORM_COMPONENTID_PARAMETER));

        js.addInitializerCall("zone", expected);

        replay();

        ClientBehaviorSupportImpl setup = new ClientBehaviorSupportImpl(js, environment);
View Full Code Here

Examples of org.apache.tapestry5.services.javascript.JavaScriptSupport

    }

    @Test
    public void zones_with_functions()
    {
        JavaScriptSupport js = mockJavaScriptSupport();
        Environment environment = mockEnvironment();

        expect(environment.peek(FormSupport.class)).andReturn(null).atLeastOnce();

        js.addInitializerCall("zone", new JSONObject("{'element':'client1', 'show':'showme' }"));
        js.addInitializerCall("zone", new JSONObject("{'element':'client2', 'update':'updateme' }"));

        replay();

        ClientBehaviorSupportImpl setup = new ClientBehaviorSupportImpl(js, environment);
View Full Code Here

Examples of org.apache.tapestry5.services.javascript.JavaScriptSupport

    }

    @Test
    public void zone_function_names_are_converted_to_lower_case()
    {
        JavaScriptSupport js = mockJavaScriptSupport();
        Environment environment = mockEnvironment();

        expect(environment.peek(FormSupport.class)).andReturn(null).atLeastOnce();

        js.addInitializerCall("zone", new JSONObject("{'element':'client1', 'show':'showme' }"));
        js.addInitializerCall("zone", new JSONObject("{'element':'client2', 'update':'updateme' }"));

        replay();

        ClientBehaviorSupportImpl setup = new ClientBehaviorSupportImpl(js, environment);
View Full Code Here

Examples of org.apache.tapestry5.services.javascript.JavaScriptSupport

        train_getId(resources, "tracy");

        replay();

        JavaScriptSupport jss = new JavaScriptSupportImpl(null, null, null);

        assertEquals(jss.allocateClientId(resources), "tracy");
        assertEquals(jss.allocateClientId(resources), "tracy_0");
        assertEquals(jss.allocateClientId(resources), "tracy_1");

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.services.javascript.JavaScriptSupport

    private static final String ASSET_URL = "/assets/foo/bar.pdf";

    @Test
    public void add_script_link_by_asset()
    {
        JavaScriptSupport js = mockJavaScriptSupport();
        Asset asset = mockAsset();

        js.importJavaScriptLibrary(asset);

        replay();

        RenderSupport support = new RenderSupportImpl(null, null, js);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.