quickdraw/compilation_equivalence_cases/fragments.rb
Lines
100%24 of 24 covered
Branches
—0 of 0 covered
Methods
100%8 of 8 covered
| 1 | # frozen_string_literal: true | |
| 2 | ||
| 3 | 1 | module EquivalenceCases |
| 4 | 1 | module Fragments |
| 5 | 1 | class Fragments < Phlex::HTML |
| 6 | 3 | def self.equivalence_scenarios = { "id only" => -> (klass) { klass.new.call(fragments: ["id"]) } } |
| 7 | ||
| 8 | 1 | def view_template |
| 9 | 8 | div { "before" } |
| 10 | 12 | fragment("id") { div { "x" } } |
| 11 | 6 | div { "after" } |
| 12 | end | |
| 13 | end | |
| 14 | ||
| 15 | 1 | class InHelper < Phlex::HTML |
| 16 | 3 | def self.equivalence_scenarios = { "id only" => -> (klass) { klass.new.call(fragments: ["id"]) } } |
| 17 | ||
| 18 | 1 | def view_template |
| 19 | 8 | div { "before" } |
| 20 | 4 | part |
| 21 | 6 | div { "after" } |
| 22 | end | |
| 23 | ||
| 24 | 1 | def part |
| 25 | 12 | fragment("id") { div { "in helper" } } |
| 26 | end | |
| 27 | end | |
| 28 | ||
| 29 | 1 | class DynamicContent < Phlex::HTML |
| 30 | 3 | def self.equivalence_scenarios = { "id only" => -> (klass) { klass.new.call(fragments: ["id"]) } } |
| 31 | ||
| 32 | 1 | def initialize |
| 33 | 8 | @x = "dyn" |
| 34 | end | |
| 35 | ||
| 36 | 1 | def view_template |
| 37 | 8 | div { @x } |
| 38 | 12 | fragment("id") { div { @x } } |
| 39 | 6 | div { @x } |
| 40 | end | |
| 41 | end | |
| 42 | end | |
| 43 | end |