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.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/CHANGELOG.md +17 -2
  4. data/README.md +1 -2
  5. data/bin/styler +13 -3
  6. data/{app/assets/images/.keep → features/support/env.rb} +0 -0
  7. data/lib/styler/generator.rb +8 -1
  8. data/lib/styler/version.rb +1 -1
  9. data/lib/styler.rb +2 -6
  10. data/spec/bourbon/addons/border_color_spec.rb +51 -0
  11. data/spec/bourbon/addons/border_radius_spec.rb +25 -0
  12. data/spec/bourbon/addons/border_style_spec.rb +51 -0
  13. data/spec/bourbon/addons/border_width_spec.rb +51 -0
  14. data/spec/bourbon/addons/buttons_spec.rb +53 -0
  15. data/spec/bourbon/addons/clearfix_spec.rb +18 -0
  16. data/spec/bourbon/addons/ellipsis_spec.rb +20 -0
  17. data/spec/bourbon/addons/font_stacks_spec.rb +25 -0
  18. data/spec/bourbon/addons/hide_text_spec.rb +17 -0
  19. data/spec/bourbon/addons/margin_spec.rb +51 -0
  20. data/spec/bourbon/addons/padding_spec.rb +51 -0
  21. data/spec/bourbon/addons/position_spec.rb +67 -0
  22. data/spec/bourbon/addons/retina_image_spec.rb +57 -0
  23. data/spec/bourbon/addons/size_spec.rb +31 -0
  24. data/spec/bourbon/addons/text_inputs_spec.rb +65 -0
  25. data/spec/bourbon/addons/triangle_spec.rb +32 -0
  26. data/spec/bourbon/addons/word_wrap_spec.rb +29 -0
  27. data/spec/bourbon/css3/font_face_spec.rb +45 -0
  28. data/spec/bourbon/css3/hidpi_media_query_spec.rb +23 -0
  29. data/spec/bourbon/functions/assign_inputs_spec.rb +50 -0
  30. data/spec/bourbon/functions/contains_spec.rb +27 -0
  31. data/spec/bourbon/functions/is_length_spec.rb +49 -0
  32. data/spec/bourbon/functions/is_light_spec.rb +37 -0
  33. data/spec/bourbon/functions/is_number_spec.rb +43 -0
  34. data/spec/bourbon/functions/is_size_spec.rb +43 -0
  35. data/spec/bourbon/functions/modular_scale_spec.rb +43 -0
  36. data/spec/bourbon/functions/px_to_em_spec.rb +31 -0
  37. data/spec/bourbon/functions/px_to_rem_spec.rb +25 -0
  38. data/spec/bourbon/functions/shade_spec.rb +31 -0
  39. data/spec/bourbon/functions/strip_units_spec.rb +31 -0
  40. data/spec/bourbon/functions/tint_spec.rb +31 -0
  41. data/spec/bourbon/functions/unpack_spec.rb +32 -0
  42. data/spec/bourbon/helpers/convert_units_spec.rb +31 -0
  43. data/spec/bourbon/helpers/directional_values_spec.rb +39 -0
  44. data/spec/bourbon/helpers/font_source_declaration_spec.rb +29 -0
  45. data/spec/bourbon/helpers/str_to_num_spec.rb +25 -0
  46. data/spec/fixtures/_setup.scss +1 -0
  47. data/spec/fixtures/addons/border-color.scss +26 -0
  48. data/spec/fixtures/addons/border-radius.scss +17 -0
  49. data/spec/fixtures/addons/border-style.scss +21 -0
  50. data/spec/fixtures/addons/border-width.scss +21 -0
  51. data/spec/fixtures/addons/buttons.scss +17 -0
  52. data/spec/fixtures/addons/clearfix.scss +5 -0
  53. data/spec/fixtures/addons/ellipsis.scss +5 -0
  54. data/spec/fixtures/addons/font-stacks.scss +21 -0
  55. data/spec/fixtures/addons/hide-text.scss +5 -0
  56. data/spec/fixtures/addons/margin.scss +21 -0
  57. data/spec/fixtures/addons/padding.scss +21 -0
  58. data/spec/fixtures/addons/position.scss +25 -0
  59. data/spec/fixtures/addons/retina-image.scss +21 -0
  60. data/spec/fixtures/addons/size.scss +13 -0
  61. data/spec/fixtures/addons/text-inputs.scss +17 -0
  62. data/spec/fixtures/addons/triangle.scss +9 -0
  63. data/spec/fixtures/addons/word-wrap.scss +9 -0
  64. data/spec/fixtures/css3/font-face.scss +6 -0
  65. data/spec/fixtures/css3/hidpi-media-query.scss +13 -0
  66. data/spec/fixtures/functions/assign-inputs.scss +19 -0
  67. data/spec/fixtures/functions/contains.scss +28 -0
  68. data/spec/fixtures/functions/is-length.scss +35 -0
  69. data/spec/fixtures/functions/is-light.scss +29 -0
  70. data/spec/fixtures/functions/is-number.scss +31 -0
  71. data/spec/fixtures/functions/is-size.scss +31 -0
  72. data/spec/fixtures/functions/modular-scale.scss +29 -0
  73. data/spec/fixtures/functions/px-to-em.scss +17 -0
  74. data/spec/fixtures/functions/px-to-rem.scss +15 -0
  75. data/spec/fixtures/functions/shade.scss +17 -0
  76. data/spec/fixtures/functions/strip-units.scss +17 -0
  77. data/spec/fixtures/functions/tint.scss +17 -0
  78. data/spec/fixtures/functions/unpack.scss +17 -0
  79. data/spec/fixtures/helpers/convert-units.scss +17 -0
  80. data/spec/fixtures/helpers/directional-values.scss +29 -0
  81. data/spec/fixtures/helpers/font-source-declaration.scss +10 -0
  82. data/spec/fixtures/helpers/str-to-num.scss +13 -0
  83. data/spec/spec_helper.rb +22 -0
  84. data/spec/styler_spec.rb.bak +11 -0
  85. data/spec/support/matchers/be_contained_in.rb +10 -0
  86. data/spec/support/matchers/have_rule.rb +35 -0
  87. data/spec/support/matchers/have_ruleset.rb +20 -0
  88. data/spec/support/matchers/have_value.rb +17 -0
  89. data/spec/support/parser_support.rb +16 -0
  90. data/spec/support/sass_support.rb +10 -0
  91. data/styler.gemspec +10 -5
  92. data/{app/assets/fonts/awesome → vendor/assets/fonts}/FontAwesome.otf +0 -0
  93. data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.eot +0 -0
  94. data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.svg +0 -0
  95. data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.ttf +0 -0
  96. data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.woff +0 -0
  97. data/{app/assets/fonts/awesome → vendor/assets/fonts}/fontawesome-webfont.woff2 +0 -0
  98. data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.eot +0 -0
  99. data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.svg +0 -0
  100. data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.ttf +0 -0
  101. data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.woff +0 -0
  102. data/{app/assets/fonts/bootstrap → vendor/assets/fonts}/glyphicons-halflings-regular.woff2 +0 -0
  103. data/{app → vendor}/assets/javascripts/bootstrap/affix.js +0 -0
  104. data/{app → vendor}/assets/javascripts/bootstrap/alert.js +0 -0
  105. data/{app → vendor}/assets/javascripts/bootstrap/button.js +0 -0
  106. data/{app → vendor}/assets/javascripts/bootstrap/carousel.js +0 -0
  107. data/{app → vendor}/assets/javascripts/bootstrap/collapse.js +0 -0
  108. data/{app → vendor}/assets/javascripts/bootstrap/dropdown.js +0 -0
  109. data/{app → vendor}/assets/javascripts/bootstrap/modal.js +0 -0
  110. data/{app → vendor}/assets/javascripts/bootstrap/popover.js +0 -0
  111. data/{app → vendor}/assets/javascripts/bootstrap/scrollspy.js +0 -0
  112. data/{app → vendor}/assets/javascripts/bootstrap/tab.js +0 -0
  113. data/{app → vendor}/assets/javascripts/bootstrap/tooltip.js +0 -0
  114. data/{app → vendor}/assets/javascripts/bootstrap/transition.js +0 -0
  115. data/{app → vendor}/assets/javascripts/bootstrap-sprockets.js +0 -0
  116. data/{app → vendor}/assets/javascripts/bootstrap.js +0 -0
  117. data/{app → vendor}/assets/javascripts/bootstrap.min.js +0 -0
  118. metadata +198 -36
  119. data/bin/console +0 -14
  120. data/bin/setup +0 -7
@@ -0,0 +1,31 @@
1
+ require "spec_helper"
2
+
3
+ describe "size" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("addons/size")
6
+ end
7
+
8
+ context "called with one size" do
9
+ it "applies same width to both height and width" do
10
+ rule = "height: 10px; width: 10px;"
11
+
12
+ expect(".size-implicit").to have_ruleset(rule)
13
+ end
14
+ end
15
+
16
+ context "called with two sizes" do
17
+ it "applies to height and width" do
18
+ rule = "height: 2em; width: 1em;"
19
+
20
+ expect(".size-both").to have_ruleset(rule)
21
+ end
22
+ end
23
+
24
+ context "called with auto" do
25
+ it "applies to auto to height" do
26
+ rule = "height: auto; width: 100px;"
27
+
28
+ expect(".size-auto").to have_ruleset(rule)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,65 @@
1
+ require "spec_helper"
2
+
3
+ describe "text-inputs" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("addons/text-inputs")
6
+
7
+ @inputs_list = %w(
8
+ input[type="color"]
9
+ input[type="date"]
10
+ input[type="datetime"]
11
+ input[type="datetime-local"]
12
+ input[type="email"]
13
+ input[type="month"]
14
+ input[type="number"]
15
+ input[type="password"]
16
+ input[type="search"]
17
+ input[type="tel"]
18
+ input[type="text"]
19
+ input[type="time"]
20
+ input[type="url"]
21
+ input[type="week"]
22
+ input:not([type])
23
+ textarea
24
+ )
25
+ end
26
+
27
+ context "expands plain text inputs" do
28
+ it "finds selectors" do
29
+ list = @inputs_list.join(", ")
30
+ ruleset = "content: #{list};"
31
+
32
+ expect(".all-text-inputs").to have_ruleset(ruleset)
33
+ end
34
+ end
35
+
36
+ context "expands active text inputs" do
37
+ it "finds selectors" do
38
+ list = @inputs_list.map { |input| "#{input}:active" }
39
+ list = list.join(", ")
40
+ ruleset = "content: #{list};"
41
+
42
+ expect(".all-text-inputs-active").to have_ruleset(ruleset)
43
+ end
44
+ end
45
+
46
+ context "expands focus text inputs" do
47
+ it "finds selectors" do
48
+ list = @inputs_list.map { |input| "#{input}:focus" }
49
+ list = list.join(", ")
50
+ ruleset = "content: #{list};"
51
+
52
+ expect(".all-text-inputs-focus").to have_ruleset(ruleset)
53
+ end
54
+ end
55
+
56
+ context "expands hover text inputs" do
57
+ it "finds selectors" do
58
+ list = @inputs_list.map { |input| "#{input}:hover" }
59
+ list = list.join(", ")
60
+ ruleset = "content: #{list};"
61
+
62
+ expect(".all-text-inputs-hover").to have_ruleset(ruleset)
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,32 @@
1
+ require "spec_helper"
2
+
3
+ describe "triangle" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("addons/triangle")
6
+ end
7
+
8
+ context "called on element" do
9
+ it "adds triangle" do
10
+ input = ".triangle-down"
11
+ ruleset = "height: 0; " +
12
+ "width: 0; " +
13
+ "border-left: 6px solid transparent; " +
14
+ "border-right: 6px solid transparent; " +
15
+ "border-top: 6px solid #ffffff;"
16
+
17
+ expect(input).to have_ruleset(ruleset)
18
+ end
19
+ end
20
+
21
+ context "called on element with corner arguments" do
22
+ it "adds triangle on corner" do
23
+ input = ".triangle-corner"
24
+ ruleset = "height: 0; " +
25
+ "width: 0; " +
26
+ "border-top: 6px solid #000000; " +
27
+ "border-right: 12px solid #aaaaaa;"
28
+
29
+ expect(input).to have_ruleset(ruleset)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,29 @@
1
+ require "spec_helper"
2
+
3
+ describe "word-wrap" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("addons/word-wrap")
6
+ end
7
+
8
+ context "called on element" do
9
+ it "adds word-wrap" do
10
+ input = ".word-wrap"
11
+ ruleset = "overflow-wrap: break-word; " +
12
+ "word-wrap: break-word; " +
13
+ "word-break: break-all;"
14
+
15
+ expect(input).to have_ruleset(ruleset)
16
+ end
17
+ end
18
+
19
+ context "called on element with break" do
20
+ it "adds break" do
21
+ input = ".word-wrap-break"
22
+ ruleset = "overflow-wrap: normal; " +
23
+ "word-wrap: normal; " +
24
+ "word-break: normal;"
25
+
26
+ expect(input).to have_ruleset(ruleset)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,45 @@
1
+ require "spec_helper"
2
+
3
+ describe "font-face" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("css3/font-face")
6
+ end
7
+
8
+ context "called with defaults" do
9
+ it "outputs defaults" do
10
+ ruleset = "font-family: \"Helvetica\"; " +
11
+ "font-style: normal; " +
12
+ "font-weight: normal; " +
13
+ "src: url(\"/fonts.eot?#iefix\") " +
14
+ "format(\"embedded-opentype\"), " +
15
+ "url(\"/fonts.woff2\") format(\"woff2\"), " +
16
+ "url(\"/fonts.woff\") format(\"woff\"), " +
17
+ "url(\"/fonts.ttf\") format(\"truetype\"), " +
18
+ "url(\"/fonts.svg#Helvetica\") format(\"svg\");; " +
19
+ "font-family: \"Verdana\"; " +
20
+ "font-style: \"italic\"; " +
21
+ "font-weight: \"bold\"; " +
22
+ "src: url(\"/assets/fonts.eot?#iefix\") " +
23
+ "format(\"embedded-opentype\"), url(\"/assets/fonts.woff2\") " +
24
+ "format(\"woff2\"), url(\"/assets/fonts.woff\") " +
25
+ "format(\"woff\"), url(\"/assets/fonts.ttf\") " +
26
+ "format(\"truetype\"), url(\"/assets/fonts.svg#Verdana\") " +
27
+ "format(\"svg\");; " +
28
+ "font-family: \"Georgia\"; " +
29
+ "font-style: \"normal\"; " +
30
+ "font-weight: \"normal\"; " +
31
+ "src: url(\"/assets.eot?#iefix\") " +
32
+ "format(\"embedded-opentype\"), url(\"/assets.woff2\") " +
33
+ "format(\"woff2\"), url(\"/assets.woff\") format(\"woff\"), " +
34
+ "url(\"/assets.ttf\") format(\"truetype\"), " +
35
+ "url(\"/assets.svg#Georgia\") format(\"svg\");; " +
36
+ "font-family: \"Arial\"; " +
37
+ "font-style: \"normal\"; " +
38
+ "font-weight: \"normal\"; " +
39
+ "src: url(\"/.woff2\") format(\"woff2\"), " +
40
+ "url(\"/.svg#Arial\") format(\"svg\");"
41
+
42
+ expect("@font-face").to have_ruleset(ruleset)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,23 @@
1
+ require "spec_helper"
2
+
3
+ describe "hidpi-media-query" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("css3/hidpi-media-query")
6
+ end
7
+
8
+ context "called with defaults" do
9
+ it "outputs defaults" do
10
+ rule = "color: #ff0000"
11
+
12
+ expect(".hidpi-defaults").to have_rule(rule)
13
+ end
14
+ end
15
+
16
+ context "called with ratio" do
17
+ it "outputs ratio" do
18
+ rule = "color: #00ff00"
19
+
20
+ expect(".hidpi-ratio").to have_rule(rule)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,50 @@
1
+ require "spec_helper"
2
+
3
+ describe "assign-inputs" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/assign-inputs")
6
+ @text_inputs_list = [
7
+ "input[type=\"password\"]",
8
+ "input[type=\"text\"]",
9
+ "textarea"
10
+ ]
11
+ end
12
+
13
+ context "expands plain text inputs" do
14
+ it "finds selectors" do
15
+ @text_inputs_list.each do |input|
16
+ expect(input).to have_rule("color: #ff0000")
17
+ end
18
+ end
19
+ end
20
+
21
+ context "expands text inputs with pseudo classes" do
22
+ it "finds selectors" do
23
+ list = @text_inputs_list.dup
24
+ list.map! { |input| input + ":active" }
25
+ list.each do |input|
26
+ expect(input).to have_rule("color: #00ff00")
27
+ end
28
+ end
29
+ end
30
+
31
+ context "expands text inputs when first in list" do
32
+ it "finds selectors" do
33
+ list = @text_inputs_list.dup
34
+ list.push "select"
35
+ list.each do |input|
36
+ expect(input).to have_rule("color: #0000ff")
37
+ end
38
+ end
39
+ end
40
+
41
+ context "expands text inputs when middle of list" do
42
+ it "finds selectors" do
43
+ list = @text_inputs_list.dup
44
+ list.unshift "input[type=\"file\"]"
45
+ list.each do |input|
46
+ expect(input).to have_rule("color: #ff00ff")
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,27 @@
1
+ require "spec_helper"
2
+
3
+ describe "contains" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/contains")
6
+ end
7
+
8
+ context "called on array with single item" do
9
+ it "contains item" do
10
+ expect(".single").to have_rule("color: #fff")
11
+ end
12
+
13
+ it "doesn't contain missing item" do
14
+ expect(".single-missing").to have_rule("color: #000")
15
+ end
16
+ end
17
+
18
+ context "called with array with multiple items" do
19
+ it "contains item" do
20
+ expect(".multiple").to have_rule("color: #fff")
21
+ end
22
+
23
+ it "doesn't contain missing item" do
24
+ expect(".multiple-missing").to have_rule("color: #000")
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,49 @@
1
+ require "spec_helper"
2
+
3
+ describe "is-length" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/is-length")
6
+ end
7
+
8
+ context "checks if unitless integer can be represented as a length" do
9
+ it "returns false" do
10
+ expect(".integer").not_to have_rule("color: #fff")
11
+ end
12
+ end
13
+
14
+ context "checks if px can be represented as a length" do
15
+ it "returns true" do
16
+ expect(".pixels").to have_rule("color: #fff")
17
+ end
18
+ end
19
+
20
+ context "checks if em can be represented as a length" do
21
+ it "returns true" do
22
+ expect(".ems").to have_rule("color: #fff")
23
+ end
24
+ end
25
+
26
+ context "checks if percent can be represented as a length" do
27
+ it "returns true" do
28
+ expect(".percent").to have_rule("color: #fff")
29
+ end
30
+ end
31
+
32
+ context "parses calculated values" do
33
+ it "returns true" do
34
+ expect(".calc").to have_rule("color: #fff")
35
+ end
36
+ end
37
+
38
+ context "checks if strings can be represented as a length" do
39
+ it "returns false" do
40
+ expect(".string").not_to have_rule("color: #fff")
41
+ end
42
+ end
43
+
44
+ context "checks if null can be represented as a length" do
45
+ it "returns false" do
46
+ expect(".null").not_to have_rule("color: #fff")
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,37 @@
1
+ require "spec_helper"
2
+
3
+ describe "is-light" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/is-light")
6
+ end
7
+
8
+ context "takes a light color" do
9
+ it "and returns true" do
10
+ expect(".pink").to have_rule("color: #000")
11
+ end
12
+ end
13
+
14
+ context "takes a medium-light color" do
15
+ it "and returns true" do
16
+ expect(".sky").to have_rule("color: #000")
17
+ end
18
+ end
19
+
20
+ context "takes a medium-dark color" do
21
+ it "and returns false" do
22
+ expect(".medium-gray").to have_rule("color: #fff")
23
+ end
24
+ end
25
+
26
+ context "takes a dark color" do
27
+ it "and returns false" do
28
+ expect(".charcoal").to have_rule("color: #fff")
29
+ end
30
+ end
31
+
32
+ context "takes a translucent color" do
33
+ it "and processes as an opaque color" do
34
+ expect(".translucent").to have_rule("color: #000")
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,43 @@
1
+ require "spec_helper"
2
+
3
+ describe "is-number" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/is-number")
6
+ end
7
+
8
+ context "called with integer" do
9
+ it "is a number" do
10
+ expect(".integer").to have_rule("line-height: 1")
11
+ end
12
+ end
13
+
14
+ context "called with px" do
15
+ it "is a number" do
16
+ expect(".px").to have_rule("line-height: 2px")
17
+ end
18
+ end
19
+
20
+ context "called with em" do
21
+ it "is a number" do
22
+ expect(".em").to have_rule("line-height: 3em")
23
+ end
24
+ end
25
+
26
+ context "called with rem" do
27
+ it "is a number" do
28
+ expect(".rem").to have_rule("line-height: 4rem")
29
+ end
30
+ end
31
+
32
+ context "called with percent" do
33
+ it "is a number" do
34
+ expect(".percent").to have_rule("line-height: 5%")
35
+ end
36
+ end
37
+
38
+ context "called with string" do
39
+ it "is not a number" do
40
+ expect(".string").to_not have_rule("line-height: \"stringy\"")
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,43 @@
1
+ require "spec_helper"
2
+
3
+ describe "is-size" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/is-size")
6
+ end
7
+
8
+ context "called with integer" do
9
+ it "is not a size" do
10
+ expect(".integer").to_not have_rule("margin-top: 1")
11
+ end
12
+ end
13
+
14
+ context "called with px" do
15
+ it "is a size" do
16
+ expect(".px").to have_rule("margin-top: 2px")
17
+ end
18
+ end
19
+
20
+ context "called with em" do
21
+ it "is a size" do
22
+ expect(".em").to have_rule("margin-top: 3em")
23
+ end
24
+ end
25
+
26
+ context "called with rem" do
27
+ it "is a size" do
28
+ expect(".rem").to have_rule("margin-top: 4rem")
29
+ end
30
+ end
31
+
32
+ context "called with percent" do
33
+ it "is a size" do
34
+ expect(".percent").to have_rule("margin-top: 5%")
35
+ end
36
+ end
37
+
38
+ context "called with string" do
39
+ it "is not a size" do
40
+ expect(".string").to_not have_rule("margin-top: \"stringy\"")
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,43 @@
1
+ require "spec_helper"
2
+
3
+ describe "modular-scale" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/modular-scale")
6
+ end
7
+
8
+ context "called with arguments (1, $value: 2em)" do
9
+ it "outputs double the first value from the default scale" do
10
+ expect(".one-base-two").to have_rule("font-size: 2.666em")
11
+ end
12
+ end
13
+
14
+ context "called with arguments (1, $value: 3em)" do
15
+ it "outputs triple the first value from the default scale" do
16
+ expect(".one-base-three").to have_rule("font-size: 3.999em")
17
+ end
18
+ end
19
+
20
+ context "called with arguments (1, $value: 4em 6em)" do
21
+ it "outputs quadruple the first value from the default scale" do
22
+ expect(".one-double-value").to have_rule("font-size: 1.12556em")
23
+ end
24
+ end
25
+
26
+ context "called with arguments (1, $ratio: $golden-ratio)" do
27
+ it "output the first value from the golden ratio scale" do
28
+ expect(".one-golden-ratio").to have_rule("font-size: 1.618em")
29
+ end
30
+ end
31
+
32
+ context "called with argument (2)" do
33
+ it "outputs the second value from the default scale" do
34
+ expect(".two-base-one").to have_rule("font-size: 1.77689em")
35
+ end
36
+ end
37
+
38
+ context "called with arguments (2, $value: 4em 6em)" do
39
+ it "outputs sextuple the second value from the default scale" do
40
+ expect(".two-double-value").to have_rule("font-size: 3.55378em")
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,31 @@
1
+ require "spec_helper"
2
+
3
+ describe "px-to-em" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/px-to-em")
6
+ end
7
+
8
+ context "called with unitless integer" do
9
+ it "outputs ems" do
10
+ expect(".unitless").to have_rule("font-size: 0.75em")
11
+ end
12
+ end
13
+
14
+ context "called with unitless integer and base" do
15
+ it "outputs ems" do
16
+ expect(".unitless-with-base").to have_rule("font-size: 0.66667em")
17
+ end
18
+ end
19
+
20
+ context "called with px" do
21
+ it "outputs ems" do
22
+ expect(".px").to have_rule("font-size: 1em")
23
+ end
24
+ end
25
+
26
+ context "called with px" do
27
+ it "outputs ems" do
28
+ expect(".px-with-base").to have_rule("font-size: 1.5em")
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,25 @@
1
+ require "spec_helper"
2
+
3
+ describe "px-to-rem" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/px-to-rem")
6
+ end
7
+
8
+ context "called with unitless integer" do
9
+ it "outputs rems" do
10
+ expect(".unitless").to have_rule("font-size: 0.75rem")
11
+ end
12
+ end
13
+
14
+ context "called with px" do
15
+ it "outputs rems" do
16
+ expect(".px").to have_rule("font-size: 1rem")
17
+ end
18
+ end
19
+
20
+ context "called with px with modified base" do
21
+ it "outputs rems" do
22
+ expect(".px-with-modified-base").to have_rule("font-size: 1rem")
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,31 @@
1
+ require "spec_helper"
2
+
3
+ describe "shade" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/shade")
6
+ end
7
+
8
+ context "called on white" do
9
+ it "shades white" do
10
+ expect(".shade-white").to have_rule("color: #404040")
11
+ end
12
+ end
13
+
14
+ context "called on black" do
15
+ it "still returns black" do
16
+ expect(".shade-black").to have_rule("color: black")
17
+ end
18
+ end
19
+
20
+ context "called on red" do
21
+ it "shades red" do
22
+ expect(".shade-red").to have_rule("color: #bf0000")
23
+ end
24
+ end
25
+
26
+ context "called on gray" do
27
+ it "shades gray" do
28
+ expect(".shade-gray").to have_rule("color: #171717")
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ require "spec_helper"
2
+
3
+ describe "strip-units" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/strip-units")
6
+ end
7
+
8
+ context "called with px" do
9
+ it "strips units" do
10
+ expect(".px").to have_rule("width: 10")
11
+ end
12
+ end
13
+
14
+ context "called with em" do
15
+ it "strips units" do
16
+ expect(".em").to have_rule("width: 2")
17
+ end
18
+ end
19
+
20
+ context "called with rem" do
21
+ it "strips units" do
22
+ expect(".rem").to have_rule("width: 1.5")
23
+ end
24
+ end
25
+
26
+ context "called with percent" do
27
+ it "strips units" do
28
+ expect(".percent").to have_rule("width: 20")
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ require "spec_helper"
2
+
3
+ describe "tint" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("functions/tint")
6
+ end
7
+
8
+ context "called on white" do
9
+ it "still returns white" do
10
+ expect(".tint-white").to have_rule("color: white")
11
+ end
12
+ end
13
+
14
+ context "called on black" do
15
+ it "tints black" do
16
+ expect(".tint-black").to have_rule("color: gray")
17
+ end
18
+ end
19
+
20
+ context "called on red" do
21
+ it "tints red" do
22
+ expect(".tint-red").to have_rule("color: #ff4040")
23
+ end
24
+ end
25
+
26
+ context "called on gray" do
27
+ it "tints gray" do
28
+ expect(".tint-gray").to have_rule("color: #c6c6c6")
29
+ end
30
+ end
31
+ end