mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-26 20:24:42 +01:00
Support slash-separated lists
This commit is contained in:
parent
0de8deb489
commit
5ff4e84b4a
@ -1,3 +1,7 @@
|
||||
## 1.0.0-beta.10
|
||||
|
||||
* Support slash-separated lists.
|
||||
|
||||
## 1.0.0-beta.9
|
||||
|
||||
* No user-visible changes.
|
||||
|
@ -70,6 +70,8 @@ ListSeparator _protofySeparator(sass.ListSeparator separator) {
|
||||
return ListSeparator.COMMA;
|
||||
case sass.ListSeparator.space:
|
||||
return ListSeparator.SPACE;
|
||||
case sass.ListSeparator.slash:
|
||||
return ListSeparator.SLASH;
|
||||
case sass.ListSeparator.undecided:
|
||||
return ListSeparator.UNDECIDED;
|
||||
default:
|
||||
@ -190,6 +192,8 @@ sass.ListSeparator _deprotofySeparator(ListSeparator separator) {
|
||||
return sass.ListSeparator.comma;
|
||||
case ListSeparator.SPACE:
|
||||
return sass.ListSeparator.space;
|
||||
case ListSeparator.SLASH:
|
||||
return sass.ListSeparator.slash;
|
||||
case ListSeparator.UNDECIDED:
|
||||
return sass.ListSeparator.undecided;
|
||||
default:
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: sass_embedded
|
||||
version: 1.0.0-beta.9
|
||||
version: 1.0.0-dev
|
||||
description: An implementation of the Sass embedded protocol using Dart Sass.
|
||||
author: Sass Team
|
||||
homepage: https://github.com/sass/dart-sass-embedded
|
||||
|
@ -497,6 +497,14 @@ void main() {
|
||||
expect(list.hasBrackets, isTrue);
|
||||
expect(list.separator, equals(ListSeparator.SPACE));
|
||||
});
|
||||
|
||||
test("with a slash separator", () async {
|
||||
var list =
|
||||
(await _protofy(r"list.join([], [], $separator: slash)")).list;
|
||||
expect(list.contents, isEmpty);
|
||||
expect(list.hasBrackets, isTrue);
|
||||
expect(list.separator, equals(ListSeparator.SLASH));
|
||||
});
|
||||
});
|
||||
|
||||
group("without brackets", () {
|
||||
@ -522,6 +530,14 @@ void main() {
|
||||
expect(list.hasBrackets, isFalse);
|
||||
expect(list.separator, equals(ListSeparator.SPACE));
|
||||
});
|
||||
|
||||
test("with a slash separator", () async {
|
||||
var list =
|
||||
(await _protofy(r"list.join((), (), $separator: slash)")).list;
|
||||
expect(list.contents, isEmpty);
|
||||
expect(list.hasBrackets, isFalse);
|
||||
expect(list.separator, equals(ListSeparator.SLASH));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -549,6 +565,15 @@ void main() {
|
||||
expect(list.hasBrackets, isTrue);
|
||||
expect(list.separator, equals(ListSeparator.SPACE));
|
||||
});
|
||||
|
||||
test("with a slash separator", () async {
|
||||
var list =
|
||||
(await _protofy(r"list.join([true], [], $separator: slash)"))
|
||||
.list;
|
||||
expect(list.contents, equals([_true]));
|
||||
expect(list.hasBrackets, isTrue);
|
||||
expect(list.separator, equals(ListSeparator.SLASH));
|
||||
});
|
||||
});
|
||||
|
||||
group("without brackets", () {
|
||||
@ -567,6 +592,15 @@ void main() {
|
||||
expect(list.hasBrackets, isFalse);
|
||||
expect(list.separator, equals(ListSeparator.SPACE));
|
||||
});
|
||||
|
||||
test("with a slash separator", () async {
|
||||
var list =
|
||||
(await _protofy(r"list.join(true, (), $separator: slash)"))
|
||||
.list;
|
||||
expect(list.contents, equals([_true]));
|
||||
expect(list.hasBrackets, isFalse);
|
||||
expect(list.separator, equals(ListSeparator.SLASH));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -601,6 +635,13 @@ void main() {
|
||||
expect(list.hasBrackets, isFalse);
|
||||
expect(list.separator, equals(ListSeparator.SPACE));
|
||||
});
|
||||
|
||||
test("with a slash separator", () async {
|
||||
var list = (await _protofy(r"list.slash(true, null, false)")).list;
|
||||
expect(list.contents, equals([_true, _null, _false]));
|
||||
expect(list.hasBrackets, isFalse);
|
||||
expect(list.separator, equals(ListSeparator.SLASH));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -895,6 +936,15 @@ void main() {
|
||||
..separator = ListSeparator.SPACE),
|
||||
"[]");
|
||||
});
|
||||
|
||||
group("with a slash separator", () {
|
||||
_testSerializationAndRoundTrip(
|
||||
Value()
|
||||
..list = (Value_List()
|
||||
..hasBrackets = true
|
||||
..separator = ListSeparator.SLASH),
|
||||
"[]");
|
||||
});
|
||||
});
|
||||
|
||||
group("without brackets", () {
|
||||
@ -927,6 +977,16 @@ void main() {
|
||||
"()",
|
||||
inspect: true);
|
||||
});
|
||||
|
||||
group("with a slash separator", () {
|
||||
_testSerializationAndRoundTrip(
|
||||
Value()
|
||||
..list = (Value_List()
|
||||
..hasBrackets = false
|
||||
..separator = ListSeparator.SLASH),
|
||||
"()",
|
||||
inspect: true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -963,6 +1023,16 @@ void main() {
|
||||
..separator = ListSeparator.SPACE),
|
||||
"[true]");
|
||||
});
|
||||
|
||||
group("with a slash separator", () {
|
||||
_testSerializationAndRoundTrip(
|
||||
Value()
|
||||
..list = (Value_List()
|
||||
..contents.add(_true)
|
||||
..hasBrackets = true
|
||||
..separator = ListSeparator.SLASH),
|
||||
"[true]");
|
||||
});
|
||||
});
|
||||
|
||||
group("without brackets", () {
|
||||
@ -997,6 +1067,16 @@ void main() {
|
||||
..separator = ListSeparator.SPACE),
|
||||
"true");
|
||||
});
|
||||
|
||||
group("with a slash separator", () {
|
||||
_testSerializationAndRoundTrip(
|
||||
Value()
|
||||
..list = (Value_List()
|
||||
..contents.add(_true)
|
||||
..hasBrackets = false
|
||||
..separator = ListSeparator.SLASH),
|
||||
"true");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -1025,6 +1105,18 @@ void main() {
|
||||
inspect: true),
|
||||
"[true null false]");
|
||||
});
|
||||
|
||||
test("with a slash separator", () async {
|
||||
expect(
|
||||
await _deprotofy(
|
||||
Value()
|
||||
..list = (Value_List()
|
||||
..contents.addAll([_true, _null, _false])
|
||||
..hasBrackets = true
|
||||
..separator = ListSeparator.SLASH),
|
||||
inspect: true),
|
||||
"[true / null / false]");
|
||||
});
|
||||
});
|
||||
|
||||
group("without brackets", () {
|
||||
@ -1051,6 +1143,18 @@ void main() {
|
||||
inspect: true),
|
||||
"true null false");
|
||||
});
|
||||
|
||||
test("with a slash separator", () async {
|
||||
expect(
|
||||
await _deprotofy(
|
||||
Value()
|
||||
..list = (Value_List()
|
||||
..contents.addAll([_true, _null, _false])
|
||||
..hasBrackets = false
|
||||
..separator = ListSeparator.SLASH),
|
||||
inspect: true),
|
||||
"true / null / false");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user