picturefill 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f358326a54756fd9ae56464c2fe1503747082312
4
- data.tar.gz: 822ccf1d5e60b5bf3488cf3495958a8b5b97e59c
3
+ metadata.gz: 036e94741bab99b8366646063e27e00302e1b0bb
4
+ data.tar.gz: f4dacf2b273bbe09cdb4478433e130cca9040296
5
5
  SHA512:
6
- metadata.gz: a34faf9ecac107a4bbbf06534ebe5c3b090e82538b0a450dbbee3de1bcfd83a83025b17b892c6111a491a7236eebc489220221c834255693a7afc98b72d986ab
7
- data.tar.gz: bb5e642f3091493e4cd060a073491d18daa5836bdd1fa0716ff67b062e950df226aa4cec650491e82db3cf55de3ca569a43c79477cdb06430a36163dd3c49c2e
6
+ metadata.gz: 70ac064988cceef78b90232a7d55bd0bb5e4d0db671eba82f3786251c360353cd3dc7d64ff00fccc52809ea3aa9120f0e4bf9a355f613727cf03cfa8ed4dff22
7
+ data.tar.gz: 65d21274523693acbc1a5b1182df9d27ee1d168e08c2b9aeb032072bd7eee90cfbb087c2a52beba1588038d0a86b4203e59adc78dfbabc0ff160083493eaf49e
@@ -35,12 +35,15 @@ module Picturefill
35
35
  ratio = options.delete :ratio
36
36
  media = options.delete :media
37
37
 
38
+ webkit = options.delete :webkit
39
+ ratio_attribute = webkit ? "-webkit-min-device-pixel-ratio" : "min-device-pixel-ratio"
40
+
38
41
  min = "(min-width: #{min}px)" if min
39
42
  ratio = case ratio
40
43
  when Float
41
- "(min-device-pixel-ratio: #{ratio})"
44
+ "(#{ratio_attribute}: #{ratio})"
42
45
  when Integer
43
- "(min-device-pixel-ratio: %.1f)" % ratio
46
+ "(#{ratio_attribute}: %.1f)" % ratio
44
47
  when nil
45
48
  else
46
49
  raise ArgumentError.new("Only Float && Integer allowed")
@@ -1,3 +1,3 @@
1
1
  module Picturefill
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -78,6 +78,14 @@ describe Picturefill::Rails::ViewHelper do
78
78
  end
79
79
  end
80
80
 
81
+ context "when given :ratio and :webkit => true" do
82
+ subject { setup_image("small.jpg", :ratio => 2, :webkit => true) }
83
+
84
+ it "renders data-media with -webkit-device-ratio" do
85
+ subject.should include('data-media="(-webkit-min-device-pixel-ratio: 2.0)')
86
+ end
87
+ end
88
+
81
89
 
82
90
  context "when given :ratio as float" do
83
91
  subject { setup_image("small.jpg", :ratio => 2.42) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picturefill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Helm