Author: dsvyatobatsko
Date: 2008-02-26 14:08:23 -0500 (Tue, 26 Feb 2008)
New Revision: 6358
Modified:
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java
trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java
Log:
added some FUC's properties and tests for them
Modified:
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java
===================================================================
---
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java 2008-02-26
18:54:45 UTC (rev 6357)
+++
trunk/sandbox/ui/fileUpload/src/main/java/org/richfaces/org/jboss/seam/ui/component/UIFileUpload.java 2008-02-26
19:08:23 UTC (rev 6358)
@@ -145,10 +145,14 @@
this.localInputStream = localInputStream;
}
- public abstract void setAccept(String accept);
+ public abstract void setAcceptedTypes(String acceptedTypes);
- public abstract String getAccept();
+ public abstract String getAcceptedTypes();
+ public abstract Integer getMaxFilesQuantity();
+
+ public abstract void setMaxFilesQuantity(Integer maxFilesQuantity);
+
public abstract String getStyleClass();
public abstract String getStyle();
Modified:
trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java
===================================================================
---
trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java 2008-02-26
18:54:45 UTC (rev 6357)
+++
trunk/sandbox/ui/fileUpload/src/test/java/org/richfaces/component/FileUploadComponentTest.java 2008-02-26
19:08:23 UTC (rev 6358)
@@ -64,7 +64,8 @@
form.setId("form");
facesContext.getViewRoot().getChildren().add(form);
fileUpload = (UIFileUpload)
application.createComponent(UIFileUpload.COMPONENT_TYPE);
- fileUpload.setAccept("application/zip,image/jpeg,video/mpeg");
+ fileUpload.setAcceptedTypes("application/zip,image/jpeg,video/mpeg");
+ fileUpload.setMaxFilesQuantity(5);
Map<String, UIComponent> facets = fileUpload.getFacets();
UIProgressBar progressBar = (UIProgressBar)
application.createComponent(UIProgressBar.COMPONENT_TYPE);
facets.put("progress", progressBar);
@@ -104,16 +105,31 @@
if (item.getFirstChild() != null) {
String scriptBodyString = item.getFirstChild().toString();
if (scriptBodyString.contains("new FileUpload")) {
-//
assertTrue(scriptBodyString.contains("application/zip"));
-// assertTrue(scriptBodyString.contains("image/jpeg"));
-// assertTrue(scriptBodyString.contains("video/mpeg"));
-// assertFalse(scriptBodyString.contains("image/png"));
+
assertTrue(scriptBodyString.contains("application/zip"));
+ assertTrue(scriptBodyString.contains("image/jpeg"));
+ assertTrue(scriptBodyString.contains("video/mpeg"));
+ assertFalse(scriptBodyString.contains("image/png"));
assertTrue(scriptBodyString.contains("FileUpload.CLASSES"));
}
}
}
}
+ public void testButtonState() throws Exception {
+ String clientId = fileUpload.getClientId(facesContext);
+ String testScript = "<script type='text/javascript'> var
fileUpload = $(" + clientId + ").component; var input = $(" + clientId +
":file);input.value = 'D:/TEST.txt';" +
+ "for( var i = 0; i <= 5; i++ ) { fileUpload.add(input); }
</script>";
+ UIOutput testScriptOutput = (UIOutput)
application.createComponent(UIOutput.COMPONENT_TYPE);
+ testScriptOutput.setValue(testScript);
+ form.getChildren().add(testScriptOutput);
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ HtmlElement addButtonDiv = page.getHtmlElementById(clientId +
":add1");
+ assertNotNull(addButtonDiv);
+ //assertEquals("display: none",
addButtonDiv.getAttributeValue("style"));
+ form.getChildren().remove(testScriptOutput);
+ }
+
/**
* @see AbstractAjax4JsfTestCase#tearDown()
*/
Show replies by date