0
0
Fork 0

Add test coverage to CSS class generation (#2285)

The code that generates CSS is based on a lot of boolean conditions.
The possible combinations of these grows exponentially as we add more
conditions.

Since most of the code is conditional on a single boolean, we tested the
following:

1. All `false`
2. All `true`
3. Each individual flag set to `true`

The methods tested are:

* `StreamEntriesHelper#style_classes`
* `StreamEntriesHelper#microformats_classes`
* `StreamEntriesHelper#microformats_h_class`
This commit is contained in:
Joël Quenneville 2017-04-23 00:04:32 -04:00 committed by Eugen
parent 6f0b3b069f
commit 0c2fe22bc1
2 changed files with 132 additions and 3 deletions

View file

@ -31,9 +31,13 @@ module StreamEntriesHelper
end
def microformats_h_class(status, is_predecessor, is_successor, include_threads)
return 'h-cite' if is_predecessor || status.reblog || is_successor
return 'h-entry' unless include_threads
''
if is_predecessor || status.reblog? || is_successor
'h-cite'
elsif include_threads
''
else
'h-entry'
end
end
def rtl?(text)