-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add specs for hex colors with alpha components
This adds specs for both the deprecation behavior and the eventual post-deprecation behavior. See sass/sass#2179
- Loading branch information
Showing
15 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
DEPRECATION WARNING on line 6, column 15 of /sass/spec/css/color/alpha_hex/deprecation/input.scss: | ||
The value "#AbCd" is currently parsed as a string, but it will be parsed as a | ||
color in a release on or after 19 September 2018. | ||
|
||
To continue parsing it as a string, use "unquote('#AbCd')". | ||
To parse it as a color, use "rgba(170, 187, 204, 0.8666666667)". | ||
|
||
four-digit: #AbCd; | ||
^^^^^ | ||
|
||
DEPRECATION WARNING on line 7, column 16 of /sass/spec/css/color/alpha_hex/deprecation/input.scss: | ||
The value "#aBcDeFaB" is currently parsed as a string, but it will be parsed as a | ||
color in a release on or after 19 September 2018. | ||
|
||
To continue parsing it as a string, use "unquote('#aBcDeFaB')". | ||
To parse it as a color, use "rgba(171, 205, 239, 0.6705882353)". | ||
|
||
eight-digit: #aBcDeFaB; | ||
^^^^^^^^^ | ||
|
||
DEPRECATION WARNING on line 8, column 28 of /sass/spec/css/color/alpha_hex/deprecation/input.scss: | ||
The value "#abcd" is currently parsed as a string, but it will be parsed as a | ||
color in a release on or after 19 September 2018. | ||
|
||
To continue parsing it as a string, use "unquote('#abcd')". | ||
To parse it as a color, use "rgba(170, 187, 204, 0.8666666667)". | ||
|
||
four-digit-type: type-of(#abcd); | ||
^^^^^ | ||
|
||
DEPRECATION WARNING on line 9, column 29 of /sass/spec/css/color/alpha_hex/deprecation/input.scss: | ||
The value "#ABCDEFAB" is currently parsed as a string, but it will be parsed as a | ||
color in a release on or after 19 September 2018. | ||
|
||
To continue parsing it as a string, use "unquote('#ABCDEFAB')". | ||
To parse it as a color, use "rgba(171, 205, 239, 0.6705882353)". | ||
|
||
eight-digit-type: type-of(#ABCDEFAB); | ||
^^^^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
DEPRECATION WARNING on line 8, column 33 of /sass/spec/css/color/alpha_hex/deprecation/input.scss: | ||
The value "#abcd" is currently parsed as a string, but it will be parsed as a color in | ||
future versions of Sass. Use "unquote('#abcd')" to continue parsing it as a string. | ||
|
||
DEPRECATION WARNING on line 9, column 38 of /sass/spec/css/color/alpha_hex/deprecation/input.scss: | ||
The value "#ABCDEFAB" is currently parsed as a string, but it will be parsed as a color in | ||
future versions of Sass. Use "unquote('#ABCDEFAB')" to continue parsing it as a string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
a { | ||
four-digit: #AbCd; | ||
eight-digit: #aBcDeFaB; | ||
four-digit-type: string; | ||
eight-digit-type: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// This spec tests the intermediate behavior of Sass implementations that have | ||
// deprecated parsing tokens as unquoted strings when they're ambiguous between | ||
// IDs or hex RGBA colors. These implementations should continue to parse those | ||
// tokens as strings, but should emit a warning. | ||
a { | ||
four-digit: #AbCd; | ||
eight-digit: #aBcDeFaB; | ||
four-digit-type: type-of(#abcd); | ||
eight-digit-type: type-of(#ABCDEFAB); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
:ignore_for: | ||
- ruby-sass |
12 changes: 12 additions & 0 deletions
12
spec/css/color/alpha_hex/initial_digit/expected_output-ruby-sass.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
a { | ||
four-digit: #0123; | ||
eight-digit: #98765432; | ||
four-digit-red: 0; | ||
four-digit-green: 17; | ||
four-digit-blue: 34; | ||
four-digit-alpha: 0.2; | ||
eight-digit-red: 152; | ||
eight-digit-green: 118; | ||
eight-digit-blue: 84; | ||
eight-digit-alpha: 0.19608; | ||
} |
12 changes: 12 additions & 0 deletions
12
spec/css/color/alpha_hex/initial_digit/expected_output.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
a { | ||
four-digit: #0123; | ||
eight-digit: #98765432; | ||
four-digit-red: 0; | ||
four-digit-green: 17; | ||
four-digit-blue: 34; | ||
four-digit-alpha: 0.2; | ||
eight-digit-red: 152; | ||
eight-digit-green: 118; | ||
eight-digit-blue: 84; | ||
eight-digit-alpha: 0.1960784314; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
a { | ||
four-digit: #0123; | ||
eight-digit: #98765432; | ||
|
||
// Verify that the color channels are set correctly. | ||
four-digit-red: red(#0123); | ||
four-digit-green: green(#0123); | ||
four-digit-blue: blue(#0123); | ||
four-digit-alpha: alpha(#0123); | ||
|
||
eight-digit-red: red(#98765432); | ||
eight-digit-green: green(#98765432); | ||
eight-digit-blue: blue(#98765432); | ||
eight-digit-alpha: alpha(#98765432); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
:start_version: '3.6' | ||
:todo: | ||
- libsass |
12 changes: 12 additions & 0 deletions
12
spec/css/color/alpha_hex/initial_letter/expected_output-ruby-sass.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
a { | ||
four-digit: #AbCd; | ||
eight-digit: #aBcDeF12; | ||
four-digit-red: 170; | ||
four-digit-green: 187; | ||
four-digit-blue: 204; | ||
four-digit-alpha: 0.86667; | ||
eight-digit-red: 171; | ||
eight-digit-green: 205; | ||
eight-digit-blue: 239; | ||
eight-digit-alpha: 0.07059; | ||
} |
12 changes: 12 additions & 0 deletions
12
spec/css/color/alpha_hex/initial_letter/expected_output.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
a { | ||
four-digit: #AbCd; | ||
eight-digit: #aBcDeF12; | ||
four-digit-red: 170; | ||
four-digit-green: 187; | ||
four-digit-blue: 204; | ||
four-digit-alpha: 0.8666666666; | ||
eight-digit-red: 171; | ||
eight-digit-green: 205; | ||
eight-digit-blue: 239; | ||
eight-digit-alpha: 0.0705882353; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
a { | ||
four-digit: #AbCd; | ||
eight-digit: #aBcDeF12; | ||
|
||
// Verify that the color channels are set correctly. | ||
four-digit-red: red(#abcd); | ||
four-digit-green: green(#abcd); | ||
four-digit-blue: blue(#abcd); | ||
four-digit-alpha: alpha(#abcd); | ||
|
||
eight-digit-red: red(#ABCDEF12); | ||
eight-digit-green: green(#ABCDEF12); | ||
eight-digit-blue: blue(#ABCDEF12); | ||
eight-digit-alpha: alpha(#ABCDEF12); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
:start_version: '3.6' | ||
:todo: | ||
- dart-sass | ||
- libsass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
a { | ||
two-letters: #ab; | ||
five-letters: #abcde; | ||
seven-letters: #abcdefa; | ||
nine-letters: #abcdefabc; | ||
three-letters-not-hex: #axc; | ||
four-letters-not-hex: #axcd; | ||
six-letters-not-hex: #abcxde; | ||
eight-letters-not-hex: #abcxdefa; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// The CSS nav-up property and its siblings allow ID tokens in their values, so | ||
// Sass parses any tokens that start with a "#" followed by an identifier as an | ||
// ID if it can't be parsed as a color. | ||
a { | ||
// These IDs are the wrong number of letters to be a hex color. | ||
two-letters: #ab; | ||
five-letters: #abcde; | ||
seven-letters: #abcdefa; | ||
nine-letters: #abcdefabc; | ||
|
||
// These IDs contain letters outside the hexadecimal gamut. | ||
three-letters-not-hex: #axc; | ||
four-letters-not-hex: #axcd; | ||
six-letters-not-hex: #abcxde; | ||
eight-letters-not-hex: #abcxdefa; | ||
} |