98 |
98 |
assert_equal "foo bar", field.format.formatted_custom_value(self, custom_value, false)
|
99 |
99 |
assert_equal '<a class="external" href="http://foo/foo%20bar#anchor">foo bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
100 |
100 |
end
|
|
101 |
|
|
102 |
def test_edit_tag_should_display_wikitoolbar_if_text_formatting_enabled
|
|
103 |
field = ProjectCustomField.new(:field_format => 'text', :text_formatting => 'full')
|
|
104 |
custom_value = CustomValue.new(:custom_field => field, :customized => Project.first, :value => "foo bar")
|
|
105 |
edit_tag = field.format.edit_tag(self, "tag_id", "tag_name", custom_value)
|
|
106 |
|
|
107 |
assert_includes edit_tag, "<textarea name=\"tag_name\" id=\"tag_id\" rows=\"8\" class=\"wiki-edit\">\nfoo bar</textarea>"
|
|
108 |
assert_includes edit_tag, wikitoolbar_for('tag_id', preview_text_url)
|
|
109 |
end
|
|
110 |
|
|
111 |
def test_edit_tag_should_not_display_wikitoolbar_if_text_formatting_disabled
|
|
112 |
field = ProjectCustomField.new(:field_format => 'text', :text_formatting => nil)
|
|
113 |
custom_value = CustomValue.new(:custom_field => field, :customized => Project.first, :value => "foo bar")
|
|
114 |
edit_tag = field.format.edit_tag(self, "tag_id", "tag_name", custom_value)
|
|
115 |
|
|
116 |
assert_includes edit_tag, "<textarea name=\"tag_name\" id=\"tag_id\" rows=\"8\">\nfoo bar</textarea>"
|
|
117 |
assert_not_includes edit_tag, wikitoolbar_for('tag_id', preview_text_url)
|
|
118 |
end
|
|
119 |
|
|
120 |
def test_edit_tag_should_not_display_wikitoolbar_if_the_field_is_not_full_width_layout
|
|
121 |
field = IssueCustomField.new(:field_format => 'text', :full_width_layout => nil, :text_formatting => 'full')
|
|
122 |
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.first, :value => "foo bar")
|
|
123 |
edit_tag = field.format.edit_tag(self, "tag_id", "tag_name", custom_value)
|
|
124 |
|
|
125 |
assert_includes edit_tag, "<textarea name=\"tag_name\" id=\"tag_id\" rows=\"8\">\nfoo bar</textarea>"
|
|
126 |
assert_not_includes edit_tag, wikitoolbar_for('tag_id', preview_text_url)
|
|
127 |
end
|
|
128 |
|
|
129 |
def test_edit_tag_should_display_wikitoolbar_if_the_field_is_full_width_layout
|
|
130 |
field = IssueCustomField.new(:field_format => 'text', :full_width_layout => '1', :text_formatting => 'full')
|
|
131 |
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.first, :value => "foo bar")
|
|
132 |
edit_tag = field.format.edit_tag(self, "tag_id", "tag_name", custom_value)
|
|
133 |
|
|
134 |
assert_includes edit_tag, "<textarea name=\"tag_name\" id=\"tag_id\" rows=\"8\" class=\"wiki-edit\">\nfoo bar</textarea>"
|
|
135 |
assert_includes edit_tag, wikitoolbar_for('tag_id', preview_issue_url(:project_id => Issue.first.project.id, :issue_id => Issue.first.id))
|
|
136 |
end
|
101 |
137 |
end
|