aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/text_helper_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+1
|
* modernizes hash syntax in actionviewXavier Noria2016-08-061-79/+79
|
* applies new string literal convention in actionview/testXavier Noria2016-08-061-42/+42
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix sanitizer testsJon Moss2016-01-261-3/+3
| | | | | These tests were failing due to backwards incompatible changes, as apart of the v1.0.3 release of rails-html-sanitizer.
* Pass the current locale to Inflector from the pluralize text helper.Jaime Iniesta2016-01-101-10/+22
| | | | | | | | | | | The pluralize text helper uses the Inflector to determine the plural form. The inflector accepts an optional parameter for the locale, so we can pass it from the text helper to have locale-aware pluralizations on the text helpers level. The pluralize text helper now only accepts 2 positional arguments: `count` and `singular`. Passing `plural` as a positional argument is now deprecated.
* Sometimes you need a specific break sequence while using word wrap and as ↵Mauricio Gomez Aguinaga2015-08-111-0/+4
| | | | | | | | | | today the only option we have is "\n" and is hardcoded. With this change you will be able to specify any break sequence ("\r\n" for example) as an option. adding proper documentation for break_sequence in ActionView::Helpers::TextHelper.word_wrap adding some more documentation for word_wrap custom break sequence and making sure we use new hash syntax
* Allow `pluralize` helper to take a locale.Stefan Daschek2015-07-091-0/+12
| | | | This is already supported in `ActiveSupport::Inflector#pluralize` and `String#pluralize`, so we just forward the locale.
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-1/+0
| | | | onwards.
* Added processing of `nil` to `highlight` helper methodigor042014-09-301-0/+4
|
* All these tests are passing nowRafael Mendonça França2014-07-151-1/+0
|
* Merge pull request #11218 from kaspth/loofah-integrationRafael Mendonça França2014-07-101-0/+3
|\ | | | | | | | | | | | | | | Loofah-integration Conflicts: actionpack/CHANGELOG.md actionview/CHANGELOG.md
| * Extracted one highlight test method and marked it as pending.Timm2014-06-151-0/+3
| |
* | Deal with regex match groups in excerptGareth Rees2014-06-241-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original implementation has bugs if the regex contains a match group. Example: excerpt('This is a beautiful? morning', /\b(beau\w*)\b/i, :radius => 5) Expected: "...is a beautiful? mor..." Actual: "...is a beautifulbeaut..." The original phrase was being converted to a regex and returning the text either side of the phrase as expected: 'This is a beautiful? morning'.split(/beautiful/i, 2) # => ["This is a ", "? morning"] When we have a match with groups the match is returned in the array. Quoting the ruby docs: "If pattern is a Regexp, str is divided where the pattern matches. [...] If pattern contains groups, the respective matches will be returned in the array as well." 'This is a beautiful? morning'.split(/\b(beau\w*)\b/iu, 2) # => ["This is a ", "beautiful", "? morning"] If we assume we want to split on the first match – this fix makes that assumption – we can pass the already assigned `phrase` variable as the place to split (because we already know that a match exists from line 168). Originally spotted by Louise Crow (@crowbot) at https://github.com/mysociety/alaveteli/pull/1557
* | 'TextHelper#highlight' now accepts a block to highlight the matched words.Lucas Mazza2014-06-191-0/+7
| | | | | | | | | | | | | | | | The helper will yield each matched word, and you can use this instead of the ':highlighter' option for more complex replacing logic: highlight('My email is me@work.com', EMAIL_REGEXP) { |m| mail_to(m) } # => 'My email is <a href="mailto:me@work.com">me@work.com</a>'
* | highlight() now accepts regular expressions as well.Jan Szumiec2014-06-191-1/+9
| |
* | excerpt() now accepts regular expression instances as phrases.Jan Szumiec2014-06-191-0/+2
|/
* Merge pull request #13059 from imkmf/cycle-accepts-arrayRafael Mendonça França2013-12-061-0/+7
|\ | | | | | | | | | | | | Cycle object should accept an array Conflicts: actionview/CHANGELOG.md
| * A Cycle object should accept an array and cycle through it as it wouldKristian Freeman2013-12-061-0/+7
| | | | | | | | with a set of comma-separated objects.
* | Fix issue where TextHelper#simple_format was calling missing 'raw' methodMario Visic2013-12-051-0/+5
|/
* More typo fixesAkira Matsuda2013-11-271-1/+1
|
* fix simple_format escapes own output when sanitize is set to truepseidemann2013-11-081-0/+5
|
* Cleanup of excerpt helperPaul Nikitochkin2013-09-061-0/+3
| | | | | * replaced String concatenation by joining * separator has default value to '', even it is nil
* Move template tests from actionpack to actionviewPiotr Sarnacki2013-06-201-0/+467