Feature #43259 » 0004-Let-text-formatters-without-toolbar-buttons-render-t.patch
| app/helpers/wiki_toolbar_helper.rb | ||
|---|---|---|
|
# #wiki_textarea_options.
|
||
|
def wiki_toolbar(field_id, preview_url: preview_text_path, &)
|
||
|
field = capture(&)
|
||
|
return field unless Redmine::WikiToolbar.buttons(Setting.text_formatting)
|
||
|
unless Redmine::WikiToolbar.buttons(Setting.text_formatting)
|
||
|
# Text formatters that don't use the toolbar can provide their own editor
|
||
|
return field + wikitoolbar_for(field_id, preview_url).to_s
|
||
|
end
|
||
|
heads_for_wiki_formatter
|
||
|
render(partial: 'wiki_toolbar/toolbar', locals: {field_id: field_id, field: field, preview_url: preview_url})
|
||
| test/helpers/wiki_toolbar_helper_test.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def test_wiki_textarea_tag_should_render_the_editor_of_a_formatter_without_toolbar_buttons
|
||
|
helper = Module.new do
|
||
|
def wikitoolbar_for(field_id, preview_url)
|
||
|
tag.div(:id => "editor-for-#{field_id}")
|
||
|
end
|
||
|
end
|
||
|
Redmine::WikiFormatting.stubs(:helper_for).returns(helper)
|
||
|
html = render_erb("<%= wiki_textarea_tag('notes') %>")
|
||
|
assert_select_in html, 'textarea#notes + div#editor-for-notes'
|
||
|
assert_select_in html, 'div.jstBlock', 0
|
||
|
end
|
||
|
def test_wiki_textarea_tag_should_not_duplicate_the_wiki_edit_class
|
||
|
with_settings :text_formatting => 'textile' do
|
||
|
html = render_erb("<%= wiki_textarea_tag('notes', '', :class => 'wiki-edit other') %>")
|
||