From 858bd4f8d07ee77ea01c342b05e718cd88d1f4b4 Mon Sep 17 00:00:00 2001 From: Thiago da Silva Date: Thu, 28 Mar 2019 20:32:02 -0300 Subject: [PATCH] Declare font-size mixin for less and add tests --- less.less | 6 +++++- test/expected/test-1.css | 6 ++++++ test/expected/test-10.css | 7 +++++++ test/expected/test-2.css | 3 +++ test/expected/test-3.css | 8 ++++++++ test/expected/test-4.css | 6 ++++++ test/expected/test-5.css | 6 ++++++ test/expected/test-6.css | 6 ++++++ test/expected/test-7.css | 6 ++++++ test/expected/test-8.css | 6 ++++++ test/expected/test-9.css | 7 +++++++ test/less/main.less | 5 +++++ test/postcss/main.css | 4 ++++ test/sass/main.scss | 5 +++++ test/stylus/main.styl | 3 +++ 15 files changed, 83 insertions(+), 1 deletion(-) diff --git a/less.less b/less.less index e68c230f..0058ea3a 100644 --- a/less.less +++ b/less.less @@ -230,7 +230,11 @@ } } -// The responsive-font-size mixin uses RFS to rescale font sizes +// The font-size & responsive-font-size mixins use RFS to rescale font sizes +.font-size(@fs, @important: false) { + .rfs(@fs, @important); +} + .responsive-font-size(@fs, @important: false) { .rfs(@fs, @important); } diff --git a/test/expected/test-1.css b/test/expected/test-1.css index 3bed4b03..28600b35 100644 --- a/test/expected/test-1.css +++ b/test/expected/test-1.css @@ -42,3 +42,9 @@ @media (max-width: 1200px) { .selector-8 { font-size: calc(1.325rem + 0.9vw) ; } } + +.selector-9 { + font-size: 2rem; } + @media (max-width: 1200px) { + .selector-9 { + font-size: calc(1.325rem + 0.9vw) ; } } diff --git a/test/expected/test-10.css b/test/expected/test-10.css index c84a744f..44c81dcf 100644 --- a/test/expected/test-10.css +++ b/test/expected/test-10.css @@ -48,3 +48,10 @@ .selector-8 { font-size: calc(16px + 2vmin) ; min-width: 0vw; } } + +.selector-9 { + font-size: 32px; } + @media (max-width: 50rem), (max-height: 50rem) { + .selector-9 { + font-size: calc(16px + 2vmin) ; + min-width: 0vw; } } diff --git a/test/expected/test-2.css b/test/expected/test-2.css index 4f7e02bb..318a4327 100644 --- a/test/expected/test-2.css +++ b/test/expected/test-2.css @@ -24,3 +24,6 @@ .selector-8 { font-size: 2rem; } + +.selector-9 { + font-size: 2rem; } diff --git a/test/expected/test-3.css b/test/expected/test-3.css index 401fbece..0fe39d53 100644 --- a/test/expected/test-3.css +++ b/test/expected/test-3.css @@ -53,3 +53,11 @@ @media (max-width: 1200px) { .selector-8 { font-size: calc(1.325rem + 0.9vw) ; } } + +.selector-9, +.disable-responsive-font-size .selector-9, .selector-9.disable-responsive-font-size { + font-size: 2rem; } + +@media (max-width: 1200px) { + .selector-9 { + font-size: calc(1.325rem + 0.9vw) ; } } diff --git a/test/expected/test-4.css b/test/expected/test-4.css index ce0e8688..45240044 100644 --- a/test/expected/test-4.css +++ b/test/expected/test-4.css @@ -42,3 +42,9 @@ @media (max-width: 1200px) { .enable-responsive-font-size .selector-8, .selector-8.enable-responsive-font-size { font-size: calc(1.325rem + 0.9vw) ; } } + +.selector-9 { + font-size: 2rem; } + @media (max-width: 1200px) { + .enable-responsive-font-size .selector-9, .selector-9.enable-responsive-font-size { + font-size: calc(1.325rem + 0.9vw) ; } } diff --git a/test/expected/test-5.css b/test/expected/test-5.css index 461b32ba..57c0fc10 100644 --- a/test/expected/test-5.css +++ b/test/expected/test-5.css @@ -42,3 +42,9 @@ @media (max-width: 75em) { .selector-8 { font-size: calc(1.325rem + 0.9vw) ; } } + +.selector-9 { + font-size: 2rem; } + @media (max-width: 75em) { + .selector-9 { + font-size: calc(1.325rem + 0.9vw) ; } } diff --git a/test/expected/test-6.css b/test/expected/test-6.css index d4330c13..a3961f6b 100644 --- a/test/expected/test-6.css +++ b/test/expected/test-6.css @@ -42,3 +42,9 @@ @media (max-width: 1200px) { .selector-8 { font-size: calc(1.15625rem + 1.125vw) ; } } + +.selector-9 { + font-size: 2rem; } + @media (max-width: 1200px) { + .selector-9 { + font-size: calc(1.15625rem + 1.125vw) ; } } diff --git a/test/expected/test-7.css b/test/expected/test-7.css index ae43db23..3b26cb8a 100644 --- a/test/expected/test-7.css +++ b/test/expected/test-7.css @@ -42,3 +42,9 @@ @media (max-width: 1200px) { .selector-8 { font-size: calc(21.2px + 0.9vw) ; } } + +.selector-9 { + font-size: 32px; } + @media (max-width: 1200px) { + .selector-9 { + font-size: calc(21.2px + 0.9vw) ; } } diff --git a/test/expected/test-8.css b/test/expected/test-8.css index 910e0371..135044a6 100644 --- a/test/expected/test-8.css +++ b/test/expected/test-8.css @@ -42,3 +42,9 @@ @media (max-width: 1200px), (max-height: 1200px) { .selector-8 { font-size: calc(1.325rem + 0.9vmin) ; } } + +.selector-9 { + font-size: 2rem; } + @media (max-width: 1200px), (max-height: 1200px) { + .selector-9 { + font-size: calc(1.325rem + 0.9vmin) ; } } diff --git a/test/expected/test-9.css b/test/expected/test-9.css index c84a744f..44c81dcf 100644 --- a/test/expected/test-9.css +++ b/test/expected/test-9.css @@ -48,3 +48,10 @@ .selector-8 { font-size: calc(16px + 2vmin) ; min-width: 0vw; } } + +.selector-9 { + font-size: 32px; } + @media (max-width: 50rem), (max-height: 50rem) { + .selector-9 { + font-size: calc(16px + 2vmin) ; + min-width: 0vw; } } diff --git a/test/less/main.less b/test/less/main.less index e01bb61a..3302d8d8 100644 --- a/test/less/main.less +++ b/test/less/main.less @@ -43,3 +43,8 @@ .selector-8 { .responsive-font-size(32); } + +// font-size shorthand +.selector-9 { + .font-size(2rem); +} diff --git a/test/postcss/main.css b/test/postcss/main.css index d1027caf..1540a3b3 100644 --- a/test/postcss/main.css +++ b/test/postcss/main.css @@ -33,3 +33,7 @@ .selector-8 { responsive-font-size: 32; } + +.selector-9 { + responsive-font-size: 2rem; +} diff --git a/test/sass/main.scss b/test/sass/main.scss index d3ddf2b5..c92eef65 100644 --- a/test/sass/main.scss +++ b/test/sass/main.scss @@ -43,3 +43,8 @@ .selector-8 { @include responsive-font-size(32); } + +// font-size shorthand +.selector-9 { + @include font-size(2rem); +} diff --git a/test/stylus/main.styl b/test/stylus/main.styl index 8257e444..644bd9a2 100644 --- a/test/stylus/main.styl +++ b/test/stylus/main.styl @@ -26,3 +26,6 @@ .selector-8 responsive-font-size(32) + +.selector-9 + responsive-font-size(2rem)