Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare font-size mixin for Less and add tests for font-size mixin #129

Merged
merged 3 commits into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion less.less
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
6 changes: 6 additions & 0 deletions test/expected/test-1.css
Original file line number Diff line number Diff line change
Expand Up @@ -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) ; } }
7 changes: 7 additions & 0 deletions test/expected/test-10.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; } }
3 changes: 3 additions & 0 deletions test/expected/test-2.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@

.selector-8 {
font-size: 2rem; }

.selector-9 {
font-size: 2rem; }
8 changes: 8 additions & 0 deletions test/expected/test-3.css
Original file line number Diff line number Diff line change
Expand Up @@ -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) ; } }
6 changes: 6 additions & 0 deletions test/expected/test-4.css
Original file line number Diff line number Diff line change
Expand Up @@ -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) ; } }
6 changes: 6 additions & 0 deletions test/expected/test-5.css
Original file line number Diff line number Diff line change
Expand Up @@ -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) ; } }
6 changes: 6 additions & 0 deletions test/expected/test-6.css
Original file line number Diff line number Diff line change
Expand Up @@ -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) ; } }
6 changes: 6 additions & 0 deletions test/expected/test-7.css
Original file line number Diff line number Diff line change
Expand Up @@ -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) ; } }
6 changes: 6 additions & 0 deletions test/expected/test-8.css
Original file line number Diff line number Diff line change
Expand Up @@ -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) ; } }
7 changes: 7 additions & 0 deletions test/expected/test-9.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; } }
5 changes: 5 additions & 0 deletions test/less/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@
.selector-8 {
.responsive-font-size(32);
}

// font-size shorthand
.selector-9 {
.font-size(2rem);
}
4 changes: 4 additions & 0 deletions test/postcss/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@
.selector-8 {
responsive-font-size: 32;
}

.selector-9 {
responsive-font-size: 2rem;
}
5 changes: 5 additions & 0 deletions test/sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@
.selector-8 {
@include responsive-font-size(32);
}

// font-size shorthand
.selector-9 {
@include font-size(2rem);
}
3 changes: 3 additions & 0 deletions test/stylus/main.styl
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@

.selector-8
responsive-font-size(32)

.selector-9
responsive-font-size(2rem)