diff --git a/plone/app/discussion/tests/javascripts/test_moderation.html b/plone/app/discussion/tests/javascripts/test_moderation.html new file mode 100644 index 0000000..2494895 --- /dev/null +++ b/plone/app/discussion/tests/javascripts/test_moderation.html @@ -0,0 +1,43 @@ + + + + + plone.app.discussion moderation Test Suite + + + + + + + + + + + + + + + + + +

plone.app.discussion comments Test + Suite

+ +

+ +
+
+ +

+ +
    +
+ + + + + diff --git a/plone/app/discussion/tests/javascripts/test_moderation.js b/plone/app/discussion/tests/javascripts/test_moderation.js new file mode 100644 index 0000000..49755d0 --- /dev/null +++ b/plone/app/discussion/tests/javascripts/test_moderation.js @@ -0,0 +1,72 @@ +/* TEST SETUP */ + +module("comments", { + setup: function () { + //
+ // + // + // + // + // + // + // + //
+ // My comment + // + // + // + //
+ //
+ 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."); +});