Author: alexsmirnov
Date: 2010-12-16 20:21:37 -0500 (Thu, 16 Dec 2010)
New Revision: 20631
Added:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java
Modified:
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java
Log:
CODING IN PROGRESS - issue RF-7654: rich:message/rich:messages
https://issues.jboss.org/browse/RF-7654
Modified:
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
===================================================================
---
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-17
01:09:52 UTC (rev 20630)
+++
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-17
01:21:37 UTC (rev 20631)
@@ -28,10 +28,10 @@
return
{detail:_interpolateMessage(facesMessage.detail,values),summary:_interpolateMessage(facesMessage.summary,values)};
},
sendMessage: function (componentId, message) {
- rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME, {componentId:componentId,
message:message});
+ rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME,
{'componentId':componentId, 'message':message});
},
clearMessage: function (componentId) {
- rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME, {componentId:componentId,
message:''});
+ rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME,
{'componentId':componentId, 'message':''});
},
getValue: function (clientId, element){
var value;
Added:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java
===================================================================
---
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java
(rev 0)
+++
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java 2010-12-17
01:21:37 UTC (rev 20631)
@@ -0,0 +1,59 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.javascript.client.message;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class ClearMessageTest extends MessageTestBase {
+
+ private static final String ERROR_MESSAGE = "Error";
+
+ @Test
+ public void testClear() throws Exception {
+ sendMessage();
+ HtmlElement htmlElement = getMessageContentElement();
+ String text = htmlElement.asText();
+ assertFalse(text.contains(ERROR_MESSAGE));
+ }
+
+ @Override
+ protected String getMessageContent() {
+
+ return "<li>Error</li>";
+ }
+ @Override
+ protected String getJavaScriptFunctionName() {
+ return "clearMessage";
+ }
+}
Property changes on:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/ClearMessageTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
===================================================================
---
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-17
01:09:52 UTC (rev 20630)
+++
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-17
01:21:37 UTC (rev 20631)
@@ -1,5 +1,7 @@
package org.richfaces.javascript.client.message;
+import static org.junit.Assert.*;
+
import org.ajax4jsf.javascript.JSFunction;
import org.jboss.test.qunit.Qunit;
import org.jboss.test.qunit.Qunit.Builder;
@@ -7,6 +9,9 @@
import org.junit.Rule;
import org.richfaces.javascript.Message;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
public class MessageTestBase {
@Rule
@@ -49,4 +54,11 @@
return new Message(2,"error","script error");
}
+ protected HtmlElement getMessageContentElement() {
+ HtmlPage page = qunit.getPage();
+ HtmlElement htmlElement = page.getElementById(MY_MESSAGE+":Content");
+ assertNotNull(htmlElement);
+ return htmlElement;
+ }
+
}
Modified:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java
===================================================================
---
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java 2010-12-17
01:09:52 UTC (rev 20630)
+++
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java 2010-12-17
01:21:37 UTC (rev 20631)
@@ -28,7 +28,6 @@
import org.junit.Test;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
/**
* <p class="changed_added_4_0"></p>
@@ -40,9 +39,7 @@
@Test
public void testSend() throws Exception {
sendMessage();
- HtmlPage page = qunit.getPage();
- HtmlElement htmlElement = page.getElementById(MY_MESSAGE+":Content");
- assertNotNull(htmlElement);
+ HtmlElement htmlElement = getMessageContentElement();
String text = htmlElement.asText();
assertTrue(text.contains(getErrorMessage().getSummary()));
}