summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-02-27 17:17:57 -0800
committerStan Hu <stanhu@gmail.com>2015-03-10 08:11:20 -0700
commit4218a2bfcf7a3f864268c3eafe8ead28bb7808d8 (patch)
treed3860750b344916b1461386ac68990d8d42f439c /spec/helpers
parent332413d7c4003c3718f8d91c54d7f3410710a5f9 (diff)
downloadgitlab-ce-4218a2bfcf7a3f864268c3eafe8ead28bb7808d8.tar.gz
Fix code preview theme setting for comments, issues, merge requests, and snippets.
Also preserve code preview color scheme in events dashboard. Assign default colors to all code blocks shown as <pre class="code highlight [color_scheme]"> Closes #1139
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/events_helper_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/helpers/events_helper_spec.rb b/spec/helpers/events_helper_spec.rb
index c4a192ac1aa..b392371deb4 100644
--- a/spec/helpers/events_helper_spec.rb
+++ b/spec/helpers/events_helper_spec.rb
@@ -4,6 +4,8 @@ describe EventsHelper do
include ApplicationHelper
include GitlabMarkdownHelper
+ let(:current_user) { create(:user, email: "current@email.com") }
+
it 'should display one line of plain text without alteration' do
input = 'A short, plain note'
expect(event_note(input)).to match(input)
@@ -50,4 +52,14 @@ describe EventsHelper do
expect(event_note(input)).to match(link_url)
expect(event_note(input)).to match(expected_link_text)
end
+
+ it 'should preserve code color scheme' do
+ input = "```ruby\ndef test\n 'hello world'\nend\n```"
+ expected = '<pre class="code highlight white ruby">' \
+ "<code><span class=\"k\">def</span> <span class=\"nf\">test</span>\n" \
+ " <span class=\"s1\">\'hello world\'</span>\n" \
+ "<span class=\"k\">end</span>\n" \
+ '</code></pre>'
+ expect(event_note(input)).to eq(expected)
+ end
end