ref: master
test/unit/block_helper_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
require_relative "../test_helper" class BlockHelperTest < ActiveSupport::TestCase include BlockHelper include ActionView::Helpers::TagHelper should 'escape title html' do assert_no_match /<b>/, block_title(unsafe('<b>test</b>')) assert_match /<b>test<\/b>/, block_title(unsafe('<b>test</b>')) end should 'escape subtitle html' do assert_no_match /<b>/, block_title('', unsafe('<b>test</b>')) assert_match /<b>test<\/b>/, block_title('', unsafe('<b>test</b>')) end should 'add "empty" class to blank subtitles tag' do assert_match "block-subtitle empty", block_title('', '') end end |