package org.richfaces.testng;

import static org.testng.Assert.assertEquals;

import org.ajax4jsf.template.Template;
import org.richfaces.SeleniumTestBase;
import org.testng.annotations.Test;

public class LoadScriptTest extends SeleniumTestBase {

    @Test
    public void testLoadScriptComponent(Template template) throws Exception {
        renderPage(template);
        String jsCall = "summarize(%1$s, %2$s);";
        int opr1 = 1;
        int opr2 = 2;
        String result = runScript(String.format(jsCall, opr1, opr2));
        assertEquals(Integer.parseInt(result), opr1 + opr2);
    }

    public String getTestUrl() {
        return "pages/loadScript/loadScriptTest.xhtml";
    }

}
