Skip to content

Commit 093105b

Browse files
author
nebolsin
committed
fix for GRAILS-1098
git-svn-id: https://svn.codehaus.org/grails/trunk@4120 1cfb16fd-6d17-0410-8ff1-b7e8e1e2867d
1 parent 3f13fd1 commit 093105b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/grails/grails-app/taglib/JavascriptTagLib.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class JavascriptTagLib {
180180
else {
181181
attrs.params = "'${paramName}='+this.value"
182182
}
183-
remoteFunction(attrs)
183+
out << remoteFunction(attrs)
184184
attrs.remove('params')
185185
out << "\""
186186
attrs.remove('url')

test/groovy/org/codehaus/groovy/grails/web/taglib/JavaScriptTagLibTests.groovy

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,24 @@ public class JavaScriptTagLibTests extends AbstractGrailsTagTests {
7474
}
7575
}
7676

77+
void testRemoteField() {
78+
// <g:remoteField action="changeTitle" update="titleDiv" name="title" value="${book?.title}"/>
79+
StringWriter sw = new StringWriter()
80+
PrintWriter pw = new PrintWriter(sw)
81+
82+
withTag("remoteField",pw) { tag ->
83+
GroovyObject tagLibrary = (GroovyObject)tag.getOwner()
84+
GrailsHttpServletRequest request = (GrailsHttpServletRequest)tagLibrary.getProperty("request")
85+
def includedLibrary = ['prototype']
86+
request.setAttribute("org.codehaus.grails.INCLUDED_JS_LIBRARIES", includedLibrary)
87+
88+
def attrs = [controller:'test',action:'changeTitle',update:'titleDiv',name:'title',value:'testValue']
89+
tag.call(attrs) { "body" }
90+
assertEquals("<input type=\"text\" name=\"title\" value=\"testValue\" onkeyup=\"new Ajax.Updater('titleDiv','/test/changeTitle',{asynchronous:true,evalScripts:true,parameters:'value='+this.value});\" />",sw.toString())
91+
}
92+
93+
}
94+
7795

7896
public void testEscapeJavascript() throws Exception {
7997
StringWriter sw = new StringWriter();

0 commit comments

Comments
 (0)