Skip to content

Commit b19b3b1

Browse files
authored
Fix assertUnit and assertNoUnits (#1686)
Fixes #1685.
1 parent 2e7db70 commit b19b3b1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
embedding the sources, when using the command-line interface or the legacy JS
77
API.
88

9+
### JS API
10+
11+
* `SassNumber.assertUnit()` and `SassNumber.assertNoUnits()` now correctly
12+
return the number called on when it passes the assertion.
13+
914
## 1.51.0
1015

1116
* **Potentially breaking change**: Change the order of maps returned by

lib/src/node/value/number.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ final JSClass numberClass = () {
3838
'assertInRange': (SassNumber self, num min, num max, [String? name]) =>
3939
self.valueInRange(min, max, name),
4040
'assertNoUnits': (SassNumber self, [String? name]) =>
41-
self.assertNoUnits(name),
41+
self..assertNoUnits(name),
4242
'assertUnit': (SassNumber self, String unit, [String? name]) =>
43-
self.assertUnit(unit, name),
43+
self..assertUnit(unit, name),
4444
'hasUnit': (SassNumber self, String unit) => self.hasUnit(unit),
4545
'compatibleWithUnit': (SassNumber self, String unit) =>
4646
self.hasUnits && self.compatibleWithUnit(unit),

0 commit comments

Comments
 (0)