resolve merge conflicts with master

This commit is contained in:
Connor Skees 2020-08-02 15:11:59 -04:00
commit 5efe99a404
5 changed files with 28 additions and 3 deletions

View File

@ -370,7 +370,7 @@ impl Color {
/// Create RGBA representation from HSLA values /// Create RGBA representation from HSLA values
pub fn from_hsla(hue: Number, saturation: Number, luminance: Number, alpha: Number) -> Self { pub fn from_hsla(hue: Number, saturation: Number, luminance: Number, alpha: Number) -> Self {
let mut hue = if hue > Number::from(360) { let mut hue = if hue >= Number::from(360) {
hue % Number::from(360) hue % Number::from(360)
} else if hue < Number::from(-360) { } else if hue < Number::from(-360) {
Number::from(360) + hue % Number::from(360) Number::from(360) + hue % Number::from(360)

View File

@ -11,7 +11,7 @@ use peekmore::{PeekMore, PeekMoreIterator};
use crate::{ use crate::{
builtin::GLOBAL_FUNCTIONS, builtin::GLOBAL_FUNCTIONS,
color::{Color, NAMED_COLORS}, color::{Color, NAMED_COLORS},
common::{Brackets, Identifier, ListSeparator, Op, QuoteKind}, common::{unvendor, Brackets, Identifier, ListSeparator, Op, QuoteKind},
error::SassResult, error::SassResult,
unit::Unit, unit::Unit,
utils::{ utils::{
@ -343,7 +343,7 @@ impl<'a> Parser<'a> {
.span(span)); .span(span));
} else { } else {
// check for special cased CSS functions // check for special cased CSS functions
match lower.as_str() { match unvendor(&lower) {
"calc" | "element" | "expression" => { "calc" | "element" | "expression" => {
s = lower; s = lower;
self.parse_calc_args(&mut s)?; self.parse_calc_args(&mut s)?;

View File

@ -247,6 +247,11 @@ test!(
"a {\n color: hue(rgb(1, 0, 1));\n}\n", "a {\n color: hue(rgb(1, 0, 1));\n}\n",
"a {\n color: 300deg;\n}\n" "a {\n color: 300deg;\n}\n"
); );
test!(
hue_of_360_becomes_0,
"a {\n color: hue(hsl(360, 10%, 20%));\n}\n",
"a {\n color: 0deg;\n}\n"
);
test!( test!(
hue_green_equals_blue, hue_green_equals_blue,
"a {\n color: hue(rgb(0, 1, 1));\n}\n", "a {\n color: hue(rgb(0, 1, 1));\n}\n",

View File

@ -46,6 +46,11 @@ test!(
"a {\n color: cAlC(1 + 1);\n}\n", "a {\n color: cAlC(1 + 1);\n}\n",
"a {\n color: calc(1 + 1);\n}\n" "a {\n color: calc(1 + 1);\n}\n"
); );
test!(
calc_browser_prefixed,
"a {\n color: -webkit-calc(1 + 2);\n}\n",
"a {\n color: -webkit-calc(1 + 2);\n}\n"
);
test!( test!(
element_whitespace, element_whitespace,
"a {\n color: element( 1 );\n}\n", "a {\n color: element( 1 );\n}\n",
@ -81,6 +86,11 @@ test!(
element_nested_parens, element_nested_parens,
"a {\n color: element((((()))));\n}\n" "a {\n color: element((((()))));\n}\n"
); );
test!(
element_browser_prefixed,
"a {\n color: -webkit-element(1 + 2);\n}\n",
"a {\n color: -webkit-element(1 + 2);\n}\n"
);
test!( test!(
expression_whitespace, expression_whitespace,
"a {\n color: expression( 1 );\n}\n", "a {\n color: expression( 1 );\n}\n",
@ -116,6 +126,11 @@ test!(
expression_nested_parens, expression_nested_parens,
"a {\n color: expression((((()))));\n}\n" "a {\n color: expression((((()))));\n}\n"
); );
test!(
expression_browser_prefixed,
"a {\n color: -webkit-expression(1 + 2);\n}\n",
"a {\n color: -webkit-expression(1 + 2);\n}\n"
);
test!( test!(
progid_whitespace, progid_whitespace,
"a {\n color: progid:( 1 );\n}\n", "a {\n color: progid:( 1 );\n}\n",

View File

@ -134,6 +134,11 @@ test!(
"a {\n color: UrL(http://foo);\n}\n", "a {\n color: UrL(http://foo);\n}\n",
"a {\n color: url(http://foo);\n}\n" "a {\n color: url(http://foo);\n}\n"
); );
test!(
url_browser_prefixed,
"a {\n color: -webkit-url(https://google.com);\n}\n",
"a {\n color: url(https://google.com);\n}\n"
);
error!( error!(
url_nothing_after_forward_slash_in_interpolation, url_nothing_after_forward_slash_in_interpolation,
"a { color: url(#{/", "Error: Expected expression." "a { color: url(#{/", "Error: Expected expression."