Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fire the "jenkins:apply" event from the apply button and listen to that to write back edits to <TEXTAREA>
- Loading branch information
Showing
6 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,11 @@ Behaviour.specify("TEXTAREA.codemirror", 'textarea', 0, function(e) { | |
var scroller = codemirror.getScrollerElement(); | ||
scroller.setAttribute("style","border:1px solid black;"); | ||
scroller.style.height = h+"px"; | ||
|
||
// the form needs to be populated before the "Apply" button | ||
e.up('form').on("jenkins:apply",function() { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Vlatombe
Member
|
||
e.value = codemirror.getValue() | ||
}) | ||
}); | ||
|
||
Behaviour.specify("DIV.textarea-preview-container", 'textarea', 100, function (e) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package lib.form | ||
|
||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.jvnet.hudson.test.Bug | ||
import org.jvnet.hudson.test.JenkinsRule | ||
|
||
/** | ||
* | ||
* | ||
* @author Kohsuke Kawaguchi | ||
*/ | ||
class ApplyButtonTest { | ||
@Rule public JenkinsRule j = new JenkinsRule(); | ||
|
||
/** | ||
* Editing code mirror should still gets reflected when you click apply. | ||
*/ | ||
@Test @Bug(18436) | ||
public void editDescription() { | ||
def p = j.createFreeStyleProject() | ||
def b = j.assertBuildStatusSuccess(p.scheduleBuild2(0)) | ||
|
||
def config = j.createWebClient().getPage(b, "configure") | ||
def form = config.getFormByName("config") | ||
// HtmlUnit doesn't have JSON, so we need to emulate one | ||
config.executeJavaScript(getClass().getResource("JSON.js").text) | ||
// it's hard to emulate the keytyping, so we just set the value into codemirror and test if this gets | ||
// reflected back into TEXTAREA | ||
config.executeJavaScript("document.getElementsByTagName('TEXTAREA')[0].codemirrorObject.setLine(0,'foobar')") | ||
j.getButtonByCaption(form,"Apply").click() | ||
|
||
assert "foobar"==b.description | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// htmlunit doesn't have JSON, so emulate it | ||
if (typeof JSON=="undefined") { | ||
var JSON = { | ||
parse : function (str) { | ||
return String.evalJSON(str); | ||
}, | ||
stringify : function (obj) { | ||
return Object.toJSON(obj); | ||
} | ||
}; | ||
} |
This breaks https://jenkins.ci.cloudbees.com/job/selenium-tests/167/.
I am getting a javascript error on this line in job configuration page whenever envinject plugin is installed. The
behavior-loading
div won't disappear so there is no way to configure jobs. This does not seem to relate to any change in the plugin as it affects older versions too.TypeError: e.up(...).on is not a function @ http://127.0.0.1:8543/adjuncts/64f61af8/lib/form/textarea/textarea.js:18
in firefox andUncaught TypeError: Property 'on' of object #<HTMLFormElement> is not a function
in chrome.