Examples of DocumentLinker


Examples of org.apache.tapestry5.internal.services.DocumentLinker

    }

    @Test
    public void default_for_init_string_is_normal_priority()
    {
        DocumentLinker linker = mockDocumentLinker();
        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();
        trainForEmptyCoreStack(linker, stackSource, pathConstructor);

        JSONObject aggregated = new JSONObject().put("setup", new JSONArray().put("chuck"));

        linker.setInitialization(InitializationPriority.NORMAL, aggregated);

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, stackSource, pathConstructor);
View Full Code Here

Examples of org.apache.tapestry5.internal.services.DocumentLinker

    }

    @Test
    public void default_for_init_array_is_normal_priority()
    {
        DocumentLinker linker = mockDocumentLinker();
        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();
        trainForEmptyCoreStack(linker, stackSource, pathConstructor);

        JSONArray chuck = new JSONArray("chuck", "yeager");

        JSONObject aggregated = new JSONObject().put("setup", new JSONArray(chuck));

        linker.setInitialization(InitializationPriority.NORMAL, aggregated);

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, stackSource, pathConstructor);
View Full Code Here

Examples of org.apache.tapestry5.internal.services.DocumentLinker

    }

    @Test
    public void import_stylesheet_as_asset()
    {
        DocumentLinker linker = mockDocumentLinker();
        Asset stylesheet = mockAsset("style.css");

        StylesheetLink link = new StylesheetLink("style.css");
        linker.addStylesheetLink(link);

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, null, null);
View Full Code Here

Examples of org.apache.tapestry5.internal.services.DocumentLinker

    }

    @Test
    public void duplicate_stylesheet_ignored_first_media_wins()
    {
        DocumentLinker linker = mockDocumentLinker();
        StylesheetOptions options = new StylesheetOptions("print");

        linker.addStylesheetLink(new StylesheetLink("style.css", options));

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, null, null);
View Full Code Here

Examples of org.apache.tapestry5.internal.services.DocumentLinker

    }

    @Test
    public void partial_mode_add_script()
    {
        DocumentLinker linker = mockDocumentLinker();

        linker.setInitialization(InitializationPriority.NORMAL, new JSONObject(
                "{ 'evalScript' : [ 'doSomething();' ] }"));

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, null, null, new IdAllocator(), true);
View Full Code Here

Examples of org.apache.tapestry5.internal.services.DocumentLinker

    }

    @Test
    public void adding_script_will_add_stack()
    {
        DocumentLinker linker = mockDocumentLinker();
        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();
        trainForCoreStack(linker, stackSource, pathConstructor);

        linker.addScript(InitializationPriority.IMMEDIATE, "stackInit();");
        linker.addScript(InitializationPriority.NORMAL, "doSomething();");

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, stackSource, pathConstructor);
View Full Code Here

Examples of org.apache.tapestry5.internal.services.DocumentLinker

    }

    @Test
    public void add_script_passes_thru_to_document_linker()
    {
        DocumentLinker linker = mockDocumentLinker();
        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();
        trainForEmptyCoreStack(linker, stackSource, pathConstructor);

        linker.addScript(InitializationPriority.IMMEDIATE, "doSomething();");

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, stackSource, pathConstructor);
View Full Code Here

Examples of org.apache.tapestry5.internal.services.DocumentLinker

    }

    @Test
    public void import_library()
    {
        DocumentLinker linker = mockDocumentLinker();
        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();
        trainForEmptyCoreStack(linker, stackSource, pathConstructor);

        trainForNoStackNames(stackSource);

        Asset library = mockAsset("mylib.js");

        linker.addScriptLink("mylib.js");

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, stackSource, pathConstructor);
View Full Code Here

Examples of org.apache.tapestry5.internal.services.DocumentLinker

    }

    @Test
    public void import_library_from_stack_imports_the_stack()
    {
        DocumentLinker linker = mockDocumentLinker();
        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();
        trainForEmptyCoreStack(linker, stackSource, pathConstructor);

        Asset library1 = mockAsset("mylib1.js");
        Asset library2 = mockAsset("mylib2.js");

        JavaScriptStack mystack = mockJavaScriptStack();

        expect(stackSource.getStackNames()).andReturn(Arrays.asList("mystack"));
        expect(stackSource.getStack("mystack")).andReturn(mystack).atLeastOnce();

        expect(mystack.getStacks()).andReturn(Collections.<String> emptyList());
        expect(mystack.getJavaScriptLibraries()).andReturn(Arrays.asList(library1, library2));

        expect(pathConstructor.constructPathsForJavaScriptStack("mystack")).andReturn(
                Arrays.asList("stacks/mystack.js"));
        expect(mystack.getStylesheets()).andReturn(Collections.<StylesheetLink> emptyList());

        expect(mystack.getInitialization()).andReturn(null);

        linker.addScriptLink("stacks/mystack.js");

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, stackSource, pathConstructor);
View Full Code Here

Examples of org.apache.tapestry5.internal.services.DocumentLinker

    }

    @Test
    public void import_stack()
    {
        DocumentLinker linker = mockDocumentLinker();
        JavaScriptStackSource stackSource = mockJavaScriptStackSource();
        JavaScriptStackPathConstructor pathConstructor = mockJavaScriptStackPathConstructor();

        trainForCoreStack(linker, stackSource, pathConstructor);

        JavaScriptStack stack = mockJavaScriptStack();

        StylesheetLink stylesheetLink = new StylesheetLink("stack.css");

        expect(stackSource.getStack("custom")).andReturn(stack);
        expect(pathConstructor.constructPathsForJavaScriptStack("custom")).andReturn(
                CollectionFactory.newList("stack.js"));
        expect(stack.getStylesheets()).andReturn(CollectionFactory.newList(stylesheetLink));

        expect(stack.getInitialization()).andReturn("customInit();");

        List<String> stacks = Collections.emptyList();
        expect(stack.getStacks()).andReturn(stacks);

        linker.addScriptLink("stack.js");
        linker.addStylesheetLink(stylesheetLink);

        linker.addScript(InitializationPriority.IMMEDIATE, "stackInit();");
        linker.addScript(InitializationPriority.IMMEDIATE, "customInit();");

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, stackSource, pathConstructor);
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.