quickdraw/compilation_equivalence_cases/animation_references.rb

Lines

0%

0 of 24 covered

Branches

—

0 of 0 covered

Methods

0%

0 of 3 covered

Not run
3-47-821-2327-2831-45
Never called
1# frozen_string_literal: true
2
30module EquivalenceCases
40 module AnimationReferences
5 # SVG animation values are references, and `values` is a list whose later
6 # entries can be script URLs whatever the literal prefix is.
70 class AnimationReferences < Phlex::SVG
80 VALUES = [
9 "#b",
10 "javascript:alert(1)",
11 ";javascript:alert(1)",
12 "&#59;javascript:alert(1)",
13 "&semi;javascript:alert(1)",
14 "&zz;javascript:alert(1)",
15 "&TAB;javascript:alert(1)",
16 "&#38;zz;javascript:alert(1)",
17 "0;10",
18 %(say "<hi>"),
19 ].freeze
20
210 def self.equivalence_scenarios
220 VALUES.each_with_index.to_h do |value, index|
230 ["value #{index}", -> (klass) { klass.new(value).call }]
24 end
25 end
26
270 def initialize(value)
280 @value = value
29 end
30
310 def view_template
320 svg do
330 a(href: "#a") do
340 set(attributeName: "href", to: @value)
350 set(attributeName: "href", to: "#a#{@value}")
360 animate(attributeName: "href", from: "#a#{@value}", to: "#b")
370 animate(attributeName: "href", by: @value)
380 animate(attributeName: "href", values: @value)
390 animate(attributeName: "href", values: "#a#{@value}")
400 animate(attributeName: "href", values: "#a;#{@value}")
410 animate(attributeName: "href", "values" => "#a#{@value}")
420 animate(attributeName: "href", values: [@value, "#a"])
430 animate(attributeName: "href", values: "#a;#b")
440 a("x:href": @value, "x:to": "#a#{@value}")
450 text { "x" }
46 end
47 end
48 end
49 end
50 end
51end