diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-07-02 05:47:18 +0200 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-07-15 12:32:43 +0200 |
commit | 922ca232988b90b7a4fb5918bb76c383c90fd770 (patch) | |
tree | 4e9e33c3e10744d331b56fa4f6b1e30d410be104 /test/web/mastodon_api | |
parent | bfe2dafd398114240fcc2d3472799d6770904f6a (diff) | |
download | pleroma-922ca232988b90b7a4fb5918bb76c383c90fd770.tar.gz pleroma-922ca232988b90b7a4fb5918bb76c383c90fd770.zip |
Question: Add tests on HTML tags in options
Closes: https://git.pleroma.social/pleroma/pleroma/-/issues/1362
Diffstat (limited to 'test/web/mastodon_api')
-rw-r--r-- | test/web/mastodon_api/views/poll_view_test.exs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/web/mastodon_api/views/poll_view_test.exs b/test/web/mastodon_api/views/poll_view_test.exs index 76672f36c..b7e2f17ef 100644 --- a/test/web/mastodon_api/views/poll_view_test.exs +++ b/test/web/mastodon_api/views/poll_view_test.exs @@ -135,4 +135,33 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do assert result[:expires_at] == nil assert result[:expired] == false end + + test "doesn't strips HTML tags" do + user = insert(:user) + + {:ok, activity} = + CommonAPI.post(user, %{ + status: "What's with the smug face?", + poll: %{ + options: [ + "<input type=\"date\">", + "<input type=\"date\" >", + "<input type=\"date\"/>", + "<input type=\"date\"></input>" + ], + expires_in: 20 + } + }) + + object = Object.normalize(activity) + + assert %{ + options: [ + %{title: "<input type=\"date\">", votes_count: 0}, + %{title: "<input type=\"date\" >", votes_count: 0}, + %{title: "<input type=\"date\"/>", votes_count: 0}, + %{title: "<input type=\"date\"></input>", votes_count: 0} + ] + } = PollView.render("show.json", %{object: object}) + end end |