Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep data uri (inlined images) #136

Open
koszta opened this issue Sep 4, 2012 · 0 comments
Open

Keep data uri (inlined images) #136

koszta opened this issue Sep 4, 2012 · 0 comments

Comments

@koszta
Copy link

koszta commented Sep 4, 2012

This test results in

Expected /data:image\/png;base64,/ to match "background-color: #92c000;".
def test_keeping_background_image_data_uri
    html = <<END_HTML
    <html>
    <style type="text/css">
      #page { background: #92c000 url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcCAYAAACgXdXMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAB50RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNS4xqx9I6wAAABV0RVh0Q3JlYXRpb24gVGltZQA3LzE3LzEyi2pdoAAAADFJREFUCJljWH7D9D/T////GJgY/v9jgLD+M/xnwBCDExAxBjSx/yjqGPDqRShGUQcAAJVIjE2nuX4AAAAASUVORK5CYII=') repeat-x 0 0; }
    </style>
    <body>
      <div id='page'><p>test</p></div>
    </body>
    </html>
END_HTML

    premailer = Premailer.new(html, :with_html_string => true)
    premailer.to_inline_css
    assert_match /data:image\/png;base64,/, premailer.processed_doc.search('#page').first.attributes['style'].to_s
  end

If i change it to

background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcCAYAAACgXdXMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAAB50RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNS4xqx9I6wAAABV0RVh0Q3JlYXRpb24gVGltZQA3LzE3LzEyi2pdoAAAADFJREFUCJljWH7D9D/T////GJgY/v9jgLD+M/xnwBCDExAxBjSx/yjqGPDqRShGUQcAAJVIjE2nuX4AAAAASUVORK5CYII=');
Expected /data:image\/png;base64,/ to match "background-image: url('data:image/png;".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant