Skip to content

Commit dad8491

Browse files
authored
Make types.String.prototype.setValue() de-quote a string (#535)
Closes #513
1 parent f914c39 commit dad8491

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.15.2
2+
3+
### Node JS API
4+
5+
* When `setValue()` is called on a Sass string object, make it unquoted even if
6+
it was quoted originally, to match the behavior of Node Sass.
7+
18
## 1.15.1
29

310
* Always add quotes to attribute selector values that begin with `--`, since IE

lib/src/node/value/string.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final Function stringConstructor = createClass(
2626
}, {
2727
'getValue': (_NodeSassString thisArg) => thisArg.dartValue.text,
2828
'setValue': (_NodeSassString thisArg, String value) {
29-
thisArg.dartValue = SassString(value, quotes: thisArg.dartValue.hasQuotes);
29+
thisArg.dartValue = SassString(value, quotes: false);
3030
},
3131
'toString': (_NodeSassString thisArg) => thisArg.dartValue.toString()
3232
});

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.15.1
2+
version: 1.15.2
33
description: A Sass implementation in Dart.
44
author: Dart Team <[email protected]>
55
homepage: https://github.com/sass/dart-sass

test/node_api/value/string_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void main() {
4545
equalsIgnoringWhitespace("a { b: bar; c: foo; }"));
4646
});
4747

48-
test("a quoted string preserves quoting, even when its value is set", () {
48+
test("a quoted string becomes unquoted when its value is set", () {
4949
expect(
5050
renderSync(RenderOptions(
5151
data: r"a {b: foo('foo')}",
@@ -57,7 +57,7 @@ void main() {
5757
return string;
5858
}))
5959
}))),
60-
equalsIgnoringWhitespace('a { b: "bar"; }'));
60+
equalsIgnoringWhitespace('a { b: bar; }'));
6161
});
6262
});
6363

0 commit comments

Comments
 (0)