quickdraw/compilation_equivalence_cases/dynamic_tag_exceptions.rb
Lines
100%18 of 18 covered
Branches
—0 of 0 covered
Methods
100%2 of 2 covered
| 1 | # frozen_string_literal: true | |
| 2 | ||
| 3 | 1 | module EquivalenceCases |
| 4 | 1 | module DynamicTagExceptions |
| 5 | 1 | class HTML < Phlex::HTML |
| 6 | 1 | def view_template |
| 7 | 3 | [:div, :custom_tag, :svg].each do |name| |
| 8 | 9 | [{}, { id: "example" }].each do |attributes| |
| 9 | begin | |
| 10 | 18 | tag(name, **attributes) do |content| |
| 11 | 18 | content.plain "before" |
| 12 | 18 | raise "example" |
| 13 | end | |
| 14 | rescue RuntimeError | |
| 15 | 36 | span { "after" } |
| 16 | end | |
| 17 | end | |
| 18 | end | |
| 19 | end | |
| 20 | end | |
| 21 | ||
| 22 | 1 | class SVG < Phlex::SVG |
| 23 | 1 | def view_template |
| 24 | 3 | [:g, :custom_tag].each do |name| |
| 25 | 6 | [{}, { id: "example" }].each do |attributes| |
| 26 | begin | |
| 27 | 12 | tag(name, **attributes) do |content| |
| 28 | 12 | content.plain "before" |
| 29 | 12 | raise "example" |
| 30 | end | |
| 31 | rescue RuntimeError | |
| 32 | 24 | text { "after" } |
| 33 | end | |
| 34 | end | |
| 35 | end | |
| 36 | end | |
| 37 | end | |
| 38 | end | |
| 39 | end |