styler-sass 0.1.4 → 0.1.5.alpha
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/.travis.yml +3 -0
- data/CHANGELOG.md +17 -2
- data/README.md +1 -2
- data/bin/styler +13 -3
- data/{app/assets/images/.keep → features/support/env.rb} +0 -0
- data/lib/styler/generator.rb +8 -1
- data/lib/styler/version.rb +1 -1
- data/lib/styler.rb +2 -6
- data/spec/bourbon/addons/border_color_spec.rb +51 -0
- data/spec/bourbon/addons/border_radius_spec.rb +25 -0
- data/spec/bourbon/addons/border_style_spec.rb +51 -0
- data/spec/bourbon/addons/border_width_spec.rb +51 -0
- data/spec/bourbon/addons/buttons_spec.rb +53 -0
- data/spec/bourbon/addons/clearfix_spec.rb +18 -0
- data/spec/bourbon/addons/ellipsis_spec.rb +20 -0
- data/spec/bourbon/addons/font_stacks_spec.rb +25 -0
- data/spec/bourbon/addons/hide_text_spec.rb +17 -0
- data/spec/bourbon/addons/margin_spec.rb +51 -0
- data/spec/bourbon/addons/padding_spec.rb +51 -0
- data/spec/bourbon/addons/position_spec.rb +67 -0
- data/spec/bourbon/addons/retina_image_spec.rb +57 -0
- data/spec/bourbon/addons/size_spec.rb +31 -0
- data/spec/bourbon/addons/text_inputs_spec.rb +65 -0
- data/spec/bourbon/addons/triangle_spec.rb +32 -0
- data/spec/bourbon/addons/word_wrap_spec.rb +29 -0
- data/spec/bourbon/css3/font_face_spec.rb +45 -0
- data/spec/bourbon/css3/hidpi_media_query_spec.rb +23 -0
- data/spec/bourbon/functions/assign_inputs_spec.rb +50 -0
- data/spec/bourbon/functions/contains_spec.rb +27 -0
- data/spec/bourbon/functions/is_length_spec.rb +49 -0
- data/spec/bourbon/functions/is_light_spec.rb +37 -0
- data/spec/bourbon/functions/is_number_spec.rb +43 -0
- data/spec/bourbon/functions/is_size_spec.rb +43 -0
- data/spec/bourbon/functions/modular_scale_spec.rb +43 -0
- data/spec/bourbon/functions/px_to_em_spec.rb +31 -0
- data/spec/bourbon/functions/px_to_rem_spec.rb +25 -0
- data/spec/bourbon/functions/shade_spec.rb +31 -0
- data/spec/bourbon/functions/strip_units_spec.rb +31 -0
- data/spec/bourbon/functions/tint_spec.rb +31 -0
- data/spec/bourbon/functions/unpack_spec.rb +32 -0
- data/spec/bourbon/helpers/convert_units_spec.rb +31 -0
- data/spec/bourbon/helpers/directional_values_spec.rb +39 -0
- data/spec/bourbon/helpers/font_source_declaration_spec.rb +29 -0
- data/spec/bourbon/helpers/str_to_num_spec.rb +25 -0
- data/spec/fixtures/_setup.scss +1 -0
- data/spec/fixtures/addons/border-color.scss +26 -0
- data/spec/fixtures/addons/border-radius.scss +17 -0
- data/spec/fixtures/addons/border-style.scss +21 -0
- data/spec/fixtures/addons/border-width.scss +21 -0
- data/spec/fixtures/addons/buttons.scss +17 -0
- data/spec/fixtures/addons/clearfix.scss +5 -0
- data/spec/fixtures/addons/ellipsis.scss +5 -0
- data/spec/fixtures/addons/font-stacks.scss +21 -0
- data/spec/fixtures/addons/hide-text.scss +5 -0
- data/spec/fixtures/addons/margin.scss +21 -0
- data/spec/fixtures/addons/padding.scss +21 -0
- data/spec/fixtures/addons/position.scss +25 -0
- data/spec/fixtures/addons/retina-image.scss +21 -0
- data/spec/fixtures/addons/size.scss +13 -0
- data/spec/fixtures/addons/text-inputs.scss +17 -0
- data/spec/fixtures/addons/triangle.scss +9 -0
- data/spec/fixtures/addons/word-wrap.scss +9 -0
- data/spec/fixtures/css3/font-face.scss +6 -0
- data/spec/fixtures/css3/hidpi-media-query.scss +13 -0
- data/spec/fixtures/functions/assign-inputs.scss +19 -0
- data/spec/fixtures/functions/contains.scss +28 -0
- data/spec/fixtures/functions/is-length.scss +35 -0
- data/spec/fixtures/functions/is-light.scss +29 -0
- data/spec/fixtures/functions/is-number.scss +31 -0
- data/spec/fixtures/functions/is-size.scss +31 -0
- data/spec/fixtures/functions/modular-scale.scss +29 -0
- data/spec/fixtures/functions/px-to-em.scss +17 -0
- data/spec/fixtures/functions/px-to-rem.scss +15 -0
- data/spec/fixtures/functions/shade.scss +17 -0
- data/spec/fixtures/functions/strip-units.scss +17 -0
- data/spec/fixtures/functions/tint.scss +17 -0
- data/spec/fixtures/functions/unpack.scss +17 -0
- data/spec/fixtures/helpers/convert-units.scss +17 -0
- data/spec/fixtures/helpers/directional-values.scss +29 -0
- data/spec/fixtures/helpers/font-source-declaration.scss +10 -0
- data/spec/fixtures/helpers/str-to-num.scss +13 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/styler_spec.rb.bak +11 -0
- data/spec/support/matchers/be_contained_in.rb +10 -0
- data/spec/support/matchers/have_rule.rb +35 -0
- data/spec/support/matchers/have_ruleset.rb +20 -0
- data/spec/support/matchers/have_value.rb +17 -0
- data/spec/support/parser_support.rb +16 -0
- data/spec/support/sass_support.rb +10 -0
- data/styler.gemspec +10 -5
- data/{app/assets/fonts/awesome → vendor/assets/fonts}/FontAwesome.otf +0 -0
- data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.eot +0 -0
- data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.svg +0 -0
- data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.ttf +0 -0
- data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.woff +0 -0
- data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.woff2 +0 -0
- data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.eot +0 -0
- data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.svg +0 -0
- data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.ttf +0 -0
- data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.woff +0 -0
- data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.woff2 +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/affix.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/alert.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/button.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/carousel.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/collapse.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/dropdown.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/modal.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/popover.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/scrollspy.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/tab.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/tooltip.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap/transition.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap-sprockets.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap.js +0 -0
- data/{app → vendor}/assets/javascripts/bootstrap.min.js +0 -0
- metadata +198 -36
- data/bin/console +0 -14
- data/bin/setup +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ccd7fa89ff7c071ccac3966eabc110630e7e92d
|
4
|
+
data.tar.gz: 6bb618842036d6b8d1d8443fbdcacf3304ed6caa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10f58500eabf257a4ff284cc491ae8f865e9df55f1edb3f599ddeed91b146e340cd99c68fe1d51971f0b0058d699a9d8379bf4f9c82f8811862b5c3626f46268
|
7
|
+
data.tar.gz: 5e67ec216c576f1d8793891a09abb4d65ade26ff6aaff593fab125235eae851f535ffc629325f6e758fa56ccb00cb52d88b2c69658c03fb31dfbed09e1b8b6d9
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[](https://travis-ci.org/Alinuxfriend/Styler)
|
1
|
+
[](https://travis-ci.org/Alinuxfriend/Styler) [](https://badge.fury.io/rb/styler-sass)
|
2
2
|
|
3
3
|
# Styler
|
4
4
|
|
@@ -46,4 +46,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
|
|
46
46
|
## License
|
47
47
|
|
48
48
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
49
|
-
|
data/bin/styler
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'styler' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
2
8
|
|
3
|
-
|
4
|
-
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
5
12
|
|
6
|
-
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('styler-sass', 'styler')
|
File without changes
|
data/lib/styler/generator.rb
CHANGED
@@ -31,9 +31,16 @@ module Styler
|
|
31
31
|
|
32
32
|
desc 'version', 'Show styler version'
|
33
33
|
def version
|
34
|
-
say "Styler #{
|
34
|
+
say "Styler #{Styler::VERSION}"
|
35
35
|
end
|
36
36
|
|
37
|
+
|
38
|
+
desc 'remove', 'Remove styler version'
|
39
|
+
def remove
|
40
|
+
remove_styler_directory
|
41
|
+
end
|
42
|
+
|
43
|
+
|
37
44
|
private
|
38
45
|
|
39
46
|
def styler_files_already_exist?
|
data/lib/styler/version.rb
CHANGED
data/lib/styler.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
dir = File.dirname(__FILE__)
|
2
2
|
$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
|
3
|
-
|
4
3
|
require "styler/generator"
|
5
4
|
|
6
|
-
|
7
5
|
unless defined?(Sass)
|
8
6
|
require 'sass'
|
9
7
|
end
|
@@ -23,9 +21,7 @@ module Styler
|
|
23
21
|
end
|
24
22
|
end
|
25
23
|
else
|
26
|
-
|
27
|
-
ENV["SASS_PATH"] = [ENV["SASS_PATH"],
|
24
|
+
styler_path = File.expand_path("../../app/assets/stylesheets", __FILE__)
|
25
|
+
ENV["SASS_PATH"] = [ENV["SASS_PATH"], styler_path].compact.join(File::PATH_SEPARATOR)
|
28
26
|
end
|
29
|
-
|
30
|
-
|
31
27
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "border-color" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/border-color")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with one color" do
|
9
|
+
it "applies same color to all sides" do
|
10
|
+
rule = "border-color: #ff0000"
|
11
|
+
|
12
|
+
expect(".border-color-all").to have_rule(rule)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "called with two colors" do
|
17
|
+
it "applies to alternating sides" do
|
18
|
+
rule = "border-color: #00ff00 #0000ff"
|
19
|
+
|
20
|
+
expect(".border-color-alternate").to have_rule(rule)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "called with three colors" do
|
25
|
+
it "applies second color to left and right" do
|
26
|
+
rule = "border-color: #ff0000 #00ff00 #0000ff"
|
27
|
+
|
28
|
+
expect(".border-color-implied-left").to have_rule(rule)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "called with four colors" do
|
33
|
+
it "applies different colors to all sides" do
|
34
|
+
rule = "border-color: #0000ff #00ff00 #ff0000 #ffff00"
|
35
|
+
|
36
|
+
expect(".border-color-explicit").to have_rule(rule)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "called with null values" do
|
41
|
+
it "writes rules for other three" do
|
42
|
+
ruleset = "border-top-color: #00ff00; " +
|
43
|
+
"border-right-color: #ffff00; " +
|
44
|
+
"border-left-color: #0000ff;"
|
45
|
+
bad_rule = "border-bottom-color: null;"
|
46
|
+
|
47
|
+
expect(".border-color-false-third").to have_ruleset(ruleset)
|
48
|
+
expect(".border-color-false-third").to_not have_rule(bad_rule)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "border-radius" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/border-radius")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with one argument" do
|
9
|
+
it "applies to correct sides" do
|
10
|
+
top = "border-top-left-radius: 1em; " +
|
11
|
+
"border-top-right-radius: 1em;"
|
12
|
+
left = "border-bottom-left-radius: 2em; " +
|
13
|
+
"border-top-left-radius: 2em;"
|
14
|
+
right = "border-bottom-right-radius: 3em; " +
|
15
|
+
"border-top-right-radius: 3em;"
|
16
|
+
bottom = "border-bottom-left-radius: 4em; " +
|
17
|
+
"border-bottom-right-radius: 4em;"
|
18
|
+
|
19
|
+
expect(".border-top-radius").to have_ruleset(top)
|
20
|
+
expect(".border-left-radius").to have_ruleset(left)
|
21
|
+
expect(".border-right-radius").to have_ruleset(right)
|
22
|
+
expect(".border-bottom-radius").to have_ruleset(bottom)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "border-style" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/border-style")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with one style" do
|
9
|
+
it "applies same style to all sides" do
|
10
|
+
rule = "border-style: solid"
|
11
|
+
|
12
|
+
expect(".border-style-all").to have_rule(rule)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "called with two styles" do
|
17
|
+
it "applies to alternating sides" do
|
18
|
+
rule = "border-style: dotted dashed"
|
19
|
+
|
20
|
+
expect(".border-style-alternate").to have_rule(rule)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "called with three styles" do
|
25
|
+
it "applies second style to left and right" do
|
26
|
+
rule = "border-style: dashed double solid"
|
27
|
+
|
28
|
+
expect(".border-style-implied-left").to have_rule(rule)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "called with four styles" do
|
33
|
+
it "applies different styles to all sides" do
|
34
|
+
rule = "border-style: dotted groove ridge none"
|
35
|
+
|
36
|
+
expect(".border-style-explicit").to have_rule(rule)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "called with null values" do
|
41
|
+
it "writes rules for other three" do
|
42
|
+
ruleset = "border-top-style: inset; " +
|
43
|
+
"border-right-style: none; " +
|
44
|
+
"border-left-style: double;"
|
45
|
+
bad_rule = "border-bottom-style: null;"
|
46
|
+
|
47
|
+
expect(".border-style-false-third").to have_ruleset(ruleset)
|
48
|
+
expect(".border-style-false-third").to_not have_rule(bad_rule)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "border-width" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/border-width")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with one color" do
|
9
|
+
it "applies same width to all sides" do
|
10
|
+
rule = "border-width: 1px"
|
11
|
+
|
12
|
+
expect(".border-width-all").to have_rule(rule)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "called with two widths" do
|
17
|
+
it "applies to alternating sides" do
|
18
|
+
rule = "border-width: 2px 3px"
|
19
|
+
|
20
|
+
expect(".border-width-alternate").to have_rule(rule)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "called with three widths" do
|
25
|
+
it "applies second width to left and right" do
|
26
|
+
rule = "border-width: 4px 5px 6px"
|
27
|
+
|
28
|
+
expect(".border-width-implied-left").to have_rule(rule)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "called with four widths" do
|
33
|
+
it "applies different widths to all sides" do
|
34
|
+
rule = "border-width: 7px 8px 9px 10px"
|
35
|
+
|
36
|
+
expect(".border-width-explicit").to have_rule(rule)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "called with null values" do
|
41
|
+
it "writes rules for other three" do
|
42
|
+
ruleset = "border-top-width: 11px; " +
|
43
|
+
"border-right-width: 12px; " +
|
44
|
+
"border-left-width: 13px;"
|
45
|
+
bad_rule = "border-bottom-width: null;"
|
46
|
+
|
47
|
+
expect(".border-width-false-third").to have_ruleset(ruleset)
|
48
|
+
expect(".border-width-false-third").to_not have_rule(bad_rule)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "buttons" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/buttons")
|
6
|
+
|
7
|
+
@buttons_list = %w(
|
8
|
+
button
|
9
|
+
input[type="button"]
|
10
|
+
input[type="reset"]
|
11
|
+
input[type="submit"]
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
context "expands plain buttons" do
|
16
|
+
it "finds selectors" do
|
17
|
+
list = @buttons_list.join(", ")
|
18
|
+
ruleset = "content: #{list};"
|
19
|
+
|
20
|
+
expect(".all-buttons").to have_ruleset(ruleset)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "expands active buttons" do
|
25
|
+
it "finds selectors" do
|
26
|
+
list = @buttons_list.map { |input| "#{input}:active" }
|
27
|
+
list = list.join(", ")
|
28
|
+
ruleset = "content: #{list};"
|
29
|
+
|
30
|
+
expect(".all-buttons-active").to have_ruleset(ruleset)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "expands focus buttons" do
|
35
|
+
it "finds selectors" do
|
36
|
+
list = @buttons_list.map { |input| "#{input}:focus" }
|
37
|
+
list = list.join(", ")
|
38
|
+
ruleset = "content: #{list};"
|
39
|
+
|
40
|
+
expect(".all-buttons-focus").to have_ruleset(ruleset)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "expands hover buttons" do
|
45
|
+
it "finds selectors" do
|
46
|
+
list = @buttons_list.map { |input| "#{input}:hover" }
|
47
|
+
list = list.join(", ")
|
48
|
+
ruleset = "content: #{list};"
|
49
|
+
|
50
|
+
expect(".all-buttons-hover").to have_ruleset(ruleset)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "clearfix" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/clearfix")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called on element" do
|
9
|
+
it "adds clearfix" do
|
10
|
+
input = ".clearfix::after"
|
11
|
+
ruleset = "clear: both; " +
|
12
|
+
"content: \"\"; " +
|
13
|
+
"display: table;"
|
14
|
+
|
15
|
+
expect(input).to have_ruleset(ruleset)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "ellipsis" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/ellipsis")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called on element" do
|
9
|
+
it "adds ellipsis" do
|
10
|
+
ruleset = "display: inline-block; " +
|
11
|
+
"max-width: 100%; " +
|
12
|
+
"overflow: hidden; " +
|
13
|
+
"text-overflow: ellipsis; " +
|
14
|
+
"white-space: nowrap; " +
|
15
|
+
"word-wrap: normal;"
|
16
|
+
|
17
|
+
expect(".ellipsis").to have_ruleset(ruleset)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "font-stacks" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/font-stacks")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "stacks used in variable" do
|
9
|
+
it "output stacks" do
|
10
|
+
georgia = '"Georgia", "Cambria", "Times New Roman", "Times", serif'
|
11
|
+
helvetica = '"Helvetica Neue", "Helvetica", "Roboto", ' +
|
12
|
+
'"Arial", sans-serif'
|
13
|
+
lucida_grande = '"Lucida Grande", "Tahoma", "Verdana", ' +
|
14
|
+
'"Arial", sans-serif'
|
15
|
+
monospace = '"Bitstream Vera Sans Mono", "Consolas", "Courier", monospace'
|
16
|
+
verdana = '"Verdana", "Geneva", sans-serif'
|
17
|
+
|
18
|
+
expect("$georgia").to have_value(georgia)
|
19
|
+
expect("$helvetica").to have_value(helvetica)
|
20
|
+
expect("$lucida-grande").to have_value(lucida_grande)
|
21
|
+
expect("$monospace").to have_value(monospace)
|
22
|
+
expect("$verdana").to have_value(verdana)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "hide-text" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/hide-text")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called on element" do
|
9
|
+
it "adds hide-text" do
|
10
|
+
ruleset = "overflow: hidden; " +
|
11
|
+
"text-indent: 101%; " +
|
12
|
+
"white-space: nowrap;"
|
13
|
+
|
14
|
+
expect(".hide-text").to have_ruleset(ruleset)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "margin" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/margin")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with one size" do
|
9
|
+
it "applies same width to all sides" do
|
10
|
+
rule = "margin: 1px"
|
11
|
+
|
12
|
+
expect(".margin-all").to have_rule(rule)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "called with two sizes" do
|
17
|
+
it "applies to alternating sides" do
|
18
|
+
rule = "margin: 2px 3px"
|
19
|
+
|
20
|
+
expect(".margin-alternate").to have_rule(rule)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "called with three sizes" do
|
25
|
+
it "applies second width to left and right" do
|
26
|
+
rule = "margin: 4px 5px 6px"
|
27
|
+
|
28
|
+
expect(".margin-implied-left").to have_rule(rule)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "called with four sizes" do
|
33
|
+
it "applies different widths to all sides" do
|
34
|
+
rule = "margin: 7px 8px 9px 10px"
|
35
|
+
|
36
|
+
expect(".margin-explicit").to have_rule(rule)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "called with null values" do
|
41
|
+
it "writes rules for other three" do
|
42
|
+
ruleset = "margin-top: 11px; " +
|
43
|
+
"margin-right: 12px; " +
|
44
|
+
"margin-left: 13px;"
|
45
|
+
bad_rule = "margin-bottom: null;"
|
46
|
+
|
47
|
+
expect(".margin-false-third").to have_ruleset(ruleset)
|
48
|
+
expect(".margin-false-third").to_not have_rule(bad_rule)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "padding" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/padding")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with one size" do
|
9
|
+
it "applies same width to all sides" do
|
10
|
+
rule = "padding: 1px"
|
11
|
+
|
12
|
+
expect(".padding-all").to have_rule(rule)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "called with two sizes" do
|
17
|
+
it "applies to alternating sides" do
|
18
|
+
rule = "padding: 2px 3px"
|
19
|
+
|
20
|
+
expect(".padding-alternate").to have_rule(rule)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "called with three sizes" do
|
25
|
+
it "applies second width to left and right" do
|
26
|
+
rule = "padding: 4px 5px 6px"
|
27
|
+
|
28
|
+
expect(".padding-implied-left").to have_rule(rule)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "called with four sizes" do
|
33
|
+
it "applies different widths to all sides" do
|
34
|
+
rule = "padding: 7px 8px 9px 10px"
|
35
|
+
|
36
|
+
expect(".padding-explicit").to have_rule(rule)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "called with null values" do
|
41
|
+
it "writes rules for other three" do
|
42
|
+
ruleset = "padding-top: 11px; " +
|
43
|
+
"padding-right: 12px; " +
|
44
|
+
"padding-left: 13px;"
|
45
|
+
bad_rule = "padding-bottom: null;"
|
46
|
+
|
47
|
+
expect(".padding-false-third").to have_ruleset(ruleset)
|
48
|
+
expect(".padding-false-third").to_not have_rule(bad_rule)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "position" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/position")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with one size" do
|
9
|
+
it "applies same width to all sides" do
|
10
|
+
ruleset = "position: fixed; " +
|
11
|
+
"top: 1em; " +
|
12
|
+
"right: 1em; " +
|
13
|
+
"bottom: 1em; " +
|
14
|
+
"left: 1em;"
|
15
|
+
|
16
|
+
expect(".position-all").to have_ruleset(ruleset)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "called with two sizes" do
|
21
|
+
it "applies to alternating sides" do
|
22
|
+
ruleset = "position: absolute; " +
|
23
|
+
"top: 2px; " +
|
24
|
+
"right: 3px; " +
|
25
|
+
"bottom: 2px; " +
|
26
|
+
"left: 3px;"
|
27
|
+
|
28
|
+
expect(".position-alternate").to have_ruleset(ruleset)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "called with three sizes" do
|
33
|
+
it "applies second width to left and right" do
|
34
|
+
ruleset = "position: relative; " +
|
35
|
+
"top: 4px; " +
|
36
|
+
"right: 5px; " +
|
37
|
+
"bottom: 6px; " +
|
38
|
+
"left: 5px;"
|
39
|
+
|
40
|
+
expect(".position-implied-left").to have_ruleset(ruleset)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "called with four sizes" do
|
45
|
+
it "applies different widths to all sides" do
|
46
|
+
ruleset = "position: fixed; " +
|
47
|
+
"top: 7px; " +
|
48
|
+
"right: 8px; " +
|
49
|
+
"bottom: 9px; " +
|
50
|
+
"left: 10px;"
|
51
|
+
|
52
|
+
expect(".position-explicit").to have_ruleset(ruleset)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "called with null values" do
|
57
|
+
it "writes rules for others" do
|
58
|
+
ruleset = "position: static; " +
|
59
|
+
"top: 11px; " +
|
60
|
+
"left: 13px;"
|
61
|
+
bad_rule = "position-bottom: null; position-right: null;"
|
62
|
+
|
63
|
+
expect(".position-false-third").to have_ruleset(ruleset)
|
64
|
+
expect(".position-false-third").to_not have_rule(bad_rule)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "retina-image" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("addons/retina-image")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with defaults" do
|
9
|
+
it "applies defaults" do
|
10
|
+
ruleset = 'background-image: url("retina-default.png");; ' +
|
11
|
+
'background-image: url("retina-default_2x.png"); ' +
|
12
|
+
'background-size: "320px 480px";'
|
13
|
+
|
14
|
+
expect(".retina-default").to have_ruleset(ruleset)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "called with extension" do
|
19
|
+
it "applies file extension" do
|
20
|
+
ruleset = 'background-image: url("retina-extension.jpg");; ' +
|
21
|
+
'background-image: url("retina-extension_2x.jpg"); ' +
|
22
|
+
'background-size: "20px 40px";'
|
23
|
+
|
24
|
+
expect(".retina-extension").to have_ruleset(ruleset)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "called with custom retina filename" do
|
29
|
+
it "applies filename" do
|
30
|
+
ruleset = 'background-image: url("default.png");; ' +
|
31
|
+
'background-image: url("custom.png"); ' +
|
32
|
+
'background-size: "10px 5px";'
|
33
|
+
|
34
|
+
expect(".retina-custom-name").to have_ruleset(ruleset)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "called with custom retina suffix" do
|
39
|
+
it "applies suffix" do
|
40
|
+
ruleset = 'background-image: url("default.png");; ' +
|
41
|
+
'background-image: url("default@2x.png"); ' +
|
42
|
+
'background-size: "3em 2em";'
|
43
|
+
|
44
|
+
expect(".retina-custom-suffix").to have_ruleset(ruleset)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "called with no pipeline" do
|
49
|
+
it "applies suffix" do
|
50
|
+
ruleset = 'background-image: url("default.jpg");; ' +
|
51
|
+
'background-image: url("default.jpg"); ' +
|
52
|
+
'background-size: "100px 20px";'
|
53
|
+
|
54
|
+
expect(".retina-pipeline").to have_ruleset(ruleset)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|