[richfaces-svn-commits] JBoss Rich Faces SVN: r11871 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/dataScroller and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu Dec 18 08:45:14 EST 2008


Author: alevkovsky
Date: 2008-12-18 08:45:12 -0500 (Thu, 18 Dec 2008)
New Revision: 11871

Added:
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScrollerInDataTableFacet.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/doubleDataScroller.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/doubleDataScrollerWithPageBinding.xhtml
Modified:
   trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataScrollerBean.java
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java
Log:
RF-5304, RF-5305, RF-5306, RF-5321

Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataScrollerBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataScrollerBean.java	2008-12-18 13:22:21 UTC (rev 11870)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DataScrollerBean.java	2008-12-18 13:45:12 UTC (rev 11871)
@@ -26,6 +26,8 @@
 
 import javax.faces.event.ActionEvent;
 
+import org.richfaces.component.UIDatascroller;
+
 /**
  * Bean class for dataScroller component testing
  * @author Andrey Markavtsov
@@ -49,7 +51,10 @@
 	
 	private String reRender;
 	
-
+	private boolean renderIfSinglePage = true;
+	
+	private UIDatascroller scroller;
+	
 	public DataScrollerBean() {
 		init();
 	}
@@ -85,6 +90,7 @@
 		page = null;
 		data = null;
 		onpagechange = "EventQueue.fire('onpagechange')";
+		renderIfSinglePage = true;
 	}
 	
 	public void apply(ActionEvent event) {
@@ -94,6 +100,20 @@
 	public String getTime() {
 		return String.valueOf(new Date().getTime());
 	}
+	
+	public String changeRenderIfSinglePage() {
+		if(renderIfSinglePage){
+			renderIfSinglePage = false;
+		}else{
+			renderIfSinglePage = true;
+		}
+		return null;
+	}
+	
+	public String changePage() {
+		page = 5;
+		return null;
+	}
 
 	/**
 	 * @return the data
@@ -196,5 +216,33 @@
 		this.reRender = reRender;
 	}
 
+	/**
+	 * @return the renderIfSinglePage
+	 */
+	public boolean isRenderIfSinglePage() {
+		return renderIfSinglePage;
+	}
+
+	/**
+	 * @param renderIfSinglePage the renderIfSinglePage to set
+	 */
+	public void setRenderIfSinglePage(boolean renderIfSinglePage) {
+		this.renderIfSinglePage = renderIfSinglePage;
+	}
+
+	/**
+	 * @return the scroller
+	 */
+	public UIDatascroller getScroller() {
+		return scroller;
+	}
+
+	/**
+	 * @param scroller the scroller to set
+	 */
+	public void setScroller(UIDatascroller scroller) {
+		this.scroller = scroller;
+	}
+
 	
 }

Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml	2008-12-18 13:22:21 UTC (rev 11870)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml	2008-12-18 13:45:12 UTC (rev 11871)
@@ -21,6 +21,7 @@
 			<h:commandButton id="maxP" action="#{dataScrollerBean.maxPages}" value="Test maxPages" />
 			<h:commandButton id="onpagechange" action="#{dataScrollerBean.onpagechange}" value="Test onpagechange" />
 			<h:commandButton id="pageVars" action="#{dataScrollerBean.pageVars}" value="Test page vars" />
+			<h:commandButton id="changeRenderIfSinglePage" action="#{dataScrollerBean.changeRenderIfSinglePage}" value="Change render if single page" />
 		</h:form>		
 		<br/>
 		<h:form id="_data">
@@ -39,6 +40,7 @@
 							   reRender="#{dataScrollerBean.reRender}"
 							   pageIndexVar="activePage"
 							   pagesVar="pagesCount"
+							   renderIfSinglePage="#{dataScrollerBean.renderIfSinglePage}"
 			>
 				<f:facet name="next">
 					<h:outputText value="Next"></h:outputText>

Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScrollerInDataTableFacet.xhtml
===================================================================
(Binary files differ)


Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScrollerInDataTableFacet.xhtml
___________________________________________________________________
Name: svn:mime-type
   + application/xhtml+xml

Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/doubleDataScroller.xhtml
===================================================================
(Binary files differ)


Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/doubleDataScroller.xhtml
___________________________________________________________________
Name: svn:mime-type
   + application/xhtml+xml

Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/doubleDataScrollerWithPageBinding.xhtml
===================================================================
(Binary files differ)


Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/doubleDataScrollerWithPageBinding.xhtml
___________________________________________________________________
Name: svn:mime-type
   + application/xhtml+xml

Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java	2008-12-18 13:22:21 UTC (rev 11870)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java	2008-12-18 13:45:12 UTC (rev 11871)
@@ -38,12 +38,24 @@
 	
 	static String TEST__URL = "pages/dataScroller/dataScroller.xhtml";
 	
+	private static String TEST_PAIRED_SCROLLERS_URL = "pages/dataScroller/doubleDataScroller.xhtml";
+	private static String TEST_PAIRED_SCROLLERS_WITH_PAGE_BINDING_URL = "pages/dataScroller/doubleDataScrollerWithPageBinding.xhtml";
+	private static String TEST_SCROLLER_SCROLLER_INSIDE_DATATABLE_FACET_URL = "pages/dataScroller/dataScrollerInDataTableFacet.xhtml";
+	
 	static final String RESET_METHOD_ME = "#{dataScrollerBean.reset}";
 	
 	String dataScrollerId;
 	
 	String dataScrollerTableId;
 	
+	String secondDataScrollerId;
+	
+	String secondDataScrollerTableId;
+	
+	String dataScrollerInFacetId;
+	
+	String dataScrollerTableInFacetId;
+	
 	String dataTableId;
 	
 	static final String [] activePageClasses = new String[] {
@@ -89,7 +101,7 @@
 		AssertTextEquals(activePageId, "Active page: 1", "PageIndexVar does not work.");
 		AssertTextEquals(pageCountId, "Count of pages: 10", "PagesVar does not work.");
 		
-		clickControl(4);
+		clickControl(4, dataScrollerTableId);
 		
 		AssertTextEquals(activePageId, "Active page: 2", "PageIndexVar does not work.");
 		AssertTextEquals(pageCountId, "Count of pages: 10", "PagesVar does not work.");
@@ -104,9 +116,9 @@
 		String commandId = getParentId() + "_controls:onpagechange";
 		clickCommandAndWait(commandId);
 		
-		assertClassNames(getPageLinkRefScript(4), inactivePageClasses, "'2' Link should be inactive", false);
+		assertClassNames(getPageLinkRefScript(4, dataScrollerTableId), inactivePageClasses, "'2' Link should be inactive", false);
 		clickControlNotWait(4);
-		assertClassNames(getPageLinkRefScript(4), inactivePageClasses, "Cancelable onpagechnage does not work. Page should not be switched. .'2' Link should be inactive", false);
+		assertClassNames(getPageLinkRefScript(4, dataScrollerTableId), inactivePageClasses, "Cancelable onpagechnage does not work. Page should not be switched. .'2' Link should be inactive", false);
 
 	}
 	
@@ -124,7 +136,7 @@
 	
 	@Override
 	public void sendAjax() {
-		clickControl(4);
+		clickControl(4, dataScrollerTableId);
 		
 	}
 	
@@ -156,42 +168,7 @@
 		renderPage(template, RESET_METHOD_ME);
 		initIDs(getParentId(), template);
 		
-		testPageCount(16);
-		
-		clickControl(5);
-		testData(1, "Page 3");
-		
-		assertClassNames(getPageLinkRefScript(5), activePageClasses, "'3' link should current", false);
-		assertClassNames(getPageLinkRefScript(3), inactivePageClasses, "'1' link should be inactive", false);
-		assertClassNames(getPageLinkRefScript(0), activeForwardClasses, "'««' control should be accessible", false);
-		assertClassNames(getPageLinkRefScript(1), activeForwardClasses, "'«' control should be accessible", false);
-		
-		clickControl(10);
-		testData(1, "Page 8");
-		assertClassNames(getPageLinkRefScript(10), activePageClasses, "'8' link should current", false);
-		
-		clickControl(15);
-		testData(1, "Page 10");
-		assertClassNames(getPageLinkRefScript(15), inactiveForwardClasses, "'»»' control should be inactive", false);
-		assertClassNames(getPageLinkRefScript(14), inactiveForwardClasses, "'»' control should be inactive", false);
-		
-		clickControl(1);
-		testData(1, "Page 9");
-		assertClassNames(getPageLinkRefScript(0), activeForwardClasses, "'»»' control should be active", false);
-		assertClassNames(getPageLinkRefScript(1), activeForwardClasses, "'»' control should be active", false);
-		assertClassNames(getPageLinkRefScript(11), activePageClasses, "'9' link should be current", false);
-		
-		clickControl(0);
-		testData(1, "Page 1");
-		assertClassNames(getPageLinkRefScript(3), activePageClasses, "'1' link should be current", false);
-		assertClassNames(getPageLinkRefScript(4), inactivePageClasses, "'2' link should be inactive", false);
-
-		clickControl(14);
-		testData(1, "Page 2");
-		assertClassNames(getPageLinkRefScript(3), inactivePageClasses, "'1' link should be inactive", false);
-		assertClassNames(getPageLinkRefScript(4), activePageClasses, "'2' link should be current", false);
-	
-				
+		testScrollers(false, dataScrollerId, dataScrollerTableId, null, null);						
 	}
 	
 	@Test
@@ -199,42 +176,42 @@
 		renderPage(template, RESET_METHOD_ME);
 		initIDs(getParentId(), template);
 		
-		testPageCount(16);
+		testPageCount(16, dataScrollerTableId);
 		
 		String buttonId = getParentId() + "_controls:maxP";
 		clickCommandAndWait(buttonId);
 		
-		testPageCount(11);
+		testPageCount(11, dataScrollerTableId);
 		
 		String text = selenium.getTable("id=" + dataScrollerTableId + ".0.5");
 		Assert.assertEquals(text, "3", "'3' link should be in the middle");
 		
-		clickControl(7);
-		testPageCount(11);
+		clickControl(7, dataScrollerTableId);
+		testPageCount(11, dataScrollerTableId);
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.5");
 		Assert.assertEquals(text, "5", "'5' link should be in the middle");
 		testData(1, "Page 5");
 		
 		
-		clickControl(10);
-		testPageCount(11);
+		clickControl(10, dataScrollerTableId);
+		testPageCount(11, dataScrollerTableId);
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.7");
 		Assert.assertEquals(text, "10");
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.3");
 		Assert.assertEquals(text, "6");
 		testData(1, "Page 10");
 		
-		clickControl(3);
-		testPageCount(11);
+		clickControl(3, dataScrollerTableId);
+		testPageCount(11, dataScrollerTableId);
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.5");
 		Assert.assertEquals(text, "6");
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.3");
 		Assert.assertEquals(text, "4");
 		testData(1, "Page 6");
 		
-		clickControl(1);
-		clickControl(1);
-		testPageCount(11);
+		clickControl(1, dataScrollerTableId);
+		clickControl(1, dataScrollerTableId);
+		testPageCount(11, dataScrollerTableId);
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.5");
 		Assert.assertEquals(text, "4");
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.3");
@@ -256,15 +233,15 @@
 		String applyId = getParentId() + "_controls:apply";
 		clickCommandAndWait(applyId);
 		
-		testPageCount(11);
+		testPageCount(11, dataScrollerTableId);
 		assertRowsCount(2, dataTableId);
 		
-		clickControl(7);
+		clickControl(7, dataScrollerTableId);
 		String text = selenium.getTable("id=" + dataScrollerTableId + ".0.7");
 		Assert.assertEquals(text, "5", "5th page should be displayed");
 		assertRowsCount(2, dataTableId);
 		
-		clickControl(3);
+		clickControl(3, dataScrollerTableId);
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.3");
 		Assert.assertEquals(text, "1", "1st page should be displayed");
 		assertRowsCount(2, dataTableId);
@@ -272,11 +249,156 @@
 		
 	}
 	
+	@Test
+	public void testRenderIfSinglePageAttribute(Template template) {
+		renderPage(template, RESET_METHOD_ME);
+		initIDs(getParentId(), template);
+		
+		AssertPresent(dataScrollerId);
 
+		String tableRowsId = getParentId() + "_controls:tableRow";
+		setValueById(tableRowsId, "10");
+
+		String applyId = getParentId() + "_controls:apply";
+		clickCommandAndWait(applyId);
+
+		AssertVisible(dataScrollerId);
+
+		String commandId = getParentId() + "_controls:changeRenderIfSinglePage";
+		clickCommandAndWait(commandId);
+
+		AssertNotVisible(dataScrollerId);
+
+		clickCommandAndWait(commandId);
+
+		AssertVisible(dataScrollerId);
+	}
+	
+	@Test
+	public void testPairedDataScrollers(Template template) {
+		renderPage(TEST_PAIRED_SCROLLERS_URL, template, RESET_METHOD_ME);
+		initIDs(getParentId(), template);
+		
+		testScrollers(true, dataScrollerId, dataScrollerTableId, secondDataScrollerId, secondDataScrollerTableId);		
+	}
+	
+	@Test
+	public void testPairedDataScrollersWithSharedBinding(Template template) {
+		renderPage(TEST_PAIRED_SCROLLERS_WITH_PAGE_BINDING_URL, template, RESET_METHOD_ME);
+		initIDs(getParentId(), template);
+		
+		testScrollers(true, dataScrollerId, dataScrollerTableId, secondDataScrollerId, secondDataScrollerTableId);	
+		
+		// change page attribute through shared binding
+		String commandId = getParentId() + "_controls:changePage";
+		clickCommandAndWait(commandId);
+		testData(1, "Page 5");
+		assertClassNames(getPageLinkRefScript(7, dataScrollerTableId), activePageClasses, "'5' link should current", false);	
+		assertClassNames(getPageLinkRefScript(7, secondDataScrollerTableId), activePageClasses, "'5' link should current", false);
+
+		
+	}
+	
+	@Test
+	public void testDataScrollerInsideDataTableFacet(Template template) {
+		renderPage(TEST_SCROLLER_SCROLLER_INSIDE_DATATABLE_FACET_URL, template, RESET_METHOD_ME);
+		initIDs(getParentId(), template);
+		
+		testScrollers(false, dataScrollerInFacetId, dataScrollerTableInFacetId, null, null);	
+	}
+	
+	private void testScrollers(boolean paired, String dataScrollerId, String dataScrollerTableId, String secondDataScrollerId, String secondDataScrollerTableId){
+		AssertPresent(dataScrollerId);
+		if(paired){
+			AssertPresent(secondDataScrollerId);
+		}
+
+		testPageCount(16, dataScrollerTableId);
+		
+		clickControl(5, dataScrollerTableId);
+		testData(1, "Page 3");
+		
+		assertClassNames(getPageLinkRefScript(5, dataScrollerTableId), activePageClasses, "'3' link should current", false);
+		assertClassNames(getPageLinkRefScript(3, dataScrollerTableId), inactivePageClasses, "'1' link should be inactive", false);
+		assertClassNames(getPageLinkRefScript(0, dataScrollerTableId), activeForwardClasses, "'««' control should be accessible", false);
+		assertClassNames(getPageLinkRefScript(1, dataScrollerTableId), activeForwardClasses, "'«' control should be accessible", false);
+		
+		if(paired){
+			assertClassNames(getPageLinkRefScript(5, secondDataScrollerTableId), activePageClasses, "'3' link should current", false);
+			assertClassNames(getPageLinkRefScript(3, secondDataScrollerTableId), inactivePageClasses, "'1' link should be inactive", false);
+			assertClassNames(getPageLinkRefScript(0, secondDataScrollerTableId), activeForwardClasses, "'««' control should be accessible", false);
+			assertClassNames(getPageLinkRefScript(1, secondDataScrollerTableId), activeForwardClasses, "'«' control should be accessible", false);
+		}
+		
+		if(paired){
+			clickControl(10, secondDataScrollerTableId);
+		}else{
+			clickControl(10, dataScrollerTableId);
+		}
+		testData(1, "Page 8");
+		assertClassNames(getPageLinkRefScript(10, dataScrollerTableId), activePageClasses, "'8' link should current", false);
+		if(paired){
+			assertClassNames(getPageLinkRefScript(10, secondDataScrollerTableId), activePageClasses, "'8' link should current", false);
+		}
+		
+		clickControl(15, dataScrollerTableId);
+		testData(1, "Page 10");
+		assertClassNames(getPageLinkRefScript(15, dataScrollerTableId), inactiveForwardClasses, "'»»' control should be inactive", false);
+		assertClassNames(getPageLinkRefScript(14, dataScrollerTableId), inactiveForwardClasses, "'»' control should be inactive", false);
+		if(paired){
+			assertClassNames(getPageLinkRefScript(15, secondDataScrollerTableId), inactiveForwardClasses, "'»»' control should be inactive", false);
+			assertClassNames(getPageLinkRefScript(14, secondDataScrollerTableId), inactiveForwardClasses, "'»' control should be inactive", false);
+		}
+		
+		if(paired){
+			clickControl(1, secondDataScrollerTableId);
+		}else{
+			clickControl(1, dataScrollerTableId);
+		}
+		testData(1, "Page 9");
+		assertClassNames(getPageLinkRefScript(0, dataScrollerTableId), activeForwardClasses, "'»»' control should be active", false);
+		assertClassNames(getPageLinkRefScript(1, dataScrollerTableId), activeForwardClasses, "'»' control should be active", false);
+		assertClassNames(getPageLinkRefScript(11, dataScrollerTableId), activePageClasses, "'9' link should be current", false);
+		if(paired){
+			assertClassNames(getPageLinkRefScript(0, secondDataScrollerTableId), activeForwardClasses, "'»»' control should be active", false);
+			assertClassNames(getPageLinkRefScript(1, secondDataScrollerTableId), activeForwardClasses, "'»' control should be active", false);
+			assertClassNames(getPageLinkRefScript(11, secondDataScrollerTableId), activePageClasses, "'9' link should be current", false);
+		}
+		
+		clickControl(0, dataScrollerTableId);
+		testData(1, "Page 1");
+		assertClassNames(getPageLinkRefScript(3, dataScrollerTableId), activePageClasses, "'1' link should be current", false);
+		assertClassNames(getPageLinkRefScript(4, dataScrollerTableId), inactivePageClasses, "'2' link should be inactive", false);
+		if(paired){
+			assertClassNames(getPageLinkRefScript(3, secondDataScrollerTableId), activePageClasses, "'1' link should be current", false);
+			assertClassNames(getPageLinkRefScript(4, secondDataScrollerTableId), inactivePageClasses, "'2' link should be inactive", false);
+		}
+
+		if(paired){
+			clickControl(14, secondDataScrollerTableId);
+		}else{
+			clickControl(14, dataScrollerTableId);
+		}
+		testData(1, "Page 2");
+		assertClassNames(getPageLinkRefScript(3, dataScrollerTableId), inactivePageClasses, "'1' link should be inactive", false);
+		assertClassNames(getPageLinkRefScript(4, dataScrollerTableId), activePageClasses, "'2' link should be current", false);
+		if(paired){
+			assertClassNames(getPageLinkRefScript(3, secondDataScrollerTableId), inactivePageClasses, "'1' link should be inactive", false);
+			assertClassNames(getPageLinkRefScript(4, secondDataScrollerTableId), activePageClasses, "'2' link should be current", false);
+		}
+
+	}
+
 	private void initIDs(String parentId, Template template) {
 		dataScrollerId = parentId + "_data:scroller";
 		dataScrollerTableId = parentId + "_data:scroller_table";
 		
+		secondDataScrollerId = parentId + "_data:scroller2";
+		secondDataScrollerTableId = parentId + "_data:scroller2_table";
+		
+		dataScrollerInFacetId = parentId + "_data:tbl:scroller";
+		dataScrollerTableInFacetId = parentId + "_data:tbl:scroller_table";
+		
 		//FIXME: currently dataTableId is invalid (dataTableId + ':0'). May be it's cause of problem with component state storing inside dataTable.
 		dataTableId = (!template.getName().equals(Template.DATA_TABLE.getName())) ? parentId + "_data:tbl" : parentId + "_data:tbl:0";
 	}
@@ -313,14 +435,14 @@
 		                                             "rich-dtascroller-table"},
 		                 "DataScroller rendering failed: ", true);
 
-		testPageCount(16);
+		testPageCount(16, dataScrollerTableId);
 		testControls();
 		testData(1,"Page 1");
 		checkCustomFacets();
 	}
 	
 
-	private void testPageCount(int n) {
+	private void testPageCount(int n, String dataScrollerTableId) {
 		assertColumnsCount(n, dataScrollerTableId, "DataScroller inner table contains invalid columns count");
 	}
 	
@@ -328,37 +450,37 @@
 		// Check '««' link 
 		String text = selenium.getTable("id=" + dataScrollerTableId + ".0.0");
 		Assert.assertEquals("««", text, "DataScroller does not contain '««' link or its position is invalid");
-		assertClassNames(getPageLinkRefScript(0),inactiveForwardClasses,
+		assertClassNames(getPageLinkRefScript(0, dataScrollerTableId),inactiveForwardClasses,
 		                 "DataScroller rendering failed: ", false);
 		
 		// Check '«' link
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.1");
 		Assert.assertEquals("«", text, "DataScroller does not contain '«' link or its position is invalid");
-		assertClassNames(getPageLinkRefScript(1),inactiveForwardClasses,
+		assertClassNames(getPageLinkRefScript(1, dataScrollerTableId),inactiveForwardClasses,
 		                 "DataScroller rendering failed: ", false);
 		
 		// Check '1' link
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.3");
 		Assert.assertEquals("1", text, "DataScroller does not contain '1' link or its position is invalid");
-		assertClassNames(getPageLinkRefScript(3),activePageClasses,
+		assertClassNames(getPageLinkRefScript(3, dataScrollerTableId),activePageClasses,
 		 		                 "DataScroller rendering failed: ", false);
 		
 		// Check '5' link
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.7");
 		Assert.assertEquals("5", text, "DataScroller does not contain '5' link or its position is invalid");
-		assertClassNames(getPageLinkRefScript(7),inactivePageClasses,
+		assertClassNames(getPageLinkRefScript(7, dataScrollerTableId),inactivePageClasses,
 		 		                 "DataScroller rendering failed: ", false);
 		
 		// Check '»' link
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.14");
 		Assert.assertEquals("»", text, "DataScroller does not contain '»' link or its position is invalid");
-		assertClassNames(getPageLinkRefScript(14),activeForwardClasses,
+		assertClassNames(getPageLinkRefScript(14, dataScrollerTableId),activeForwardClasses,
 		 		                 "DataScroller rendering failed: ", false);
 		
 		// Check '»»' link
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.15");
 		Assert.assertEquals("»»", text, "DataScroller does not contain '»»' link or its position is invalid");
-		assertClassNames(getPageLinkRefScript(15),activeForwardClasses,
+		assertClassNames(getPageLinkRefScript(15, dataScrollerTableId),activeForwardClasses,
 		 		                 "DataScroller rendering failed: ", false);
 
 	}
@@ -366,18 +488,18 @@
 	private void checkCustomFacets() {
 		String text = selenium.getTable("id=" + dataScrollerTableId + ".0.2");
 		Assert.assertEquals("", text, "'Previous' facet should be rendered yet");
-		assertClassNames(getPageLinkRefScript(2),inactiveForwardClasses,
+		assertClassNames(getPageLinkRefScript(2, dataScrollerTableId),inactiveForwardClasses,
 		 		                 "DataScroller rendering failed: ", false);
 		
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.13");
 		Assert.assertEquals("Next", text, "'Next' facet didnot rendered. DataScroller does not contain 'Next' link or its position is invalid");
-		assertClassNames(getPageLinkRefScript(13),activeForwardClasses,
+		assertClassNames(getPageLinkRefScript(13, dataScrollerTableId),activeForwardClasses,
 		 		                 "DataScroller rendering failed: ", false);
-		clickControl(4);
+		clickControl(4, dataScrollerTableId);
 		
 		text = selenium.getTable("id=" + dataScrollerTableId + ".0.2");
 		Assert.assertEquals("Previous", text, "'Previous' facet didnot be rendered.");
-		assertClassNames(getPageLinkRefScript(2),activeForwardClasses,
+		assertClassNames(getPageLinkRefScript(2, dataScrollerTableId),activeForwardClasses,
 		 		                 "DataScroller rendering failed: ", false);
 			
 		
@@ -392,7 +514,7 @@
 		}
 	}
 	
-	private String getPageLinkRefScript(int n) {
+	private String getPageLinkRefScript(int n, String dataScrollerTableId) {
 		StringBuffer b = new StringBuffer(WINDOW_JS_RESOLVER);
 		b.append("$('");
 		b.append(dataScrollerTableId);
@@ -402,18 +524,18 @@
 		return b.toString();
 	}
 	
-	private void clickControl(int n) {
+	private void clickControl(int n, String dataScrollerTableId) {
 		StringBuffer b = new StringBuffer();
-		b.append(getPageLinkRefScript(n));
+		b.append(getPageLinkRefScript(n, dataScrollerTableId));
 		b.append(".onclick();");
 		selenium.getEval(b.toString());		
 		waitForAjaxCompletion();
 		assertEvents(events);
 	}
-	
+		
 	private void clickControlNotWait(int n) {
 		StringBuffer b = new StringBuffer();
-		b.append(getPageLinkRefScript(n));
+		b.append(getPageLinkRefScript(n, dataScrollerTableId));
 		b.append(".onclick();");
 		selenium.getEval(b.toString());		
 	}




More information about the richfaces-svn-commits mailing list