Fix assertUnit and assertNoUnits (#1686)

Fixes #1685.
This commit is contained in:
Jennifer Thakar 2022-05-10 15:27:47 -07:00 committed by GitHub
parent 2e7db70e2d
commit b19b3b141d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -6,6 +6,11 @@
embedding the sources, when using the command-line interface or the legacy JS
API.
### JS API
* `SassNumber.assertUnit()` and `SassNumber.assertNoUnits()` now correctly
return the number called on when it passes the assertion.
## 1.51.0
* **Potentially breaking change**: Change the order of maps returned by

View File

@ -38,9 +38,9 @@ final JSClass numberClass = () {
'assertInRange': (SassNumber self, num min, num max, [String? name]) =>
self.valueInRange(min, max, name),
'assertNoUnits': (SassNumber self, [String? name]) =>
self.assertNoUnits(name),
self..assertNoUnits(name),
'assertUnit': (SassNumber self, String unit, [String? name]) =>
self.assertUnit(unit, name),
self..assertUnit(unit, name),
'hasUnit': (SassNumber self, String unit) => self.hasUnit(unit),
'compatibleWithUnit': (SassNumber self, String unit) =>
self.hasUnits && self.compatibleWithUnit(unit),