|
9 | 9 | it 'should not fail if theme data is empty' do
|
10 | 10 | theme = subject.new.load ''
|
11 | 11 | (expect theme).not_to be_nil
|
12 |
| - (expect theme).to be_an OpenStruct |
| 12 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
13 | 13 | (expect theme.to_h).to be_empty
|
14 | 14 | end
|
15 | 15 |
|
16 | 16 | it 'should not fail if theme data is falsy' do
|
17 | 17 | theme = subject.new.load false
|
18 | 18 | (expect theme).not_to be_nil
|
19 |
| - (expect theme).to be_an OpenStruct |
| 19 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
20 | 20 | (expect theme.to_h).to be_empty
|
21 | 21 | end
|
22 | 22 |
|
23 | 23 | # NOTE: this API is not used by the converter
|
24 | 24 | it 'should use specified theme data if raw theme data is nil' do
|
25 |
| - theme_data = OpenStruct.new |
| 25 | + theme_data = Asciidoctor::PDF::ThemeData.new |
26 | 26 | theme_data.base_font_color = '222222'
|
27 | 27 | theme = subject.new.load nil, theme_data
|
28 | 28 | (expect theme).to be theme_data
|
29 | 29 | end
|
30 | 30 |
|
31 |
| - it 'should store flattened keys in OpenStruct' do |
| 31 | + it 'should store flattened keys in Asciidoctor::PDF::ThemeData' do |
32 | 32 | theme_data = YAML.safe_load <<~'END'
|
33 | 33 | page:
|
34 | 34 | size: A4
|
|
41 | 41 | font_style: bold
|
42 | 42 | END
|
43 | 43 | theme = subject.new.load theme_data
|
44 |
| - (expect theme).to be_an OpenStruct |
| 44 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
45 | 45 | (expect theme).to respond_to :page_size
|
46 | 46 | (expect theme).to respond_to :base_font_family
|
47 | 47 | (expect theme).to respond_to :base_border_width
|
|
62 | 62 | size: 24
|
63 | 63 | END
|
64 | 64 | theme = subject.new.load theme_data
|
65 |
| - (expect theme).to be_an OpenStruct |
| 65 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
66 | 66 | (expect theme.admonition_icon_tip).to be_a Hash
|
67 | 67 | (expect theme.admonition_icon_tip).to eql name: 'far-lightbulb', stroke_color: 'FFFF00', size: 24
|
68 | 68 | (expect theme.admonition_icon_note).to be_a Hash
|
|
76 | 76 | advice: ~
|
77 | 77 | END
|
78 | 78 | theme = subject.new.load theme_data
|
79 |
| - (expect theme).to be_an OpenStruct |
| 79 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
80 | 80 | (expect theme.admonition_icon_advice).to be_nil
|
81 | 81 | end
|
82 | 82 |
|
|
93 | 93 | stroke-color: FFFF00
|
94 | 94 | END
|
95 | 95 | theme = subject.new.load theme_data
|
96 |
| - (expect theme).to be_an OpenStruct |
| 96 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
97 | 97 | (expect theme).to respond_to :page_size
|
98 | 98 | (expect theme).to respond_to :base_font_family
|
99 | 99 | (expect theme).to respond_to :abstract_title_font_size
|
|
112 | 112 | color: 0000ff
|
113 | 113 | END
|
114 | 114 | theme = subject.new.load theme_data
|
115 |
| - (expect theme).to be_an OpenStruct |
| 115 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
116 | 116 | (expect theme).to respond_to 'role_flaming-red_font_color'
|
117 | 117 | (expect theme['role_flaming-red_font_color']).to eql 'FF0000'
|
118 | 118 | (expect theme).to respond_to 'role_so-very-blue_font_color'
|
|
126 | 126 | font-style: bold
|
127 | 127 | END
|
128 | 128 | theme = subject.new.load theme_data
|
129 |
| - (expect theme).to be_an OpenStruct |
| 129 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
130 | 130 | (expect theme).to respond_to 'role_BOLD_font_style'
|
131 | 131 | (expect theme['role_BOLD_font_style']).to eql 'bold'
|
132 | 132 | end
|
|
148 | 148 | content: 2 * 2
|
149 | 149 | END
|
150 | 150 | theme = subject.new.load theme_data
|
151 |
| - (expect theme).to be_an OpenStruct |
| 151 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
152 | 152 | (expect theme.menu_caret_content).to eql '[">"]'
|
153 | 153 | (expect theme.ulist_marker_disc_content).to eql '0'
|
154 | 154 | (expect theme.footer_recto_left_content).to eql 'true'
|
|
172 | 172 | text-align: $heading-align
|
173 | 173 | END
|
174 | 174 | theme = subject.new.load theme_data
|
175 |
| - (expect theme).to be_an OpenStruct |
| 175 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
176 | 176 | (expect theme.base_align).to be_nil
|
177 | 177 | (expect theme.base_text_align).to eql 'center'
|
178 | 178 | (expect theme.heading_align).to be_nil
|
|
197 | 197 | end: $table-caption-side
|
198 | 198 | END
|
199 | 199 | theme = subject.new.load theme_data
|
200 |
| - (expect theme).to be_an OpenStruct |
| 200 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
201 | 201 | (expect theme.table_caption_side).to be_nil
|
202 | 202 | (expect theme.table_caption_end).to eql 'bottom'
|
203 | 203 | (expect theme.image_caption_end).to eql 'bottom'
|
|
211 | 211 | separator: '-'
|
212 | 212 | END
|
213 | 213 | theme = subject.new.load theme_data
|
214 |
| - (expect theme).to be_an OpenStruct |
| 214 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
215 | 215 | (expect theme.kbd_separator).to be_nil
|
216 | 216 | (expect theme.kbd_separator_content).to eql '-'
|
217 | 217 | end).to log_message severity: :WARN, message: 'the kbd-separator theme key is deprecated; use the kbd-separator-content key instead'
|
|
227 | 227 | item-spacing: $outline_list_item_spacing / 2
|
228 | 228 | END
|
229 | 229 | theme = subject.new.load theme_data
|
230 |
| - (expect theme).to be_an OpenStruct |
| 230 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
231 | 231 | (expect theme.outline_list_item_spacing).to be_nil
|
232 | 232 | (expect theme.list_item_spacing).to eql 6
|
233 | 233 | (expect theme.footnotes_margin_top).to eql theme.list_item_spacing
|
|
245 | 245 | font-color: $blockquote-font-color
|
246 | 246 | END
|
247 | 247 | theme = subject.new.load theme_data
|
248 |
| - (expect theme).to be_an OpenStruct |
| 248 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
249 | 249 | (expect theme.blockquote_font_color).to be_nil
|
250 | 250 | (expect theme.quote_font_color).to eql '4A4A4A'
|
251 | 251 | (expect theme.quote_border_color).to eql theme.quote_font_color
|
|
262 | 262 | font-color: $key-border-color
|
263 | 263 | END
|
264 | 264 | theme = subject.new.load theme_data
|
265 |
| - (expect theme).to be_an OpenStruct |
| 265 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
266 | 266 | (expect theme.key_border_color).to be_nil
|
267 | 267 | (expect theme.kbd_border_color).to eql 'CCCCCC'
|
268 | 268 | (expect theme.kbd_font_color).to eql theme.kbd_border_color
|
|
278 | 278 | font-family: $literal-font-family
|
279 | 279 | END
|
280 | 280 | theme = subject.new.load theme_data
|
281 |
| - (expect theme).to be_an OpenStruct |
| 281 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
282 | 282 | (expect theme.literal_font_family).to be_nil
|
283 | 283 | (expect theme.codespan_font_family).to eql 'M+ 1mn'
|
284 | 284 | (expect theme.verse_font_family).to eql 'M+ 1mn'
|
|
297 | 297 | padding: [6, 12, -6, 14]
|
298 | 298 | END
|
299 | 299 | theme = subject.new.load theme_data
|
300 |
| - (expect theme).to be_an OpenStruct |
| 300 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
301 | 301 | (expect theme.example_padding).to eql [12, 12, 12, 12]
|
302 | 302 | (expect theme.quote_padding).to eql [0, 12, 0, 14]
|
303 | 303 | (expect theme.sidebar_padding).to eql [12, 12, 12, 12]
|
|
310 | 310 | padding: [-3, 12, -3, 14]
|
311 | 311 | END
|
312 | 312 | theme = subject.new.load theme_data
|
313 |
| - (expect theme).to be_an OpenStruct |
| 313 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
314 | 314 | (expect theme.quote_padding).to eql [-3, 12, -3, 14]
|
315 | 315 | end
|
316 | 316 |
|
|
328 | 328 | content: $page_size
|
329 | 329 | END
|
330 | 330 | theme = subject.new.load theme_data
|
331 |
| - (expect theme).to be_an OpenStruct |
| 331 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
332 | 332 | (expect theme.footer_verso_left_content).to eql '2 * 12'
|
333 | 333 | (expect theme.footer_verso_right_content).to eql 'A4'
|
334 | 334 | end
|
|
490 | 490 | describe '.load_file' do
|
491 | 491 | it 'should not fail if theme file is empty' do
|
492 | 492 | theme = subject.load_file fixture_file 'empty-theme.yml'
|
493 |
| - (expect theme).to be_an OpenStruct |
| 493 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
494 | 494 | theme.delete_field :__loaded__
|
495 |
| - (expect theme).to eql OpenStruct.new |
| 495 | + (expect theme).to eql Asciidoctor::PDF::ThemeData.new |
496 | 496 | end
|
497 | 497 |
|
498 | 498 | it 'should not fail if theme file resolves to nil' do
|
499 | 499 | theme = subject.load_file fixture_file 'nil-theme.yml'
|
500 |
| - (expect theme).to be_an OpenStruct |
| 500 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
501 | 501 | theme.delete_field :__loaded__
|
502 |
| - (expect theme).to eql OpenStruct.new |
| 502 | + (expect theme).to eql Asciidoctor::PDF::ThemeData.new |
503 | 503 | end
|
504 | 504 |
|
505 | 505 | it 'should throw error that includes filename and reason if theme is indented using tabs' do
|
|
739 | 739 | it 'should load base theme if theme name is base' do
|
740 | 740 | theme = subject.load_theme 'base'
|
741 | 741 | (expect theme).not_to be_nil
|
742 |
| - (expect theme).to be_an OpenStruct |
| 742 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
743 | 743 | (expect theme.base_font_family).to eql 'Helvetica'
|
744 | 744 | (expect theme.codespan_font_family).to eql 'Courier'
|
745 | 745 | (expect theme).to eql subject.load_base_theme
|
|
748 | 748 | it 'should load default theme if no arguments are given' do
|
749 | 749 | theme = subject.load_theme
|
750 | 750 | (expect theme).not_to be_nil
|
751 |
| - (expect theme).to be_an OpenStruct |
| 751 | + (expect theme).to be_an Asciidoctor::PDF::ThemeData |
752 | 752 | (expect theme.base_font_family).to eql 'Noto Serif'
|
753 | 753 | (expect theme.link_font_color).to eql '428BCA'
|
754 | 754 | end
|
|
0 commit comments