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 JSFunctionTest extends SeleniumTestBase {

    @Test
    public void testJSFunctionComponent(Template template) {
        renderPage(template);

        String showNameElemId = getParentId() + "showname";
        selenium.mouseOver("alex");
        waitForAjaxCompletion();
        assertEquals(getTextById(showNameElemId), "Alex");

        selenium.mouseOver("jonh");
        waitForAjaxCompletion();
        assertEquals(getTextById(showNameElemId), "Jonh");

        selenium.mouseOver("roger");
        waitForAjaxCompletion();
        assertEquals(getTextById(showNameElemId), "Roger");
    }

    public String getTestUrl() {
        return "pages/jsFunction/jsFunctionTest.xhtml";
    }

}
