mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 20:43:40 +08:00
946f25098f
This paves the way to allowing themes to specify uploads and so on.
31 lines
764 B
Ruby
31 lines
764 B
Ruby
# encoding: utf-8
|
|
|
|
require 'rails_helper'
|
|
|
|
describe ThemeField do
|
|
it "correctly generates errors for transpiled js" do
|
|
html = <<HTML
|
|
<script type="text/discourse-plugin" version="0.8">
|
|
badJavaScript(;
|
|
</script>
|
|
HTML
|
|
field = ThemeField.create!(theme_id: 1, target_id: 0, name: "header", value: html)
|
|
expect(field.error).not_to eq(nil)
|
|
field.value = ""
|
|
field.save!
|
|
expect(field.error).to eq(nil)
|
|
end
|
|
|
|
it "correctly generates errors for transpiled css" do
|
|
css = "body {"
|
|
field = ThemeField.create!(theme_id: 1, target_id: 0, name: "scss", value: css)
|
|
field.reload
|
|
expect(field.error).not_to eq(nil)
|
|
field.value = "body {color: blue};"
|
|
field.save!
|
|
field.reload
|
|
|
|
expect(field.error).to eq(nil)
|
|
end
|
|
end
|