diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/models/helpers/events_helper_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/models/helpers/events_helper_test.rb b/test/models/helpers/events_helper_test.rb index 2e7567e..0486b3e 100644 --- a/test/models/helpers/events_helper_test.rb +++ b/test/models/helpers/events_helper_test.rb | |||
| @@ -1,4 +1,25 @@ | |||
| 1 | require 'test_helper' | 1 | require 'test_helper' |
| 2 | 2 | ||
| 3 | class EventsHelperTest < ActionView::TestCase | 3 | class EventsHelperTest < ActionView::TestCase |
| 4 | test "rrule_with_break_opportunities inserts a break opportunity after each semicolon" do | ||
| 5 | result = rrule_with_break_opportunities("FREQ=MONTHLY;BYMONTH=1,2,3;BYDAY=-1TH") | ||
| 6 | assert_equal "FREQ=MONTHLY;<wbr>BYMONTH=1,2,3;<wbr>BYDAY=-1TH", result | ||
| 7 | assert result.html_safe? | ||
| 8 | end | ||
| 9 | |||
| 10 | test "rrule_with_break_opportunities escapes HTML-significant characters" do | ||
| 11 | result = rrule_with_break_opportunities("FREQ=WEEKLY;BYDAY=<script>") | ||
| 12 | assert_no_match /<script>/, result | ||
| 13 | assert_match "<script>", result | ||
| 14 | end | ||
| 15 | |||
| 16 | test "rrule_with_break_opportunities returns an empty string for blank input" do | ||
| 17 | assert_equal "", rrule_with_break_opportunities(nil) | ||
| 18 | assert_equal "", rrule_with_break_opportunities("") | ||
| 19 | end | ||
| 20 | |||
| 21 | test "rrule_with_break_opportunities preserves a trailing semicolon" do | ||
| 22 | result = rrule_with_break_opportunities("FREQ=WEEKLY;") | ||
| 23 | assert_equal "FREQ=WEEKLY;<wbr>", result | ||
| 24 | end | ||
| 4 | end | 25 | end |
