mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 23:07:28 +08:00
FEATURE: Allow selection of highlight js languages
PERF: stop loading highlight js on load To get latest highlight js run bin/rake highlightjs:update
This commit is contained in:
23
spec/components/highlight_js/highlight_js_spec.rb
Normal file
23
spec/components/highlight_js/highlight_js_spec.rb
Normal file
@ -0,0 +1,23 @@
|
||||
require 'spec_helper'
|
||||
require_dependency 'highlight_js/highlight_js'
|
||||
|
||||
describe HighlightJs do
|
||||
it 'can list languages' do
|
||||
HighlightJs.languages.should include('thrift')
|
||||
end
|
||||
|
||||
it 'can generate a packed bundle' do
|
||||
bundle = HighlightJs.bundle(["thrift", "http"])
|
||||
bundle.should =~ /thrift/
|
||||
bundle.should =~ /http/
|
||||
bundle.should_not =~ /applescript/
|
||||
end
|
||||
|
||||
|
||||
it 'can get a version string' do
|
||||
version1 = HighlightJs.version("http|cpp")
|
||||
version2 = HighlightJs.version("rust|cpp|fake")
|
||||
|
||||
version1.should_not == version2
|
||||
end
|
||||
end
|
@ -304,4 +304,8 @@ describe PrettyText do
|
||||
expect(PrettyText.cook("***\\****a")).to match_html("<p><strong><em>*</em></strong>a</p>")
|
||||
end
|
||||
|
||||
it 'can include code class correctly' do
|
||||
expect(PrettyText.cook("```cpp\ncpp\n```")).to match_html("<p></p><pre><code class='lang-cpp'>cpp</code></pre>")
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user