diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2020-08-24 23:39:25 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2020-08-25 00:19:37 -0600 |
| commit | e0b408e80bddffad71dd05d3f8c19db9fd4751b9 (patch) | |
| tree | c66848030777e9940428cf8f8ba0ae3bde69d347 /spec/formatted_text_formatter_spec.rb | |
| parent | 1c331f0eea8629b574ac8c04a2e212d35cae11e3 (diff) | |
follow-up to #1745 to add support for % units as well
Diffstat (limited to 'spec/formatted_text_formatter_spec.rb')
| -rw-r--r-- | spec/formatted_text_formatter_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/formatted_text_formatter_spec.rb b/spec/formatted_text_formatter_spec.rb index 440856fe..3e28de87 100644 --- a/spec/formatted_text_formatter_spec.rb +++ b/spec/formatted_text_formatter_spec.rb @@ -184,6 +184,13 @@ describe Asciidoctor::PDF::FormattedText::Formatter do (expect superscript_text[:font_size]).to eql expected_font_size end + it 'should compute font size for superscript phrase correctly when parent element uses % units' do + pdf = to_pdf '`x^2^` represents exponential growth', pdf_theme: { base_font_size: 14, literal_font_size: '90%' }, analyze: true + expected_font_size = 14 * 0.9 * 0.583 + superscript_text = pdf.find_unique_text '2' + (expect superscript_text[:font_size]).to eql expected_font_size + end + it 'should format subscript phrase' do pdf = to_pdf 'O~2~', analyze: true (expect pdf.strings).to eql %w(O 2) @@ -199,6 +206,13 @@ describe Asciidoctor::PDF::FormattedText::Formatter do (expect subscript_text[:font_size]).to eql expected_font_size end + it 'should compute font size for subscript phrase correctly when parent element uses % units' do + pdf = to_pdf 'The formula `O~2~` is oxygen', pdf_theme: { base_font_size: 14, literal_font_size: '90%' }, analyze: true + expected_font_size = 14 * 0.9 * 0.583 + subscript_text = pdf.find_unique_text '2' + (expect subscript_text[:font_size]).to eql expected_font_size + end + it 'should add background and border to code as defined in theme', visual: true do theme_overrides = { literal_background_color: 'f5f5f5', |
