mirror of https://github.com/zulip/zulip.git
markdown: Assert we handle timestamps sensibly in push notifications.
We could certainly do better with the handling here, but using the raw string that the user gave us is okayish for now. Proper formatting of timestamps requires handling locales and timezones of the receiver as well which is a larger project.
This commit is contained in:
parent
78c48935ca
commit
1a9a478e5d
|
@ -726,35 +726,41 @@
|
|||
"name": "timestamp_backend_markdown_only",
|
||||
"input": "<time:Jun 5th 2017, 10:30PM>",
|
||||
"expected_output": "<p><time datetime=\"2017-06-05T22:30:00Z\">Jun 5th 2017, 10:30PM</time></p>",
|
||||
"marked_expected_output": "<p><span>Jun 5th 2017, 10:30PM</span></p>"
|
||||
"marked_expected_output": "<p><span>Jun 5th 2017, 10:30PM</span></p>",
|
||||
"text_content": "Jun 5th 2017, 10:30PM"
|
||||
},
|
||||
{
|
||||
"name": "timestamp_backend_markdown_and_marked",
|
||||
"input": "<time:31 Dec 2017>",
|
||||
"expected_output": "<p><time datetime=\"2017-12-31T00:00:00Z\">31 Dec 2017</time></p>"
|
||||
"expected_output": "<p><time datetime=\"2017-12-31T00:00:00Z\">31 Dec 2017</time></p>",
|
||||
"text_content": "31 Dec 2017"
|
||||
},
|
||||
{
|
||||
"name": "timestamp_invalid_input",
|
||||
"input": "<time:<alert(1)>>",
|
||||
"expected_output": "<p><span class=\"timestamp-error\">Invalid time format: <alert(1)</span>></p>",
|
||||
"marked_expected_output": "<p><span><alert(1)</span>></p>"
|
||||
"marked_expected_output": "<p><span><alert(1)</span>></p>",
|
||||
"text_content": "Invalid time format: <alert(1)>"
|
||||
},
|
||||
{
|
||||
"name": "timestamp_timezone",
|
||||
"input": "<time:31 Dec 2017 5:30 am IST>",
|
||||
"expected_output": "<p><time datetime=\"2017-12-31T00:00:00Z\">31 Dec 2017 5:30 am IST</time></p>",
|
||||
"marked_expected_output": "<p><span>31 Dec 2017 5:30 am IST</span></p>"
|
||||
"marked_expected_output": "<p><span>31 Dec 2017 5:30 am IST</span></p>",
|
||||
"text_content": "31 Dec 2017 5:30 am IST"
|
||||
},
|
||||
{
|
||||
"name": "timestamp_incorrect",
|
||||
"input": "<time:**hello world**>",
|
||||
"expected_output": "<p><span class=\"timestamp-error\">Invalid time format: **hello world**</span></p>",
|
||||
"marked_expected_output": "<p><span>**hello world**</span></p>"
|
||||
"marked_expected_output": "<p><span>**hello world**</span></p>",
|
||||
"text_content": "Invalid time format: **hello world**"
|
||||
},
|
||||
{
|
||||
"name": "timestamp_unix",
|
||||
"input": "<time:1496701800>",
|
||||
"expected_output": "<p><time datetime=\"2017-06-05T22:30:00Z\">1496701800</time></p>"
|
||||
"input": "Let's meet at <time:1496701800>.",
|
||||
"expected_output": "<p>Let's meet at <time datetime=\"2017-06-05T22:30:00Z\">1496701800</time>.</p>",
|
||||
"text_content": "Let's meet at 1496701800."
|
||||
},
|
||||
{
|
||||
"name": "tex_inline",
|
||||
|
|
Loading…
Reference in New Issue