class Formatter::HtmlFormatter
Public Instance Methods
embed(str_src, str_mime_type, str_label)
click to toggle source
Description : embeds the given input file type to cucumber report Author : Chandra sekaran Arguments :
str_src : relative path of the file str_mime_type : type of file str_label : link text on click of click of which shows the embedded file
# File lib/friendly/cukes/framework/support/html_formatter.rb, line 21 def embed(str_src, str_mime_type, str_label) case str_mime_type when /^image\/(png|gif|jpg|jpeg)/ embed_image(str_src, str_label) when /^text\/plain/ embed_file(str_src, str_label) end end
embed_file(str_src, str_label = "Click to view embedded file")
click to toggle source
Description : embeds the given input file type to cucumber report Author : Chandra sekaran Arguments :
str_src : relative path of the file str_label : link text on click of click of which shows the embedded file
# File lib/friendly/cukes/framework/support/html_formatter.rb, line 48 def embed_file(str_src, str_label = "Click to view embedded file") id = "object_#{Time.now.strftime("%y%m%d%H%M%S")}" @builder.span(:class => 'embed') do |pre| pre << %{<a href="" onclick="o=document.getElementById('#{id}'); o.style.display = (o.style.display == 'none' ? 'block' : 'none');return false">#{str_label}</a><br> <object id="#{id}" data="#{str_src}" type="text/plain" width="100%" style="height: 10em;display: none"></object>} end end
embed_link(str_src, str_label)
click to toggle source
Description : embeds a link with the given input string Author : Chandra sekaran Arguments :
str_src : relative path of the file str_label : link text
# File lib/friendly/cukes/framework/support/html_formatter.rb, line 36 def embed_link(str_src, str_label) @builder.span(:class => 'embed') do |pre| pre << %{<a href="#{str_src}" target="_blank">"#{str_label}"</a> } end end