diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-03-01 23:57:32 -0700 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2022-03-02 00:21:16 -0700 |
| commit | cabac9c30e660b77e8b87a98587a773defc314c8 (patch) | |
| tree | 21ee779632362ab53e377391fea3036aa14573e6 /test | |
| parent | 84455643df00fa408e1e607afbbb639b8737a827 (diff) | |
add tests for text content model on inline macro
Diffstat (limited to 'test')
| -rw-r--r-- | test/extensions_test.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/extensions_test.rb b/test/extensions_test.rb index 786b5c18..8a2632c1 100644 --- a/test/extensions_test.rb +++ b/test/extensions_test.rb @@ -1270,6 +1270,48 @@ context 'Extensions' do end end + test 'should not parse attributes on custom inline macro when resolve attributes is false' do + input = 'Line is del:[good]great.' + + begin + Asciidoctor::Extensions.register do + inline_macro :del do + match_format :short + resolve_attributes false + process do |parent, _, attrs| + create_inline parent, :quoted, attrs['text'], type: :unquoted, attributes: { 'role' => 'line-through' } + end + end + end + + output = convert_string_to_embedded input + assert_includes output, '<span class="line-through">good</span>' + ensure + Asciidoctor::Extensions.unregister_all + end + end + + test 'should not parse attributes on custom inline macro when content model is text' do + input = 'Line is del:[good]great.' + + begin + Asciidoctor::Extensions.register do + inline_macro :del do + match_format :short + content_model :text + process do |parent, _, attrs| + create_inline parent, :quoted, attrs['text'], type: :unquoted, attributes: { 'role' => 'line-through' } + end + end + end + + output = convert_string_to_embedded input + assert_includes output, '<span class="line-through">good</span>' + ensure + Asciidoctor::Extensions.unregister_all + end + end + test 'should resolve regexp for inline macro lazily' do begin Asciidoctor::Extensions.register do |
