Skip to main content
October 16, 2015
Solved

how to do Unit testing for .jsp files in cq5?

Please share your Ans  how to do testing for below jsp file like using junit testing?

<%@include file="/libs/foundation/global.jsp"%>
<cq:includeClientLib categories="download" />
<acc:controller cls="com.download.controller.DownloadController"
    var="download" />

<c:set var="allLink" value="${download.alllink}" /> 
DownloadComponent
<div>
    <div id="download">
        <c:forEach items="${allLink}" var="listBean">


            <br>

 

 

            <input type="checkbox" name="type" id="${listBean.rootPath}">
            <a href="${listBean.rootPath}" id="${listBean.rootPath}1" download><br>

 

                <p>${listBean.name}</p>
                <br>
            <br>
            <br> </a>

        </c:forEach>
    </div>

    <br>
    <br>
    <br> <input type="button" value="Download selected"
        onclick="downloadchecked();"> <input type="button"
        value="Download all" onclick="downloadall();">
</div>

<script>


    function downloadall(){ 
        var image=document.getElementById("download").getElementsByTagName("a");

 

        for(i = 0;i < image.length; i++)
{
    image[i].click();
}
    };

 

    function downloadchecked(){ 

        var checkedIds = $(":checkbox:checked").map(function() {
        return this.id;
    }).get();

        for(j=0;j<checkedIds.length;j++){


            document.getElementById(checkedIds[j]+"1").click();


        }

    };

</script>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Peter_Puzanovs
Peter_PuzanovsAccepted solution
Community Advisor
October 16, 2015

1 reply

Peter_Puzanovs
Community Advisor
Peter_PuzanovsCommunity AdvisorAccepted solution
Community Advisor
October 16, 2015