Empty maps have undecided separators

Closes #737
This commit is contained in:
Natalie Weizenbaum 2019-07-02 17:16:46 -07:00
parent 821b5e2521
commit 47e0cfc8c8
3 changed files with 10 additions and 4 deletions

View File

@ -20,6 +20,11 @@
inserts at the end of the string if the `$index` is `-1`. This matches the inserts at the end of the string if the `$index` is `-1`. This matches the
behavior in LibSass and originally in Ruby Sass. behavior in LibSass and originally in Ruby Sass.
* **Potentially breaking bug fix**: An empty map returned by `map-remove()` is
now treated as identical to the literal value `()`, rather than being treated
as though it had a comma separator. This matches the original behavior in Ruby
Sass.
* The `adjust-color()` function no longer throws an error when a large `$alpha` * The `adjust-color()` function no longer throws an error when a large `$alpha`
value is combined with HSL adjustments. value is combined with HSL adjustments.

View File

@ -10,7 +10,8 @@ import 'external/value.dart' as ext;
class SassMap extends Value implements ext.SassMap { class SassMap extends Value implements ext.SassMap {
final Map<Value, Value> contents; final Map<Value, Value> contents;
ListSeparator get separator => ListSeparator.comma; ListSeparator get separator =>
contents.isEmpty ? ListSeparator.undecided : ListSeparator.comma;
List<Value> get asList { List<Value> get asList {
var result = <Value>[]; var result = <Value>[];

View File

@ -15,7 +15,7 @@ main() {
SassMap value; SassMap value;
setUp(() => value = parseValue("(a: b, c: d)") as SassMap); setUp(() => value = parseValue("(a: b, c: d)") as SassMap);
test("is comma-separated", () { test("has an undecided separator", () {
expect(value.separator, equals(ListSeparator.comma)); expect(value.separator, equals(ListSeparator.comma));
}); });
@ -143,8 +143,8 @@ main() {
SassMap value; SassMap value;
setUp(() => value = parseValue("map-remove((a: b), a)") as SassMap); setUp(() => value = parseValue("map-remove((a: b), a)") as SassMap);
test("is comma-separated", () { test("has an undecided separator", () {
expect(value.separator, equals(ListSeparator.comma)); expect(value.separator, equals(ListSeparator.undecided));
}); });
test("returns its contents as a map", () { test("returns its contents as a map", () {