chunky_css 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chunky_css/version.rb +1 -1
- data/lib/chunky_css.rb +1 -1
- data/spec/chunky_css_spec.rb +22 -21
- data/spec/fixtures/simple-compressed.css +1 -0
- metadata +3 -1
data/lib/chunky_css/version.rb
CHANGED
data/lib/chunky_css.rb
CHANGED
data/spec/chunky_css_spec.rb
CHANGED
@@ -5,34 +5,35 @@ def fixture(fname)
|
|
5
5
|
end
|
6
6
|
|
7
7
|
describe ChunkyCSS::Splitter do
|
8
|
-
|
9
|
-
|
8
|
+
%w(simple.css simple-compressed.css).each do |css_file|
|
9
|
+
context css_file do
|
10
|
+
splitter = ChunkyCSS::Splitter.new(fixture(css_file))
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
expectations = {
|
16
|
-
"all" => [1,2,7],
|
17
|
-
"screen" => [3,4],
|
18
|
-
"screen and (max-width: 100px)" => [5,6]
|
19
|
-
}
|
20
|
-
|
21
|
-
expectations.keys.each do |media|
|
22
|
-
it "has a '#{media}' entry" do
|
23
|
-
splitter.media.should include(media)
|
12
|
+
it "has 3 media queries" do
|
13
|
+
splitter.media.length.should eq(3)
|
24
14
|
end
|
25
15
|
|
26
|
-
|
27
|
-
|
16
|
+
expectations = {
|
17
|
+
"all" => [1,2,7],
|
18
|
+
"screen" => [3,4],
|
19
|
+
"screen and (max-width: 100px)" => [5,6]
|
20
|
+
}
|
21
|
+
|
22
|
+
expectations.keys.each do |media|
|
23
|
+
it "has a '#{media}' entry" do
|
24
|
+
splitter.media.should include(media)
|
25
|
+
end
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
context "css for @media '#{media}'" do
|
28
|
+
css = splitter.css_for_media(media)
|
29
|
+
|
30
|
+
expectations[media].each do |rule_number|
|
31
|
+
it "contains css rule for .rule#{rule_number}" do
|
32
|
+
css.should include(".rule#{rule_number}")
|
33
|
+
end
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
36
|
-
|
37
38
|
end
|
38
39
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
.rule1{color: red;}.rule2{color: red;}@media screen{.rule3{color: green;}.rule4{color: green;}}@media screen and (max-width: 100px){.rule5{color: blue;}.rule6{color: blue;}}.rule7{color: red;}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chunky_css
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/chunky_css.rb
|
45
45
|
- lib/chunky_css/version.rb
|
46
46
|
- spec/chunky_css_spec.rb
|
47
|
+
- spec/fixtures/simple-compressed.css
|
47
48
|
- spec/fixtures/simple.css
|
48
49
|
homepage: https://github.com/kwltrs/chunky_css
|
49
50
|
licenses: []
|
@@ -71,5 +72,6 @@ specification_version: 3
|
|
71
72
|
summary: Splits css into chunks by @media
|
72
73
|
test_files:
|
73
74
|
- spec/chunky_css_spec.rb
|
75
|
+
- spec/fixtures/simple-compressed.css
|
74
76
|
- spec/fixtures/simple.css
|
75
77
|
has_rdoc:
|