Expand my Community achievements bar.

SOLVED

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

Avatar

Former Community Member

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>

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
1 Reply

Avatar

Correct answer by
Community Advisor