Examples of DocumentLinker


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

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

    }

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

        trainForCoreStack(linker, stackSource, pathConstructor);

        JavaScriptStack child = mockJavaScriptStack();
        JavaScriptStack parent = mockJavaScriptStack();

        StylesheetLink parentStylesheetLink = new StylesheetLink("parent.css");

        StylesheetLink childStylesheetLink = new StylesheetLink("child.css");

        expect(stackSource.getStack("child")).andReturn(child);

        expect(child.getStacks()).andReturn(Arrays.asList("parent"));

        expect(stackSource.getStack("parent")).andReturn(parent);

        expect(pathConstructor.constructPathsForJavaScriptStack("parent")).andReturn(Arrays.asList("parent.js"));
        expect(parent.getStylesheets()).andReturn(Arrays.asList(parentStylesheetLink));

        expect(parent.getInitialization()).andReturn("parentInit();");

        expect(pathConstructor.constructPathsForJavaScriptStack("child")).andReturn(Arrays.asList("child.js"));
        expect(child.getStylesheets()).andReturn(Arrays.asList(childStylesheetLink));

        expect(child.getInitialization()).andReturn("childInit();");

        expect(parent.getStacks()).andReturn(Collections.<String> emptyList());

        linker.addScriptLink("parent.js");
        linker.addScriptLink("child.js");

        linker.addStylesheetLink(parentStylesheetLink);
        linker.addStylesheetLink(childStylesheetLink);

        linker.addScript(InitializationPriority.IMMEDIATE, "stackInit();");
        linker.addScript(InitializationPriority.IMMEDIATE, "parentInit();");
        linker.addScript(InitializationPriority.IMMEDIATE, "childInit();");

        replay();

        JavaScriptSupportImpl jss = new JavaScriptSupportImpl(linker, stackSource, pathConstructor);
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");
        List<String> stackLst = CollectionFactory.newList("stack.js");

        expect(stackSource.getStack("custom")).andReturn(stack);
        expect(pathConstructor.constructPathsForJavaScriptStack("custom")).andReturn(
                stackLst);
        List<StylesheetLink> stylesheetLst = CollectionFactory.newList(stylesheetLink);
        expect(stack.getStylesheets()).andReturn(stylesheetLst);

        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

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

    }

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

        trainForCoreStack(linker, stackSource, pathConstructor);

        JavaScriptStack child = mockJavaScriptStack();
        JavaScriptStack parent = mockJavaScriptStack();

        StylesheetLink parentStylesheetLink = new StylesheetLink("parent.css");

        StylesheetLink childStylesheetLink = new StylesheetLink("child.css");

        expect(stackSource.getStack("child")).andReturn(child);

        expect(child.getStacks()).andReturn(Arrays.asList("parent"));

        expect(stackSource.getStack("parent")).andReturn(parent);

        expect(pathConstructor.constructPathsForJavaScriptStack("parent")).andReturn(Arrays.asList("parent.js"));
        expect(parent.getStylesheets()).andReturn(Arrays.asList(parentStylesheetLink));

        expect(parent.getInitialization()).andReturn("parentInit();");

        expect(pathConstructor.constructPathsForJavaScriptStack("child")).andReturn(Arrays.asList("child.js"));
        expect(child.getStylesheets()).andReturn(Arrays.asList(childStylesheetLink));

        expect(child.getInitialization()).andReturn("childInit();");

        expect(parent.getStacks()).andReturn(Collections.<String>emptyList());

        linker.addScriptLink("parent.js");
        linker.addScriptLink("child.js");

        linker.addStylesheetLink(parentStylesheetLink);
        linker.addStylesheetLink(childStylesheetLink);

        linker.addScript(InitializationPriority.IMMEDIATE, "stackInit();");
        linker.addScript(InitializationPriority.IMMEDIATE, "parentInit();");
        linker.addScript(InitializationPriority.IMMEDIATE, "childInit();");

        replay();

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

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

    }

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

        trainForNoStackNames(stackSource);

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

        linker.addScriptLink("mylib1.js");
        linker.addScriptLink("mylib2.js");

        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.