summaryrefslogtreecommitdiff
path: root/spec/theme_loader_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/theme_loader_spec.rb')
-rw-r--r--spec/theme_loader_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/theme_loader_spec.rb b/spec/theme_loader_spec.rb
index 604a71fa..b9e1a3ee 100644
--- a/spec/theme_loader_spec.rb
+++ b/spec/theme_loader_spec.rb
@@ -592,6 +592,19 @@ describe Asciidoctor::PDF::ThemeLoader do
(expect theme.heading_font_color).to eql theme.base_font_color
end
+ it 'should warn if variable reference cannot be resolved' do
+ (expect do
+ theme_data = SafeYAML.load <<~EOS
+ brand:
+ blue: '0000FF'
+ base:
+ font_color: $brand-red
+ EOS
+ theme = subject.new.load theme_data
+ (expect theme.base_font_color).to eql '$BRAND'
+ end).to log_message severity: :WARN, message: %(unknown variable reference in PDF theme: $brand-red)
+ end
+
it 'should interpolate variables in value' do
theme_data = SafeYAML.load <<~EOS
brand:
@@ -607,6 +620,19 @@ describe Asciidoctor::PDF::ThemeLoader do
(expect theme.heading_font_family).to eql 'Noto Sans'
end
+ it 'should warn if variable reference cannot be resolved when interpolating value' do
+ (expect do
+ theme_data = SafeYAML.load <<~EOS
+ brand:
+ font_family_name: Noto
+ base:
+ font_family: $brand-font-family-name $brand-font-family-variant
+ EOS
+ theme = subject.new.load theme_data
+ (expect theme.base_font_family).to eql 'Noto $brand-font-family-variant'
+ end).to log_message severity: :WARN, message: %(unknown variable reference in PDF theme: $brand-font-family-variant)
+ end
+
it 'should interpolate computed value' do
theme_data = SafeYAML.load <<~EOS
base: