From 2b1e20ca81f406f3415df8c93c6e3b4874fd0150 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 17 Dec 2020 16:22:43 -0800 Subject: [PATCH 1/3] Move plain CSS function specs into a dedicated directory --- .../css/{functions.hrx => functions/error.hrx} | 18 +++++++++--------- spec/css/{ => functions}/min_max/error.hrx | 0 spec/css/{ => functions}/min_max/plain_css.hrx | 0 .../{ => functions}/min_max/sass_function.hrx | 0 spec/css/{ => functions}/url.hrx | 0 5 files changed, 9 insertions(+), 9 deletions(-) rename spec/css/{functions.hrx => functions/error.hrx} (69%) rename spec/css/{ => functions}/min_max/error.hrx (100%) rename spec/css/{ => functions}/min_max/plain_css.hrx (100%) rename spec/css/{ => functions}/min_max/sass_function.hrx (100%) rename spec/css/{ => functions}/url.hrx (100%) diff --git a/spec/css/functions.hrx b/spec/css/functions/error.hrx similarity index 69% rename from spec/css/functions.hrx rename to spec/css/functions/error.hrx index a387d1cfc1..d7cc8a1ee4 100644 --- a/spec/css/functions.hrx +++ b/spec/css/functions/error.hrx @@ -1,7 +1,7 @@ -<===> error/single_equals/no_lhs/input.scss +<===> single_equals/no_lhs/input.scss a {b: c(=d)} -<===> error/single_equals/no_lhs/error +<===> single_equals/no_lhs/error Error: expected ")". , 1 | a {b: c(=d)} @@ -9,7 +9,7 @@ Error: expected ")". ' input.scss 1:9 root stylesheet -<===> error/single_equals/no_lhs/error-libsass +<===> single_equals/no_lhs/error-libsass Error: Invalid CSS after "a {b: c(": expected expression (e.g. 1px, bold), was "=d)}" on line 1:8 of input.scss >> a {b: c(=d)} @@ -18,10 +18,10 @@ Error: Invalid CSS after "a {b: c(": expected expression (e.g. 1px, bold), was " <===> ================================================================================ -<===> error/single_equals/no_rhs/input.scss +<===> single_equals/no_rhs/input.scss a {b: c(d=)} -<===> error/single_equals/no_rhs/error +<===> single_equals/no_rhs/error Error: Expected expression. , 1 | a {b: c(d=)} @@ -29,7 +29,7 @@ Error: Expected expression. ' input.scss 1:11 root stylesheet -<===> error/single_equals/no_rhs/error-libsass +<===> single_equals/no_rhs/error-libsass Error: Invalid CSS after "a {b: c(d": expected expression (e.g. 1px, bold), was "=)}" on line 1:9 of input.scss >> a {b: c(d=)} @@ -38,10 +38,10 @@ Error: Invalid CSS after "a {b: c(d": expected expression (e.g. 1px, bold), was <===> ================================================================================ -<===> error/single_equals/no_lhs_or_rhs/input.scss +<===> single_equals/no_lhs_or_rhs/input.scss a {b: c(=)} -<===> error/single_equals/no_lhs_or_rhs/error +<===> single_equals/no_lhs_or_rhs/error Error: expected ")". , 1 | a {b: c(=)} @@ -49,7 +49,7 @@ Error: expected ")". ' input.scss 1:9 root stylesheet -<===> error/single_equals/no_lhs_or_rhs/error-libsass +<===> single_equals/no_lhs_or_rhs/error-libsass Error: Invalid CSS after "a {b: c(": expected expression (e.g. 1px, bold), was "=)}" on line 1:8 of input.scss >> a {b: c(=)} diff --git a/spec/css/min_max/error.hrx b/spec/css/functions/min_max/error.hrx similarity index 100% rename from spec/css/min_max/error.hrx rename to spec/css/functions/min_max/error.hrx diff --git a/spec/css/min_max/plain_css.hrx b/spec/css/functions/min_max/plain_css.hrx similarity index 100% rename from spec/css/min_max/plain_css.hrx rename to spec/css/functions/min_max/plain_css.hrx diff --git a/spec/css/min_max/sass_function.hrx b/spec/css/functions/min_max/sass_function.hrx similarity index 100% rename from spec/css/min_max/sass_function.hrx rename to spec/css/functions/min_max/sass_function.hrx diff --git a/spec/css/url.hrx b/spec/css/functions/url.hrx similarity index 100% rename from spec/css/url.hrx rename to spec/css/functions/url.hrx From b9f43f01d18bd901ede7e04dbc02f5ebc3b387ac Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 17 Dec 2020 16:36:28 -0800 Subject: [PATCH 2/3] Add specs for plain-CSS clamp() Closes #1599 See sass/sass#2860 --- .../color/hsl/four_args/special_functions.hrx | 41 +++++++++++ .../color/hsl/one_arg/special_functions.hrx | 70 +++++++++++++++++++ .../hsl/three_args/special_functions.hrx | 8 ++- .../hsla/four_args/special_functions.hrx | 60 ++++++++++++++++ .../color/hsla/one_arg/special_functions.hrx | 70 +++++++++++++++++++ .../hsla/three_args/special_functions.hrx | 7 ++ .../color/rgb/four_args/special_functions.hrx | 40 +++++++++++ .../color/rgb/one_arg/special_functions.hrx | 70 +++++++++++++++++++ .../rgb/three_args/special_functions.hrx | 45 ++++++++++++ .../rgba/four_args/special_functions.hrx | 60 ++++++++++++++++ .../color/rgba/one_arg/special_functions.hrx | 70 +++++++++++++++++++ .../rgba/three_args/special_functions.hrx | 31 ++++++++ spec/css/functions/min_max/plain_css.hrx | 2 + spec/css/functions/special.hrx | 34 +++++++++ 14 files changed, 607 insertions(+), 1 deletion(-) create mode 100644 spec/css/functions/special.hrx diff --git a/spec/core_functions/color/hsl/four_args/special_functions.hrx b/spec/core_functions/color/hsl/four_args/special_functions.hrx index 35966d687f..0c3c34d9e9 100644 --- a/spec/core_functions/color/hsl/four_args/special_functions.hrx +++ b/spec/core_functions/color/hsl/four_args/special_functions.hrx @@ -203,3 +203,44 @@ a { b: hsl(1, 2%, 3%, max(0.4)); } + +<===> +================================================================================ +<===> clamp/arg_1/input.scss +a {b: hsl(clamp(1, 2, 3), 2%, 3%, 0.4)} + +<===> clamp/arg_1/output.css +a { + b: hsl(clamp(1, 2, 3), 2%, 3%, 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_2/input.scss +a {b: hsl(1, clamp(2%, 3%, 4%), 3%, 0.4)} + +<===> clamp/arg_2/output.css +a { + b: hsl(1, clamp(2%, 3%, 4%), 3%, 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_3/input.scss +a {b: hsl(1, 2%, clamp(3%, 4%, 5%), 0.4)} + +<===> clamp/arg_3/output.css +a { + b: hsl(1, 2%, clamp(3%, 4%, 5%), 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_4/input.scss +a {b: hsl(1, 2%, 3%, clamp(0.4, 0.5, 0.6))} + +<===> clamp/arg_4/output.css +a { + b: hsl(1, 2%, 3%, clamp(0.4, 0.5, 0.6)); +} + diff --git a/spec/core_functions/color/hsl/one_arg/special_functions.hrx b/spec/core_functions/color/hsl/one_arg/special_functions.hrx index c7925ad95b..b135b59dc2 100644 --- a/spec/core_functions/color/hsl/one_arg/special_functions.hrx +++ b/spec/core_functions/color/hsl/one_arg/special_functions.hrx @@ -154,6 +154,36 @@ a { b: hsl(1, 2%, max(3%)); } +<===> +================================================================================ +<===> no_alpha/clamp/arg_1/input.scss +a {b: hsl(clamp(1, 2, 3) 2% 3%)} + +<===> no_alpha/clamp/arg_1/output.css +a { + b: hsl(clamp(1, 2, 3), 2%, 3%); +} + +<===> +================================================================================ +<===> no_alpha/clamp/arg_2/input.scss +a {b: hsl(1 clamp(2%, 3%, 4%) 3%)} + +<===> no_alpha/clamp/arg_2/output.css +a { + b: hsl(1, clamp(2%, 3%, 4%), 3%); +} + +<===> +================================================================================ +<===> no_alpha/clamp/arg_3/input.scss +a {b: hsl(1 2% clamp(3%, 4%, 5%))} + +<===> no_alpha/clamp/arg_3/output.css +a { + b: hsl(1, 2%, clamp(3%, 4%, 5%)); +} + <===> ================================================================================ <===> no_alpha/multi/argument/var/arg_1/of/arg_2/input.scss @@ -385,6 +415,46 @@ a { b: hsl(1 2% 3%/max(0.4)); } +<===> +================================================================================ +<===> alpha/clamp/arg_1/input.scss +a {b: hsl(clamp(1, 2, 3) 2% 3% / 0.4)} + +<===> alpha/clamp/arg_1/output.css +a { + b: hsl(clamp(1, 2, 3), 2%, 3%, 0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_2/input.scss +a {b: hsl(1 clamp(2%, 3%, 4%) 3% / 0.4)} + +<===> alpha/clamp/arg_2/output.css +a { + b: hsl(1, clamp(2%, 3%, 4%), 3%, 0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_3/input.scss +a {b: hsl(1 2% clamp(3%, 4%, 5%) / 0.4)} + +<===> alpha/clamp/arg_3/output.css +a { + b: hsl(1 2% clamp(3%, 4%, 5%)/0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_4/input.scss +a {b: hsl(1 2% 3% / clamp(0.4, 0.5, 0.6))} + +<===> alpha/clamp/arg_4/output.css +a { + b: hsl(1 2% 3%/clamp(0.4, 0.5, 0.6)); +} + <===> ================================================================================ <===> alpha/multi_argument_var/1_of_2/input.scss diff --git a/spec/core_functions/color/hsl/three_args/special_functions.hrx b/spec/core_functions/color/hsl/three_args/special_functions.hrx index 6866456e1b..db2783394a 100644 --- a/spec/core_functions/color/hsl/three_args/special_functions.hrx +++ b/spec/core_functions/color/hsl/three_args/special_functions.hrx @@ -2,7 +2,6 @@ --- :todo: - sass/libsass#2726 -:ignore_for: <===> input.scss a { @@ -25,6 +24,10 @@ a { max-1: hsl(max(1), 2%, 3%); max-2: hsl(1, max(2%), 3%); max-3: hsl(1, 2%, max(3%)); + + clamp-1: hsl(clamp(1, 2, 3), 2%, 3%); + clamp-2: hsl(1, clamp(2%, 3%, 4%), 3%); + clamp-3: hsl(1, 2%, clamp(3%, 4%, 5%)); } <===> output.css @@ -44,4 +47,7 @@ a { max-1: hsl(max(1), 2%, 3%); max-2: hsl(1, max(2%), 3%); max-3: hsl(1, 2%, max(3%)); + clamp-1: hsl(clamp(1, 2, 3), 2%, 3%); + clamp-2: hsl(1, clamp(2%, 3%, 4%), 3%); + clamp-3: hsl(1, 2%, clamp(3%, 4%, 5%)); } diff --git a/spec/core_functions/color/hsla/four_args/special_functions.hrx b/spec/core_functions/color/hsla/four_args/special_functions.hrx index 1d918f1455..d7413fba70 100644 --- a/spec/core_functions/color/hsla/four_args/special_functions.hrx +++ b/spec/core_functions/color/hsla/four_args/special_functions.hrx @@ -256,3 +256,63 @@ a { b: hsla(1, 2%, 3%, max(0.4)); } +<===> +================================================================================ +<===> clamp/arg_1/options.yml +--- +:todo: +- sass/libsass#2726 + +<===> clamp/arg_1/input.scss +a {b: hsla(clamp(1, 2, 3), 2%, 3%, 0.4)} + +<===> clamp/arg_1/output.css +a { + b: hsla(clamp(1, 2, 3), 2%, 3%, 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_2/options.yml +--- +:todo: +- sass/libsass#2726 + +<===> clamp/arg_2/input.scss +a {b: hsla(1, clamp(2%, 3%, 4%), 3%, 0.4)} + +<===> clamp/arg_2/output.css +a { + b: hsla(1, clamp(2%, 3%, 4%), 3%, 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_3/options.yml +--- +:todo: +- sass/libsass#2726 + +<===> clamp/arg_3/input.scss +a {b: hsla(1, 2%, clamp(3%, 4%, 5%), 0.4)} + +<===> clamp/arg_3/output.css +a { + b: hsla(1, 2%, clamp(3%, 4%, 5%), 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_4/options.yml +--- +:todo: +- sass/libsass#2726 + +<===> clamp/arg_4/input.scss +a {b: hsla(1, 2%, 3%, clamp(0.4, 0.5, 0.6))} + +<===> clamp/arg_4/output.css +a { + b: hsla(1, 2%, 3%, clamp(0.4, 0.5, 0.6)); +} + diff --git a/spec/core_functions/color/hsla/one_arg/special_functions.hrx b/spec/core_functions/color/hsla/one_arg/special_functions.hrx index eb84858bbd..a11bbc8020 100644 --- a/spec/core_functions/color/hsla/one_arg/special_functions.hrx +++ b/spec/core_functions/color/hsla/one_arg/special_functions.hrx @@ -153,6 +153,36 @@ a { b: hsla(1, 2%, max(3%)); } +<===> +================================================================================ +<===> no_alpha/clamp/arg_1/input.scss +a {b: hsla(clamp(1, 2, 3) 2% 3%)} + +<===> no_alpha/clamp/arg_1/output.css +a { + b: hsla(clamp(1, 2, 3), 2%, 3%); +} + +<===> +================================================================================ +<===> no_alpha/clamp/arg_2/input.scss +a {b: hsla(1 clamp(2%, 3%, 4%) 3%)} + +<===> no_alpha/clamp/arg_2/output.css +a { + b: hsla(1, clamp(2%, 3%, 4%), 3%); +} + +<===> +================================================================================ +<===> no_alpha/clamp/arg_3/input.scss +a {b: hsla(1 2% clamp(3%, 4%, 5%))} + +<===> no_alpha/clamp/arg_3/output.css +a { + b: hsla(1, 2%, clamp(3%, 4%, 5%)); +} + <===> ================================================================================ <===> no_alpha/multi_argument_var/1_of_2/input.scss @@ -384,6 +414,46 @@ a { b: hsla(1 2% 3%/max(0.4)); } +<===> +================================================================================ +<===> alpha/clamp/arg_1/input.scss +a {b: hsla(clamp(1, 2, 3) 2% 3% / 0.4)} + +<===> alpha/clamp/arg_1/output.css +a { + b: hsla(clamp(1, 2, 3), 2%, 3%, 0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_2/input.scss +a {b: hsla(1 clamp(2%, 3%, 4%) 3% / 0.4)} + +<===> alpha/clamp/arg_2/output.css +a { + b: hsla(1, clamp(2%, 3%, 4%), 3%, 0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_3/input.scss +a {b: hsla(1 2% clamp(3%, 4%, 5%) / 0.4)} + +<===> alpha/clamp/arg_3/output.css +a { + b: hsla(1 2% clamp(3%, 4%, 5%)/0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_4/input.scss +a {b: hsla(1 2% 3% / clamp(0.4, 0.5, 0.6))} + +<===> alpha/clamp/arg_4/output.css +a { + b: hsla(1 2% 3%/clamp(0.4, 0.5, 0.6)); +} + <===> ================================================================================ <===> alpha/multi_argument_var/1_of_2/input.scss diff --git a/spec/core_functions/color/hsla/three_args/special_functions.hrx b/spec/core_functions/color/hsla/three_args/special_functions.hrx index fb5ea518dc..e56e548662 100644 --- a/spec/core_functions/color/hsla/three_args/special_functions.hrx +++ b/spec/core_functions/color/hsla/three_args/special_functions.hrx @@ -24,6 +24,10 @@ a { max-1: hsla(max(1), 2%, 3%); max-2: hsla(1, max(2%), 3%); max-3: hsla(1, 2%, max(3%)); + + clamp-1: hsla(clamp(1, 2, 3), 2%, 3%); + clamp-2: hsla(1, clamp(2%, 3%, 4%), 3%); + clamp-3: hsla(1, 2%, clamp(3%, 4%, 5%)); } <===> output.css @@ -43,4 +47,7 @@ a { max-1: hsla(max(1), 2%, 3%); max-2: hsla(1, max(2%), 3%); max-3: hsla(1, 2%, max(3%)); + clamp-1: hsla(clamp(1, 2, 3), 2%, 3%); + clamp-2: hsla(1, clamp(2%, 3%, 4%), 3%); + clamp-3: hsla(1, 2%, clamp(3%, 4%, 5%)); } diff --git a/spec/core_functions/color/rgb/four_args/special_functions.hrx b/spec/core_functions/color/rgb/four_args/special_functions.hrx index c23e57c2a1..4e362649b2 100644 --- a/spec/core_functions/color/rgb/four_args/special_functions.hrx +++ b/spec/core_functions/color/rgb/four_args/special_functions.hrx @@ -203,6 +203,46 @@ a { b: rgb(1, 2, 3, max(0.4)); } +<===> +================================================================================ +<===> clamp/arg_1/input.scss +a {b: rgb(clamp(1, 2, 3), 2, 3, 0.4)} + +<===> clamp/arg_1/output.css +a { + b: rgb(clamp(1, 2, 3), 2, 3, 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_2/input.scss +a {b: rgb(1, clamp(2, 3, 4), 3, 0.4)} + +<===> clamp/arg_2/output.css +a { + b: rgb(1, clamp(2, 3, 4), 3, 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_3/input.scss +a {b: rgb(1, 2, clamp(3, 4, 5), 0.4)} + +<===> clamp/arg_3/output.css +a { + b: rgb(1, 2, clamp(3, 4, 5), 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_4/input.scss +a {b: rgb(1, 2, 3, clamp(0.4, 0.5, 0.6))} + +<===> clamp/arg_4/output.css +a { + b: rgb(1, 2, 3, clamp(0.4, 0.5, 0.6)); +} + <===> ================================================================================ <===> calc/arg_2/args/input.scss diff --git a/spec/core_functions/color/rgb/one_arg/special_functions.hrx b/spec/core_functions/color/rgb/one_arg/special_functions.hrx index bb4be2a8b5..5e8eff381e 100644 --- a/spec/core_functions/color/rgb/one_arg/special_functions.hrx +++ b/spec/core_functions/color/rgb/one_arg/special_functions.hrx @@ -153,6 +153,36 @@ a { b: rgb(1, 2, max(3)); } +<===> +================================================================================ +<===> no_alpha/clamp/arg_1/input.scss +a {b: rgb(clamp(1, 2, 3) 2 3)} + +<===> no_alpha/clamp/arg_1/output.css +a { + b: rgb(clamp(1, 2, 3), 2, 3); +} + +<===> +================================================================================ +<===> no_alpha/clamp/arg_2/input.scss +a {b: rgb(1 clamp(2, 3, 4) 3)} + +<===> no_alpha/clamp/arg_2/output.css +a { + b: rgb(1, clamp(2, 3, 4), 3); +} + +<===> +================================================================================ +<===> no_alpha/clamp/arg_3/input.scss +a {b: rgb(1 2 clamp(3, 4, 5))} + +<===> no_alpha/clamp/arg_3/output.css +a { + b: rgb(1, 2, clamp(3, 4, 5)); +} + <===> ================================================================================ <===> no_alpha/multi_argument_var/1_of_2/input.scss @@ -384,6 +414,46 @@ a { b: rgb(1 2 3/max(0.4)); } +<===> +================================================================================ +<===> alpha/clamp/arg_1/input.scss +a {b: rgb(clamp(1, 2, 3) 2 3 / 0.4)} + +<===> alpha/clamp/arg_1/output.css +a { + b: rgb(clamp(1, 2, 3), 2, 3, 0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_2/input.scss +a {b: rgb(1 clamp(2, 3, 4) 3 / 0.4)} + +<===> alpha/clamp/arg_2/output.css +a { + b: rgb(1, clamp(2, 3, 4), 3, 0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_3/input.scss +a {b: rgb(1 2 clamp(3, 4, 5) / 0.4)} + +<===> alpha/clamp/arg_3/output.css +a { + b: rgb(1 2 clamp(3, 4, 5)/0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_4/input.scss +a {b: rgb(1 2 3 / clamp(0.4, 0.5, 0.6))} + +<===> alpha/clamp/arg_4/output.css +a { + b: rgb(1 2 3/clamp(0.4, 0.5, 0.6)); +} + <===> ================================================================================ <===> alpha/multi_argument_var/1_of_2/input.scss diff --git a/spec/core_functions/color/rgb/three_args/special_functions.hrx b/spec/core_functions/color/rgb/three_args/special_functions.hrx index 5d962ec539..4cb3549467 100644 --- a/spec/core_functions/color/rgb/three_args/special_functions.hrx +++ b/spec/core_functions/color/rgb/three_args/special_functions.hrx @@ -191,3 +191,48 @@ a { b: rgb(1, 2, max(3)); } +<===> +================================================================================ +<===> clamp/arg_1/options.yml +--- +:todo: +- sass/libsass#2726 + +<===> clamp/arg_1/input.scss +a {b: rgb(clamp(1, 2, 3), 2, 3)} + +<===> clamp/arg_1/output.css +a { + b: rgb(clamp(1, 2, 3), 2, 3); +} + +<===> +================================================================================ +<===> clamp/arg_2/options.yml +--- +:todo: +- sass/libsass#2726 + +<===> clamp/arg_2/input.scss +a {b: rgb(1, clamp(2, 3, 4), 3)} + +<===> clamp/arg_2/output.css +a { + b: rgb(1, clamp(2, 3, 4), 3); +} + +<===> +================================================================================ +<===> clamp/arg_3/options.yml +--- +:todo: +- sass/libsass#2726 + +<===> clamp/arg_3/input.scss +a {b: rgb(1, 2, clamp(3, 4, 5))} + +<===> clamp/arg_3/output.css +a { + b: rgb(1, 2, clamp(3, 4, 5)); +} + diff --git a/spec/core_functions/color/rgba/four_args/special_functions.hrx b/spec/core_functions/color/rgba/four_args/special_functions.hrx index b492ece141..ed89508d75 100644 --- a/spec/core_functions/color/rgba/four_args/special_functions.hrx +++ b/spec/core_functions/color/rgba/four_args/special_functions.hrx @@ -256,6 +256,66 @@ a { b: rgba(1, 2, 3, max(0.4)); } +<===> +================================================================================ +<===> clamp/arg_1/options.yml +--- +:todo: +- sass/libsass#2726 + +<===> clamp/arg_1/input.scss +a {b: rgba(clamp(1, 2, 3), 2, 3, 0.4)} + +<===> clamp/arg_1/output.css +a { + b: rgba(clamp(1, 2, 3), 2, 3, 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_2/options.yml +--- +:todo: +- sass/libsass#2726 + +<===> clamp/arg_2/input.scss +a {b: rgba(1, clamp(2, 3, 4), 3, 0.4)} + +<===> clamp/arg_2/output.css +a { + b: rgba(1, clamp(2, 3, 4), 3, 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_3/options.yml +--- +:todo: +- sass/libsass#2726 + +<===> clamp/arg_3/input.scss +a {b: rgba(1, 2, clamp(3, 4, 5), 0.4)} + +<===> clamp/arg_3/output.css +a { + b: rgba(1, 2, clamp(3, 4, 5), 0.4); +} + +<===> +================================================================================ +<===> clamp/arg_4/options.yml +--- +:todo: +- sass/libsass#2726 + +<===> clamp/arg_4/input.scss +a {b: rgba(1, 2, 3, clamp(0.4, 0.5, 0.6))} + +<===> clamp/arg_4/output.css +a { + b: rgba(1, 2, 3, clamp(0.4, 0.5, 0.6)); +} + <===> ================================================================================ <===> calc/arg_2/args/input.scss diff --git a/spec/core_functions/color/rgba/one_arg/special_functions.hrx b/spec/core_functions/color/rgba/one_arg/special_functions.hrx index 8a3c4da094..85ca76a47a 100644 --- a/spec/core_functions/color/rgba/one_arg/special_functions.hrx +++ b/spec/core_functions/color/rgba/one_arg/special_functions.hrx @@ -153,6 +153,36 @@ a { b: rgba(1, 2, max(3)); } +<===> +================================================================================ +<===> no_alpha/clamp/arg_1/input.scss +a {b: rgba(clamp(1, 2, 3) 2 3)} + +<===> no_alpha/clamp/arg_1/output.css +a { + b: rgba(clamp(1, 2, 3), 2, 3); +} + +<===> +================================================================================ +<===> no_alpha/clamp/arg_2/input.scss +a {b: rgba(1 clamp(2, 3, 4) 3)} + +<===> no_alpha/clamp/arg_2/output.css +a { + b: rgba(1, clamp(2, 3, 4), 3); +} + +<===> +================================================================================ +<===> no_alpha/clamp/arg_3/input.scss +a {b: rgba(1 2 clamp(3, 4, 5))} + +<===> no_alpha/clamp/arg_3/output.css +a { + b: rgba(1, 2, clamp(3, 4, 5)); +} + <===> ================================================================================ <===> no_alpha/multi_argument_var/1_of_2/input.scss @@ -384,6 +414,46 @@ a { b: rgba(1 2 3/max(0.4)); } +<===> +================================================================================ +<===> alpha/clamp/arg_1/input.scss +a {b: rgba(clamp(1, 2, 3) 2 3 / 0.4)} + +<===> alpha/clamp/arg_1/output.css +a { + b: rgba(clamp(1, 2, 3), 2, 3, 0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_2/input.scss +a {b: rgba(1 clamp(2, 3, 4) 3 / 0.4)} + +<===> alpha/clamp/arg_2/output.css +a { + b: rgba(1, clamp(2, 3, 4), 3, 0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_3/input.scss +a {b: rgba(1 2 clamp(3, 4, 5) / 0.4)} + +<===> alpha/clamp/arg_3/output.css +a { + b: rgba(1 2 clamp(3, 4, 5)/0.4); +} + +<===> +================================================================================ +<===> alpha/clamp/arg_4/input.scss +a {b: rgba(1 2 3 / clamp(0.4, 0.5, 0.6))} + +<===> alpha/clamp/arg_4/output.css +a { + b: rgba(1 2 3/clamp(0.4, 0.5, 0.6)); +} + <===> ================================================================================ <===> alpha/multi_argument_var/1_of_2/input.scss diff --git a/spec/core_functions/color/rgba/three_args/special_functions.hrx b/spec/core_functions/color/rgba/three_args/special_functions.hrx index d3e9399b83..572fe5c1af 100644 --- a/spec/core_functions/color/rgba/three_args/special_functions.hrx +++ b/spec/core_functions/color/rgba/three_args/special_functions.hrx @@ -153,3 +153,34 @@ a { b: rgba(1, 2, max(3)); } + +<===> +================================================================================ +<===> clamp/arg_1/input.scss +a {b: rgba(clamp(1, 2, 3), 2, 3)} + +<===> clamp/arg_1/output.css +a { + b: rgba(clamp(1, 2, 3), 2, 3); +} + +<===> +================================================================================ +<===> clamp/arg_2/input.scss +a {b: rgba(1, clamp(2, 3, 4), 3)} + +<===> clamp/arg_2/output.css +a { + b: rgba(1, clamp(2, 3, 4), 3); +} + +<===> +================================================================================ +<===> clamp/arg_3/input.scss +a {b: rgba(1, 2, clamp(3, 4, 5))} + +<===> clamp/arg_3/output.css +a { + b: rgba(1, 2, clamp(3, 4, 5)); +} + diff --git a/spec/css/functions/min_max/plain_css.hrx b/spec/css/functions/min_max/plain_css.hrx index 71001638eb..1bf63f079d 100644 --- a/spec/css/functions/min_max/plain_css.hrx +++ b/spec/css/functions/min_max/plain_css.hrx @@ -16,6 +16,7 @@ max(env(--foo), env(@&[*^{$(*)&}@^]%$), env(inter#{p + o}lated)); var: min(var(--foo), var(@&[*^{$(*)&}@^]%$), var(inter#{p + o}lated)) max(var(--foo), var(@&[*^{$(*)&}@^]%$), var(inter#{p + o}lated)); + clamp: min(clamp(1, 2, 3)) max(clamp(1, 2, 3)); operations: min(1px - 2px * 3px / 4px) max(1px - 2px * 3px / 4px); parens: min((1px + 2px) * 3px) max((1px + 2px) * 3px); two-arguments: min(1px, 2px) max(1px, 2px); @@ -31,6 +32,7 @@ calc: min(calc(10% + 1px)) max(calc(10% + 1px)); env: min(env(--foo), env(@&[*^{$(*)&}@^]%$), env(interpolated)) max(env(--foo), env(@&[*^{$(*)&}@^]%$), env(interpolated)); var: min(var(--foo), var(@&[*^{$(*)&}@^]%$), var(interpolated)) max(var(--foo), var(@&[*^{$(*)&}@^]%$), var(interpolated)); + clamp: min(clamp(1, 2, 3)) max(clamp(1, 2, 3)); operations: min(1px - 2px * 3px / 4px) max(1px - 2px * 3px / 4px); parens: min((1px + 2px) * 3px) max((1px + 2px) * 3px); two-arguments: min(1px, 2px) max(1px, 2px); diff --git a/spec/css/functions/special.hrx b/spec/css/functions/special.hrx new file mode 100644 index 0000000000..0e3b4da296 --- /dev/null +++ b/spec/css/functions/special.hrx @@ -0,0 +1,34 @@ +<===> options.yml +--- +:ignore_for: +- libsass + +<===> +================================================================================ +<===> clamp/numbers/input.scss +a {b: clamp(0, 1, 2)} + +<===> clamp/numbers/output.css +a { + b: clamp(0, 1, 2); +} + +<===> +================================================================================ +<===> clamp/punctuation/input.scss +a {b: clamp(@#$%^&*({[]})_-+=|\\:""''<>,.?/)} + +<===> clamp/punctuation/output.css +a { + b: clamp(@#$%^&*({[]})_-+=|\\:""""<>,.?/); +} + +<===> +================================================================================ +<===> clamp/interpolation/input.scss +a {b: clamp(#{0}, #{1}, #{2})} + +<===> clamp/interpolation/output.css +a { + b: clamp(0, 1, 2); +} From eed79d84bebd9f7c1a2a7695b88fa720c686b651 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 22 Dec 2020 15:17:10 -0800 Subject: [PATCH 3/3] Code review --- .../hsla/four_args/special_functions.hrx | 76 +++---------------- 1 file changed, 12 insertions(+), 64 deletions(-) diff --git a/spec/core_functions/color/hsla/four_args/special_functions.hrx b/spec/core_functions/color/hsla/four_args/special_functions.hrx index d7413fba70..7a340de7a8 100644 --- a/spec/core_functions/color/hsla/four_args/special_functions.hrx +++ b/spec/core_functions/color/hsla/four_args/special_functions.hrx @@ -78,11 +78,13 @@ a { <===> ================================================================================ -<===> env/arg_1/options.yml +<===> env/options.yml --- :todo: - sass/libsass#2726 +<===> +================================================================================ <===> env/arg_1/input.scss a {b: hsla(env(--foo), 2%, 3%, 0.4)} @@ -93,11 +95,6 @@ a { <===> ================================================================================ -<===> env/arg_2/options.yml ---- -:todo: -- sass/libsass#2726 - <===> env/arg_2/input.scss a {b: hsla(1, env(--foo), 3%, 0.4)} @@ -108,11 +105,6 @@ a { <===> ================================================================================ -<===> env/arg_3/options.yml ---- -:todo: -- sass/libsass#2726 - <===> env/arg_3/input.scss a {b: hsla(1, 2%, env(--foo), 0.4)} @@ -123,11 +115,6 @@ a { <===> ================================================================================ -<===> env/arg_4/options.yml ---- -:todo: -- sass/libsass#2726 - <===> env/arg_4/input.scss a {b: hsla(1, 2%, 3%, env(--foo))} @@ -138,11 +125,13 @@ a { <===> ================================================================================ -<===> min/arg_1/options.yml +<===> min/options.yml --- :todo: - sass/libsass#2726 +<===> +================================================================================ <===> min/arg_1/input.scss a {b: hsla(min(1), 2%, 3%, 0.4)} @@ -153,11 +142,6 @@ a { <===> ================================================================================ -<===> min/arg_2/options.yml ---- -:todo: -- sass/libsass#2726 - <===> min/arg_2/input.scss a {b: hsla(1, min(2%), 3%, 0.4)} @@ -168,11 +152,6 @@ a { <===> ================================================================================ -<===> min/arg_3/options.yml ---- -:todo: -- sass/libsass#2726 - <===> min/arg_3/input.scss a {b: hsla(1, 2%, min(3%), 0.4)} @@ -183,11 +162,6 @@ a { <===> ================================================================================ -<===> min/arg_4/options.yml ---- -:todo: -- sass/libsass#2726 - <===> min/arg_4/input.scss a {b: hsla(1, 2%, 3%, min(0.4))} @@ -198,11 +172,13 @@ a { <===> ================================================================================ -<===> max/arg_1/options.yml +<===> max/options.yml --- :todo: - sass/libsass#2726 +<===> +================================================================================ <===> max/arg_1/input.scss a {b: hsla(max(1), 2%, 3%, 0.4)} @@ -213,11 +189,6 @@ a { <===> ================================================================================ -<===> max/arg_2/options.yml ---- -:todo: -- sass/libsass#2726 - <===> max/arg_2/input.scss a {b: hsla(1, max(2%), 3%, 0.4)} @@ -228,11 +199,6 @@ a { <===> ================================================================================ -<===> max/arg_3/options.yml ---- -:todo: -- sass/libsass#2726 - <===> max/arg_3/input.scss a {b: hsla(1, 2%, max(3%), 0.4)} @@ -243,11 +209,6 @@ a { <===> ================================================================================ -<===> max/arg_4/options.yml ---- -:todo: -- sass/libsass#2726 - <===> max/arg_4/input.scss a {b: hsla(1, 2%, 3%, max(0.4))} @@ -258,11 +219,13 @@ a { <===> ================================================================================ -<===> clamp/arg_1/options.yml +<===> clamp/options.yml --- :todo: - sass/libsass#2726 +<===> +================================================================================ <===> clamp/arg_1/input.scss a {b: hsla(clamp(1, 2, 3), 2%, 3%, 0.4)} @@ -273,11 +236,6 @@ a { <===> ================================================================================ -<===> clamp/arg_2/options.yml ---- -:todo: -- sass/libsass#2726 - <===> clamp/arg_2/input.scss a {b: hsla(1, clamp(2%, 3%, 4%), 3%, 0.4)} @@ -288,11 +246,6 @@ a { <===> ================================================================================ -<===> clamp/arg_3/options.yml ---- -:todo: -- sass/libsass#2726 - <===> clamp/arg_3/input.scss a {b: hsla(1, 2%, clamp(3%, 4%, 5%), 0.4)} @@ -303,11 +256,6 @@ a { <===> ================================================================================ -<===> clamp/arg_4/options.yml ---- -:todo: -- sass/libsass#2726 - <===> clamp/arg_4/input.scss a {b: hsla(1, 2%, 3%, clamp(0.4, 0.5, 0.6))}