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 +4 -4
- data/lib/picturefill/context.rb +5 -2
- data/lib/picturefill/version.rb +1 -1
- data/spec/picturefill/view_helper_spec.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 036e94741bab99b8366646063e27e00302e1b0bb
|
4
|
+
data.tar.gz: f4dacf2b273bbe09cdb4478433e130cca9040296
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70ac064988cceef78b90232a7d55bd0bb5e4d0db671eba82f3786251c360353cd3dc7d64ff00fccc52809ea3aa9120f0e4bf9a355f613727cf03cfa8ed4dff22
|
7
|
+
data.tar.gz: 65d21274523693acbc1a5b1182df9d27ee1d168e08c2b9aeb032072bd7eee90cfbb087c2a52beba1588038d0a86b4203e59adc78dfbabc0ff160083493eaf49e
|
data/lib/picturefill/context.rb
CHANGED
@@ -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
|
-
"(
|
44
|
+
"(#{ratio_attribute}: #{ratio})"
|
42
45
|
when Integer
|
43
|
-
"(
|
46
|
+
"(#{ratio_attribute}: %.1f)" % ratio
|
44
47
|
when nil
|
45
48
|
else
|
46
49
|
raise ArgumentError.new("Only Float && Integer allowed")
|
data/lib/picturefill/version.rb
CHANGED
@@ -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) }
|