doggystyle 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.hound.yml +5 -0
- data/.npmignore +18 -0
- data/.ruby-version +1 -0
- data/.scss-lint.yml +243 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/RELEASING.md +1 -0
- data/Rakefile +9 -0
- data/bin/doggystyle +5 -0
- data/bower.json +38 -0
- data/circle.yml +13 -0
- data/core/_imports.scss +229 -0
- data/core/animations/_jump.scss +7 -0
- data/core/animations/_shake.scss +24 -0
- data/core/animations/_wobble.scss +8 -0
- data/core/functions/_mobile-first.scss +3 -0
- data/core/functions/_opposite-direction.scss +45 -0
- data/core/functions/casts/_to-bool.scss +19 -0
- data/core/functions/casts/_to-color.scss +74 -0
- data/core/functions/casts/_to-list.scss +38 -0
- data/core/functions/casts/_to-map.scss +27 -0
- data/core/functions/casts/_to-null.scss +15 -0
- data/core/functions/casts/_to-number.scss +66 -0
- data/core/functions/casts/_to-string.scss +15 -0
- data/core/functions/colours/_colour-contrast.scss +61 -0
- data/core/functions/colours/_colour.scss +69 -0
- data/core/functions/colours/_random-colour.scss +78 -0
- data/core/functions/lists/_contains.scss +62 -0
- data/core/functions/lists/_first.scss +19 -0
- data/core/functions/lists/_insert-nth.scss +37 -0
- data/core/functions/lists/_last.scss +11 -0
- data/core/functions/lists/_merge.scss +30 -0
- data/core/functions/lists/_prepend.scss +11 -0
- data/core/functions/lists/_remove-nth.scss +53 -0
- data/core/functions/lists/_remove.scss +30 -0
- data/core/functions/lists/_replace-nth.scss +55 -0
- data/core/functions/lists/_replace.scss +36 -0
- data/core/functions/lists/_reverse.scss +31 -0
- data/core/functions/lists/_second.scss +19 -0
- data/core/functions/lists/_shift.scss +24 -0
- data/core/functions/lists/_slice.scss +52 -0
- data/core/functions/lists/_sort.scss +51 -0
- data/core/functions/maps/_map-deep-get.scss +51 -0
- data/core/functions/maps/_map-deep-set.scss +34 -0
- data/core/functions/maps/_map-depth.scss +23 -0
- data/core/functions/maps/_map-extend.scss +47 -0
- data/core/functions/maps/_map-has-keys.scss +23 -0
- data/core/functions/maps/_map-has-nested-keys.scss +24 -0
- data/core/functions/maps/_map-set.scss +4 -0
- data/core/functions/maps/_map-zip.scss +50 -0
- data/core/functions/numbers/_add-unit.scss +54 -0
- data/core/functions/numbers/_pad.scss +16 -0
- data/core/functions/numbers/_spacer.scss +16 -0
- data/core/functions/numbers/_strip.scss +29 -0
- data/core/functions/numbers/_units.scss +17 -0
- data/core/functions/svg/_dots.scss +84 -0
- data/core/functions/svg/_fake-radius.scss +131 -0
- data/core/functions/svg/_lines.scss +76 -0
- data/core/functions/svg/_svg.scss +12 -0
- data/core/functions/text/_smart-lineheight.scss +13 -0
- data/core/functions/text/_string-explode.scss +45 -0
- data/core/functions/text/_string-replace.scss +38 -0
- data/core/helpers/_custom-elements.scss +114 -0
- data/core/helpers/_eases.scss +44 -0
- data/core/helpers/_reset.scss +282 -0
- data/core/helpers/_show-breakpoints.scss +25 -0
- data/core/helpers/_strings.scss +648 -0
- data/core/helpers/_warnings.scss +3 -0
- data/core/helpers/checks/_check.scss +69 -0
- data/core/helpers/checks/_is-absolute-length.scss +25 -0
- data/core/helpers/checks/_is-angel.scss +25 -0
- data/core/helpers/checks/_is-arglist.scss +11 -0
- data/core/helpers/checks/_is-bool.scss +23 -0
- data/core/helpers/checks/_is-calc.scss +11 -0
- data/core/helpers/checks/_is-colour.scss +23 -0
- data/core/helpers/checks/_is-dark.scss +14 -0
- data/core/helpers/checks/_is-duration.scss +15 -0
- data/core/helpers/checks/_is-false.scss +13 -0
- data/core/helpers/checks/_is-first-character.scss +11 -0
- data/core/helpers/checks/_is-frequency.scss +15 -0
- data/core/helpers/checks/_is-function.scss +44 -0
- data/core/helpers/checks/_is-integer.scss +15 -0
- data/core/helpers/checks/_is-length.scss +16 -0
- data/core/helpers/checks/_is-light.scss +14 -0
- data/core/helpers/checks/_is-list.scss +11 -0
- data/core/helpers/checks/_is-map.scss +11 -0
- data/core/helpers/checks/_is-null.scss +11 -0
- data/core/helpers/checks/_is-number.scss +19 -0
- data/core/helpers/checks/_is-percentage.scss +13 -0
- data/core/helpers/checks/_is-position.scss +16 -0
- data/core/helpers/checks/_is-pseudo.scss +24 -0
- data/core/helpers/checks/_is-relative-length.scss +25 -0
- data/core/helpers/checks/_is-resolution.scss +15 -0
- data/core/helpers/checks/_is-selector.scss +3 -0
- data/core/helpers/checks/_is-string.scss +11 -0
- data/core/helpers/checks/_is-time.scss +15 -0
- data/core/helpers/checks/_is-unit.scss +16 -0
- data/core/helpers/private/_arglist-to-list.scss +36 -0
- data/core/helpers/private/_brightness.scss +13 -0
- data/core/helpers/private/_find-digits.scss +41 -0
- data/core/helpers/private/_find-integer.scss +40 -0
- data/core/helpers/private/_from-hex.scss +48 -0
- data/core/helpers/private/_from-hsl.scss +55 -0
- data/core/helpers/private/_from-rgb.scss +55 -0
- data/core/helpers/private/_get-color-value.scss +26 -0
- data/core/helpers/private/_hash-fix.scss +15 -0
- data/core/helpers/private/_hex-to-dec.scss +28 -0
- data/core/helpers/private/_length.scss +26 -0
- data/core/helpers/private/_lightness.scss +15 -0
- data/core/helpers/private/_list-items-to-strings.scss +8 -0
- data/core/helpers/private/_min-max-number.scss +12 -0
- data/core/helpers/private/_pow.scss +29 -0
- data/core/helpers/private/_string-compare.scss +38 -0
- data/core/helpers/private/_string-explode.scss +43 -0
- data/core/helpers/private/_sudo.scss +23 -0
- data/core/helpers/symbols/_arrows.scss +337 -0
- data/core/helpers/symbols/_block.scss +97 -0
- data/core/helpers/symbols/_box.scss +385 -0
- data/core/helpers/symbols/_common.scss +101 -0
- data/core/helpers/symbols/_currency.scss +82 -0
- data/core/helpers/symbols/_dingbats.scss +565 -0
- data/core/helpers/symbols/_geometric.scss +289 -0
- data/core/helpers/symbols/_letterlike.scss +235 -0
- data/core/helpers/symbols/_misc.scss +568 -0
- data/core/helpers/symbols/_operators.scss +766 -0
- data/core/helpers/symbols/_punctuation.scss +214 -0
- data/core/mixins/_align.scss +15 -0
- data/core/mixins/_animate.scss +16 -0
- data/core/mixins/_aspect-ratio.scss +86 -0
- data/core/mixins/_backface-visibility.scss +7 -0
- data/core/mixins/_background-image.scss +13 -0
- data/core/mixins/_blend.scss +10 -0
- data/core/mixins/_blendmodes.scss +24 -0
- data/core/mixins/_border-radius.scss +105 -0
- data/core/mixins/_browsers.scss +155 -0
- data/core/mixins/_bulletpoint.scss +12 -0
- data/core/mixins/_center.scss +3 -0
- data/core/mixins/_clearfix.scss +7 -0
- data/core/mixins/_columns.scss +22 -0
- data/core/mixins/_custom-property.scss +15 -0
- data/core/mixins/_devices.scss +97 -0
- data/core/mixins/_dropdown.scss +38 -0
- data/core/mixins/_fake-radius.scss +99 -0
- data/core/mixins/_filters.scss +163 -0
- data/core/mixins/_flip.scss +11 -0
- data/core/mixins/_font-face.scss +11 -0
- data/core/mixins/_fontsize.scss +126 -0
- data/core/mixins/_gallery.scss +134 -0
- data/core/mixins/_gradient.scss +72 -0
- data/core/mixins/_image-size.scss +18 -0
- data/core/mixins/_image.scss +12 -0
- data/core/mixins/_inputs.scss +18 -0
- data/core/mixins/_keyframes.scss +8 -0
- data/core/mixins/_last.scss +5 -0
- data/core/mixins/_nth-last.scss +7 -0
- data/core/mixins/_nth.scss +10 -0
- data/core/mixins/_placeholder.scss +15 -0
- data/core/mixins/_prefixer.scss +55 -0
- data/core/mixins/_selection.scss +15 -0
- data/core/mixins/_shadow.scss +7 -0
- data/core/mixins/_size.scss +13 -0
- data/core/mixins/_smart-horizontal.scss +21 -0
- data/core/mixins/_sudo-image.scss +12 -0
- data/core/mixins/_text-shadow.scss +30 -0
- data/core/mixins/_transforms.scss +264 -0
- data/core/mixins/_transition.scss +189 -0
- data/core/mixins/_triangle-classic.scss +170 -0
- data/core/mixins/_triangle.scss +250 -0
- data/core/mixins/_unwrap.scss +5 -0
- data/core/mixins/_user-select.scss +5 -0
- data/core/mixins/_vertical.scss +10 -0
- data/core/mixins/columns/_columns.scss +92 -0
- data/core/mixins/flexbox/_flex-container.scss +201 -0
- data/core/mixins/flexbox/_flex-grid.scss +235 -0
- data/core/mixins/flexbox/_flex-items.scss +140 -0
- data/core/mixins/flexbox/_flex-remove.scss +12 -0
- data/core/mixins/grid/_break-between.scss +6 -0
- data/core/mixins/grid/_grid.scss +150 -0
- data/core/mixins/svg/_svg-size.scss +4 -0
- data/core/mixins/svg/_svg.scss +9 -0
- data/core/placeholders/_clear.scss +27 -0
- data/core/placeholders/_cursor.scss +35 -0
- data/core/placeholders/_misc.scss +20 -0
- data/core/placeholders/_rendering.scss +21 -0
- data/core/placeholders/_text.scss +41 -0
- data/core/settings/_colours.scss +30 -0
- data/core/settings/_directories.scss +7 -0
- data/core/settings/_global.scss +14 -0
- data/core/settings/_grid.scss +24 -0
- data/core/settings/_padding.scss +8 -0
- data/core/settings/_spacing.scss +8 -0
- data/core/settings/_text.scss +13 -0
- data/doggystyle.gemspec +29 -0
- data/eyeglass-exports.js +7 -0
- data/features/install.feature +29 -0
- data/features/step_definitions/doggystyle_steps.rb +31 -0
- data/features/support/bourbon_support.rb +19 -0
- data/features/support/env.rb +1 -0
- data/features/update.feature +30 -0
- data/features/version.feature +5 -0
- data/index.js +7 -0
- data/lib/doggystyle.rb +7 -0
- data/lib/doggystyle/generator.rb +81 -0
- data/lib/doggystyle/version.rb +3 -0
- data/package.json +33 -0
- data/spec/doggystyle/library/border_color_spec.rb +51 -0
- data/spec/doggystyle/library/border_radius_spec.rb +25 -0
- data/spec/doggystyle/library/border_style_spec.rb +51 -0
- data/spec/doggystyle/library/border_width_spec.rb +51 -0
- data/spec/doggystyle/library/buttons_spec.rb +53 -0
- data/spec/doggystyle/library/clearfix_spec.rb +18 -0
- data/spec/doggystyle/library/contrast_switch_spec.rb +23 -0
- data/spec/doggystyle/library/ellipsis_spec.rb +20 -0
- data/spec/doggystyle/library/font_face_spec_1.rb +16 -0
- data/spec/doggystyle/library/font_face_spec_2.rb +21 -0
- data/spec/doggystyle/library/font_face_spec_3.rb +16 -0
- data/spec/doggystyle/library/font_face_spec_4.rb +17 -0
- data/spec/doggystyle/library/font_stacks_spec.rb +40 -0
- data/spec/doggystyle/library/hide_text_spec.rb +17 -0
- data/spec/doggystyle/library/hide_visually_spec.rb +35 -0
- data/spec/doggystyle/library/margin_spec.rb +51 -0
- data/spec/doggystyle/library/modular_scale_spec.rb +43 -0
- data/spec/doggystyle/library/padding_spec.rb +51 -0
- data/spec/doggystyle/library/position_spec.rb +67 -0
- data/spec/doggystyle/library/prefixer_spec.rb +34 -0
- data/spec/doggystyle/library/shade_spec.rb +31 -0
- data/spec/doggystyle/library/size_spec.rb +31 -0
- data/spec/doggystyle/library/strip_unit_spec.rb +31 -0
- data/spec/doggystyle/library/text_inputs_spec.rb +75 -0
- data/spec/doggystyle/library/tint_spec.rb +31 -0
- data/spec/doggystyle/library/triangle_spec.rb +31 -0
- data/spec/doggystyle/library/word_wrap_spec.rb +29 -0
- data/spec/doggystyle/utilities/assign_inputs_spec.rb +50 -0
- data/spec/doggystyle/utilities/collapse_directionals.rb +25 -0
- data/spec/doggystyle/utilities/directional_values_spec.rb +21 -0
- data/spec/doggystyle/utilities/font_source_declaration_spec.rb +29 -0
- data/spec/doggystyle/utilities/retrieve_bourbon_setting_spec.rb +31 -0
- data/spec/doggystyle/utilities/unpack_spec.rb +32 -0
- data/spec/doggystyle/validators/contains_spec.rb +27 -0
- data/spec/doggystyle/validators/is_length_spec.rb +49 -0
- data/spec/doggystyle/validators/is_light_spec.rb +37 -0
- data/spec/doggystyle/validators/is_number_spec.rb +43 -0
- data/spec/doggystyle/validators/is_size_spec.rb +43 -0
- data/spec/fixtures/_setup.scss +1 -0
- data/spec/fixtures/library/border-color.scss +26 -0
- data/spec/fixtures/library/border-radius.scss +17 -0
- data/spec/fixtures/library/border-style.scss +21 -0
- data/spec/fixtures/library/border-width.scss +21 -0
- data/spec/fixtures/library/buttons.scss +17 -0
- data/spec/fixtures/library/clearfix.scss +5 -0
- data/spec/fixtures/library/contrast-switch.scss +9 -0
- data/spec/fixtures/library/ellipsis.scss +5 -0
- data/spec/fixtures/library/font-face-1.scss +6 -0
- data/spec/fixtures/library/font-face-2.scss +10 -0
- data/spec/fixtures/library/font-face-3.scss +8 -0
- data/spec/fixtures/library/font-face-4.scss +7 -0
- data/spec/fixtures/library/font-stacks.scss +41 -0
- data/spec/fixtures/library/hide-text.scss +5 -0
- data/spec/fixtures/library/hide-visually.scss +9 -0
- data/spec/fixtures/library/margin.scss +21 -0
- data/spec/fixtures/library/modular-scale.scss +29 -0
- data/spec/fixtures/library/padding.scss +21 -0
- data/spec/fixtures/library/position.scss +25 -0
- data/spec/fixtures/library/prefixer.scss +13 -0
- data/spec/fixtures/library/shade.scss +17 -0
- data/spec/fixtures/library/size.scss +13 -0
- data/spec/fixtures/library/strip-unit.scss +17 -0
- data/spec/fixtures/library/text-inputs.scss +21 -0
- data/spec/fixtures/library/tint.scss +17 -0
- data/spec/fixtures/library/triangle.scss +9 -0
- data/spec/fixtures/library/word-wrap.scss +9 -0
- data/spec/fixtures/utilities/assign-inputs.scss +19 -0
- data/spec/fixtures/utilities/collapse-directionals.scss +17 -0
- data/spec/fixtures/utilities/directional-values.scss +13 -0
- data/spec/fixtures/utilities/font-source-declaration.scss +11 -0
- data/spec/fixtures/utilities/retrieve-bourbon-setting.scss +16 -0
- data/spec/fixtures/utilities/unpack.scss +17 -0
- data/spec/fixtures/validators/contains.scss +28 -0
- data/spec/fixtures/validators/is-length.scss +35 -0
- data/spec/fixtures/validators/is-light.scss +29 -0
- data/spec/fixtures/validators/is-number.scss +31 -0
- data/spec/fixtures/validators/is-size.scss +31 -0
- data/spec/spec_helper.rb +22 -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
- metadata +527 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "modular-scale" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("library/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.5em")
|
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.75em")
|
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.024em")
|
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.5625em")
|
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.125em")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "padding" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("library/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("library/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,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "prefixer" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("library/prefixer")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with no prefixes" do
|
9
|
+
it "outputs the spec" do
|
10
|
+
rule = "appearance: none;"
|
11
|
+
|
12
|
+
expect(".prefix").to have_ruleset(rule)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "called with one prefix" do
|
17
|
+
it "applies the prefix to the property" do
|
18
|
+
rule = "-webkit-appearance: none; " +
|
19
|
+
"appearance: none;"
|
20
|
+
|
21
|
+
expect(".prefix--webkit").to have_ruleset(rule)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "called with multiple prefixes" do
|
26
|
+
it "applies the prefixes to the property" do
|
27
|
+
rule = "-moz-appearance: none; " +
|
28
|
+
"-ms-appearance: none; " +
|
29
|
+
"appearance: none;"
|
30
|
+
|
31
|
+
expect(".prefix--moz-ms").to have_ruleset(rule)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "shade" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("library/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 "size" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("library/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,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "strip-unit" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("library/strip-unit")
|
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,75 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "text-inputs" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("library/text-inputs")
|
6
|
+
|
7
|
+
@inputs_list = %w(
|
8
|
+
[type='color']
|
9
|
+
[type='date']
|
10
|
+
[type='datetime']
|
11
|
+
[type='datetime-local']
|
12
|
+
[type='email']
|
13
|
+
[type='month']
|
14
|
+
[type='number']
|
15
|
+
[type='password']
|
16
|
+
[type='search']
|
17
|
+
[type='tel']
|
18
|
+
[type='text']
|
19
|
+
[type='time']
|
20
|
+
[type='url']
|
21
|
+
[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
|
+
|
66
|
+
context "expands invalid text inputs" do
|
67
|
+
it "finds selectors" do
|
68
|
+
list = @inputs_list.map { |input| "#{input}:invalid" }
|
69
|
+
list = list.join(", ")
|
70
|
+
ruleset = "content: #{list};"
|
71
|
+
|
72
|
+
expect(".all-text-inputs-invalid").to have_ruleset(ruleset)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "tint" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("library/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
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "triangle" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("library/triangle")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with defaults" do
|
9
|
+
it "outputs the properties" do
|
10
|
+
ruleset = "border-style: solid; " +
|
11
|
+
"height: 0; " +
|
12
|
+
"width: 0; " +
|
13
|
+
"border-color: transparent transparent currentColor; " +
|
14
|
+
"border-width: 0 0.5rem 0.5rem;"
|
15
|
+
|
16
|
+
expect(".triangle").to have_ruleset(ruleset)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "called with arguments" do
|
21
|
+
it "outputs the properties" do
|
22
|
+
ruleset = "border-style: solid; " +
|
23
|
+
"height: 0; " +
|
24
|
+
"width: 0; " +
|
25
|
+
"border-color: #b25c9c transparent transparent; " +
|
26
|
+
"border-width: 20px 15px 0;"
|
27
|
+
|
28
|
+
expect(".triangle--with-arguments").to have_ruleset(ruleset)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "word-wrap" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("library/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
|