mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 05:11:20 +08:00
FIX: allowes forcing timezone displayed in local-dates
Use case being you might want to always display a specific timezone, but still have the possibility to show the tooltip with various timezones.
This commit is contained in:

committed by
Guo Xiang Tan

parent
33541c4096
commit
4b3c2490c3
@ -1,20 +1,6 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe PrettyText do
|
||||
it 'supports inserting date' do
|
||||
freeze_time
|
||||
cooked = PrettyText.cook <<~MD
|
||||
[date=2018-05-08 time=22:00 format="L LTS" timezones="Europe/Paris|America/Los_Angeles"]
|
||||
MD
|
||||
|
||||
expect(cooked).to include('class="discourse-local-date"')
|
||||
expect(cooked).to include('data-date="2018-05-08"')
|
||||
expect(cooked).to include('data-format="L LTS"')
|
||||
expect(cooked).to include('data-timezones="Europe/Paris|America/Los_Angeles"')
|
||||
expect(cooked).to include('05/08/2018 3:00:00 PM (America: Los Angeles)')
|
||||
expect(cooked).to include('05/09/2018 12:00:00 AM (Europe: Paris)')
|
||||
end
|
||||
|
||||
it 'uses a simplified syntax in emails' do
|
||||
freeze_time
|
||||
cooked = PrettyText.cook <<~MD
|
||||
@ -26,12 +12,4 @@ describe PrettyText do
|
||||
|
||||
expect(PrettyText.format_for_email(cooked)).to match_html(cooked_mail)
|
||||
end
|
||||
|
||||
it 'needs attributes to convert to a local date' do
|
||||
cooked = PrettyText.cook <<~MD
|
||||
[date]
|
||||
MD
|
||||
|
||||
expect(cooked).to include("<p>[date]</p>")
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user