Javascript tests for the bulk moderation view added (currently failing).
svn path=/plone.app.discussion/trunk/; revision=40228
This commit is contained in:
parent
ad99e45203
commit
cf11a5134a
43
plone/app/discussion/tests/javascripts/test_moderation.html
Normal file
43
plone/app/discussion/tests/javascripts/test_moderation.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
|
||||||
|
dir="ltr" id="html">
|
||||||
|
<head>
|
||||||
|
<title>plone.app.discussion moderation Test Suite</title>
|
||||||
|
|
||||||
|
<!-- qUnit -->
|
||||||
|
<link rel="stylesheet" href="../qunit/qunit.css" type="text/css"
|
||||||
|
media="screen" />
|
||||||
|
<script type="text/javascript" src="../qunit/qunit.js"></script>
|
||||||
|
|
||||||
|
<!-- jQuery -->
|
||||||
|
<script type="text/javascript" src="jquery.js"></script>
|
||||||
|
|
||||||
|
<!-- plone.app.discussion -->
|
||||||
|
<script type="text/javascript" src="../../browser/javascripts/moderation.js">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Tests -->
|
||||||
|
<script type="text/javascript" src="test_moderation.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1 id="qunit-header">plone.app.discussion comments Test
|
||||||
|
Suite</h1>
|
||||||
|
|
||||||
|
<h2 id="qunit-banner"></h2>
|
||||||
|
|
||||||
|
<div id="qunit-testrunner-toolbar">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2 id="qunit-userAgent"></h2>
|
||||||
|
|
||||||
|
<ol id="qunit-tests">
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
72
plone/app/discussion/tests/javascripts/test_moderation.js
Normal file
72
plone/app/discussion/tests/javascripts/test_moderation.js
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/* TEST SETUP */
|
||||||
|
|
||||||
|
module("comments", {
|
||||||
|
setup: function () {
|
||||||
|
// <form>
|
||||||
|
// <table id="review-comments">
|
||||||
|
// <tbody>
|
||||||
|
// <tr>
|
||||||
|
// <td>
|
||||||
|
// <a href="http://localhost:8080/Plone/front-page/++conversation++default/1285339036601284">My comment</a>
|
||||||
|
// </td>
|
||||||
|
// <td class="actions">
|
||||||
|
// <input id="1285339036601284" class="context comment-publish-button" type="submit" value="Publish" name="form.button.Publish" />
|
||||||
|
// <input id="1285339036601284" class="destructive comment-delete-button" type="submit" value="Delete" name="form.button.Delete" />
|
||||||
|
// </td>
|
||||||
|
// </tr>
|
||||||
|
// </tbody>
|
||||||
|
// </table>
|
||||||
|
// </form>
|
||||||
|
var review_table = $(document.createElement("form"))
|
||||||
|
.append($(document.createElement("table"))
|
||||||
|
.attr("id", "review-comments")
|
||||||
|
.append($(document.createElement("tbody"))
|
||||||
|
.append($(document.createElement("tr"))
|
||||||
|
.append($(document.createElement("td"))
|
||||||
|
.append($(document.createElement("a"))
|
||||||
|
.text("My comment.")
|
||||||
|
.attr("href", "http://localhost:8080/Plone/front-page/++conversation++default/1285339036601284")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.append($(document.createElement("td"))
|
||||||
|
.append($(document.createElement("input"))
|
||||||
|
.attr("id", "1285339036601284")
|
||||||
|
.attr("value", "Publish")
|
||||||
|
.attr("name", "form.button.Publish")
|
||||||
|
)
|
||||||
|
.append($(document.createElement("input"))
|
||||||
|
.attr("id", "1285339036601284")
|
||||||
|
.attr("value", "Delete")
|
||||||
|
.attr("name", "form.button.Delete")
|
||||||
|
)
|
||||||
|
.addClass("actions")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$(document.body).append(review_table);
|
||||||
|
},
|
||||||
|
teardown: function () {
|
||||||
|
$("form").remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/* TESTS */
|
||||||
|
|
||||||
|
test("Delete a single comment", function(){
|
||||||
|
expect(1);
|
||||||
|
stop();
|
||||||
|
var delete_button = $(".actions").children("input[name='form.button.Delete']");
|
||||||
|
delete_button.trigger('click');
|
||||||
|
start();
|
||||||
|
equals($("#1285339036601284").attr("name", "form.button.Delete").length, 0, "The comment row should have been deleted.");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
test("Publish a single comment", function(){
|
||||||
|
expect(1);
|
||||||
|
var publish_button = $(".actions").children("input[name='form.button.Publish']");
|
||||||
|
publish_button.trigger('click');
|
||||||
|
equals($("#1285339036601284").attr("name", "form.button.Publish").length, 0, "The comment row should have been removed since the comment has been published.");
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user