#= require ultimate/underscore/underscore #= require ultimate/underscore/underscore.string #= require ultimate/helpers/asset_tag module "Ultimate.Helpers.AssetTag" _.extend @, Ultimate.Helpers.AssetTag test "favicon_link_tag", -> equal favicon_link_tag(), '' equal favicon_link_tag('favicon.ico'), '' equal favicon_link_tag('favicon.ico', rel: 'foo'), '' equal favicon_link_tag('favicon.ico', rel: 'foo', type: 'bar'), '' equal favicon_link_tag('mb-icon.png', rel: 'apple-touch-icon', type: 'image/png'), '' test "image_path", -> equal image_path(""), '' equal image_path("xml"), '/images/xml' equal image_path("xml.png"), '/images/xml.png' equal image_path("dir/xml.png"), '/images/dir/xml.png' equal image_path("/dir/xml.png"), '/dir/xml.png' test "path_to_image", -> equal path_to_image(""), '' equal path_to_image("xml"), '/images/xml' equal path_to_image("xml.png"), '/images/xml.png' equal path_to_image("dir/xml.png"), '/images/dir/xml.png' equal path_to_image("/dir/xml.png"), '/dir/xml.png' test "image_alt", -> for prefix in ['', '/', '/foo/bar/', 'foo/bar/'] equal image_alt("#{prefix}rails.png"), 'Rails' equal image_alt("#{prefix}rails-9c0a079bdd7701d7e729bd956823d153.png"), 'Rails' equal image_alt("#{prefix}avatar-0000.png"), 'Avatar-0000' test "image_tag", -> equal image_tag("xml.png"), 'Xml' equal image_tag("rss.gif", alt: "rss syndication"), 'rss syndication' equal image_tag("gold.png", size: "45x70"), 'Gold' equal image_tag("gold.png", size: "45x70"), 'Gold' equal image_tag("error.png", size: "45"), 'Error' equal image_tag("error.png", size: "45 x 70"), 'Error' equal image_tag("error.png", size: "x"), 'Error' equal image_tag("google.com.png"), 'Google.com' equal image_tag("slash..png"), 'Slash.' equal image_tag(".pdf.png"), '.pdf' equal image_tag("http://www.rubyonrails.com/images/rails.png"), 'Rails' equal image_tag("//www.rubyonrails.com/images/rails.png"), 'Rails' equal image_tag("mouse.png", alt: null), '' equal image_tag("data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==", alt: null), '' equal image_tag(""), ''