package com.atlassian.plugin.webresource;

import junit.framework.TestCase;

import java.util.HashMap;

public class TestJavascriptWebResourceFormatter extends TestCase
{
    private JavascriptWebResourceFormatter javascriptWebResourceFormatter;

    protected void setUp() throws Exception
    {
        super.setUp();
        javascriptWebResourceFormatter = new JavascriptWebResourceFormatter();
    }

    protected void tearDown() throws Exception
    {
        javascriptWebResourceFormatter = null;
        super.tearDown();
    }

    public void testMatches()
    {
        assertTrue(javascriptWebResourceFormatter.matches("blah.js"));
        assertFalse(javascriptWebResourceFormatter.matches("blah.css"));
    }

    public void testFormatResource()
    {
        final String resourceName = "atlassian.js";
        final String url = "/confluence/download/resources/confluence.web.resources:ajs/atlassian.js";
        assertEquals("<script type=\"text/javascript\" src=\"" + url + "\"></script>\n",
                     javascriptWebResourceFormatter.formatResource(resourceName, url, new HashMap()));
    }
}

@@ -991,16 +991,17 @@
 rl + %22%5C%22
+ 
 %3E%3C/scrip

Refactor WebResourceManagerImpl to use WebResourceFormatters for javascript and css resources - css resource parameter for IE conditional comments added - also added support for several HTML attributes