diff options
author | Martijn Cuppens <martijn.cuppens@gmail.com> | 2019-08-28 19:05:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-28 19:05:56 +0300 |
commit | 89f7a63ee4826b646ec659709cc170b8c45cddbc (patch) | |
tree | aab7f3991699ffe9f423a0599b9e1c75442e6d4d /test/sass | |
parent | 7a15c1a4e41b1fd46b3f26be3529abc1e2d65a4d (diff) |
Support for every property (#144)
- Support for all properties
- Shorthand mixins for margins and paddings
- Support for custom properties
- Clearer way to declare `!important` rules: `@include rfs(1rem !important)` instead of `@include rfs(1rem, true)`
- Switched to mobile first approach, still possible to switch to the `max-width` media queries if needed
- Configuration variables are changed:
- Base font size -> Base value
- Font size unit -> Unit
- `responsive-font-size` property changed to `rfs()` function (see https://github.com/twbs/rfs/issues/116)
- Dropped `responsive-font-size` mixins
- Dropped Less 2 support since we had to work with lists
- Prevent generation of `/test/expected/main.css`
- Additional tests for new implementations
- Cleanup npm scripts examples
- Code examples in `README.md` are grouped by processor and collapsed
Diffstat (limited to 'test/sass')
-rw-r--r-- | test/sass/_main.scss | 137 | ||||
-rw-r--r-- | test/sass/main.scss | 50 | ||||
-rw-r--r-- | test/sass/test-10.scss | 4 | ||||
-rw-r--r-- | test/sass/test-11.scss | 2 | ||||
-rw-r--r-- | test/sass/test-2.scss | 2 | ||||
-rw-r--r-- | test/sass/test-6.scss | 2 | ||||
-rw-r--r-- | test/sass/test-7.scss | 2 | ||||
-rw-r--r-- | test/sass/test-9.scss | 4 |
8 files changed, 146 insertions, 57 deletions
diff --git a/test/sass/_main.scss b/test/sass/_main.scss new file mode 100644 index 0000000..9a1a8e3 --- /dev/null +++ b/test/sass/_main.scss @@ -0,0 +1,137 @@ +@import "../../scss"; + +// font-size property with `px` unit +.selector-1 { + background-color: #f00; + width: 300px; + @include font-size(32px); +} + +// font-size property with `rem` unit +.selector-2 { + @include font-size(2rem); +} + +// font-size property with !important +.selector-3 { + @include font-size(2rem !important); +} + +// rfs shorthand +.selector-4 { + @include rfs(2rem); +} + +// not supported unit +.selector-5 { + @include font-size(2em); +} + +// special value +.selector-6 { + @include font-size(inherit); +} + +// font-size property inside @support-query +@supports (display: flex) { + .selector-7 { + @include rfs(28px); + } +} + +// flex property with unitless values +.selector-8 { + @include rfs(0 999 32rem, flex); +} + +// padding property +.selector-9 { + @include rfs(2rem, $property: padding); +} + +// padding shorthands +.selector-10 { + @include padding(2rem); +} + +.selector-11 { + @include padding-top(2rem); +} + +.selector-12 { + @include padding-right(2rem); +} + +.selector-13 { + @include padding-bottom(2rem); +} + +.selector-14 { + @include padding-left(2rem); +} + +// margin shorthands +.selector-15 { + @include margin(2rem); +} + +.selector-16 { + @include margin-top(2rem); +} + +.selector-17 { + @include margin-right(2rem); +} + +.selector-18 { + @include margin-bottom(2rem); +} + +.selector-19 { + @include margin-left(2rem); +} + +// Multiple values +.selector-20 { + @include margin(2rem 3rem); +} + +// Multiple values with important +.selector-21 { + @include margin(2rem 3rem !important); +} + +// Zero test +.selector-22 { + @include rfs(0); +} + +// Zero combination test +.selector-23 { + @include margin(0 3rem); +} + +// Value with comma +.selector-24 { + @include rfs(0 0 2rem #f00 #{","} 0 0 3rem #0f0, box-shadow); +} + +// Custom properties +.selector-25 { + @include rfs(3rem, --value); +} + +// Test small value +.selector-26 { + @include font-size(10px); +} + +// Negative units +.selector-27 { + @include margin(-3rem); +} + +// Small negative unit +.selector-28 { + @include margin(-.5rem); +} diff --git a/test/sass/main.scss b/test/sass/main.scss deleted file mode 100644 index c92eef6..0000000 --- a/test/sass/main.scss +++ /dev/null @@ -1,50 +0,0 @@ -@import "../../scss"; - -// responsive-font-size property with `px` unit -.selector-1 { - background-color: #f00; - width: 300px; - @include responsive-font-size(32px); -} - -// responsive-font-size property with `rem` unit -.selector-2 { - @include responsive-font-size(2rem); -} - -// responsive-font-size property with !important -.selector-3 { - @include responsive-font-size(2rem, true); -} - -// rfs shorthand -.selector-4 { - @include rfs(2rem); -} - -// not supported unit -.selector-5 { - @include responsive-font-size(2em); -} - -// special value -.selector-6 { - @include responsive-font-size(inherit); -} - -// responsive-font-size property inside @support-query -@supports (display: flex) { - .selector-7 { - @include rfs(28px); - } -} - -// responsive-font-size property without unit -.selector-8 { - @include responsive-font-size(32); -} - -// font-size shorthand -.selector-9 { - @include font-size(2rem); -} diff --git a/test/sass/test-10.scss b/test/sass/test-10.scss index 378e100..4b54c16 100644 --- a/test/sass/test-10.scss +++ b/test/sass/test-10.scss @@ -1,5 +1,5 @@ -$rfs-base-font-size: 12px; -$rfs-font-size-unit: px; +$rfs-base-value: 12px; +$rfs-unit: px; $rfs-breakpoint: 800; $rfs-breakpoint-unit: rem; $rfs-two-dimensional: true; diff --git a/test/sass/test-11.scss b/test/sass/test-11.scss new file mode 100644 index 0000000..22a4804 --- /dev/null +++ b/test/sass/test-11.scss @@ -0,0 +1,2 @@ +$rfs-mode: max-media-query; +@import "main"; diff --git a/test/sass/test-2.scss b/test/sass/test-2.scss index 9c8f267..c3420ea 100644 --- a/test/sass/test-2.scss +++ b/test/sass/test-2.scss @@ -1,2 +1,2 @@ -$enable-responsive-font-sizes: false; +$enable-rfs: false; @import "main"; diff --git a/test/sass/test-6.scss b/test/sass/test-6.scss index 926213e..4a250bf 100644 --- a/test/sass/test-6.scss +++ b/test/sass/test-6.scss @@ -1,2 +1,2 @@ -$rfs-base-font-size: 17px; +$rfs-base-value: 17px; @import "main"; diff --git a/test/sass/test-7.scss b/test/sass/test-7.scss index ceace3a..67d1404 100644 --- a/test/sass/test-7.scss +++ b/test/sass/test-7.scss @@ -1,2 +1,2 @@ -$rfs-font-size-unit: px; +$rfs-unit: px; @import "main"; diff --git a/test/sass/test-9.scss b/test/sass/test-9.scss index 84f6f73..7d9a4c1 100644 --- a/test/sass/test-9.scss +++ b/test/sass/test-9.scss @@ -1,5 +1,5 @@ -$rfs-base-font-size: 12px; -$rfs-font-size-unit: px; +$rfs-base-value: 12px; +$rfs-unit: px; $rfs-breakpoint: 800; $rfs-breakpoint-unit: rem; $rfs-two-dimensional: true; |