Add option for custom js (like custom css)

* Add a new 'js' flag to indicate you want to embed a file named 'custom.js'
  which should exist at the root of the wiki
This commit is contained in:
Simon Williams
2013-03-14 23:38:53 -06:00
parent fe706c184e
commit 846ebb285e
7 changed files with 38 additions and 1 deletions
+24
View File
@@ -461,6 +461,30 @@ context "Frontend" do
assert_equal 'jkl', author.email
end
test "do not add custom.js by default" do
page = 'nocustom'
text = 'nope none'
@wiki.write_page(page, :markdown, text,
{ :name => 'user1', :email => 'user1' });
get page
assert_no_match /custom.js/, last_response.body
end
test "add custom.js if setting" do
Precious::App.set(:wiki_options, { :js => true })
page = 'yaycustom'
text = 'customized!'
@wiki.write_page(page, :markdown, text,
{ :name => 'user1', :email => 'user1' });
get page
assert_match /custom.js/, last_response.body
Precious::App.set(:wiki_options, { :js => nil })
end
def app
Precious::App
end