@@ -1340,4 +1340,22 RAW | |||||
1340 | ensure |
|
1340 | ensure | |
1341 | Redmine::Utils.relative_url_root = '' |
|
1341 | Redmine::Utils.relative_url_root = '' | |
1342 | end |
|
1342 | end | |
|
1343 | ||||
|
1344 | def test_truncate_single_line | |||
|
1345 | str = "01234" | |||
|
1346 | result = truncate_single_line("#{str}\n#{str}", :length => 10) | |||
|
1347 | assert_equal "01234 0...", result | |||
|
1348 | assert !result.html_safe? | |||
|
1349 | result = truncate_single_line("#{str}<&#>\n#{str}\n#{str}", :length => 15) | |||
|
1350 | assert_equal "01234<&#> 01...", result | |||
|
1351 | assert !result.html_safe? | |||
|
1352 | end | |||
|
1353 | ||||
|
1354 | def test_truncate_single_line_non_ascii | |||
|
1355 | ja = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e" | |||
|
1356 | ja.force_encoding('UTF-8') if ja.respond_to?(:force_encoding) | |||
|
1357 | result = truncate_single_line("#{ja}\n#{ja}\n#{ja}", :length => 10) | |||
|
1358 | assert_equal "#{ja} #{ja}...", result | |||
|
1359 | assert !result.html_safe? | |||
|
1360 | end | |||
1343 | end |
|
1361 | end |
General Comments 0
You need to be logged in to leave comments.
Login now