From b19b3b141d35c7153a522615e92127479fcc766b Mon Sep 17 00:00:00 2001 From: Jennifer Thakar Date: Tue, 10 May 2022 15:27:47 -0700 Subject: [PATCH] Fix assertUnit and assertNoUnits (#1686) Fixes #1685. --- CHANGELOG.md | 5 +++++ lib/src/node/value/number.dart | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 837a3a0f..0e23c0d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/src/node/value/number.dart b/lib/src/node/value/number.dart index e2c33118..fcfcd0ab 100644 --- a/lib/src/node/value/number.dart +++ b/lib/src/node/value/number.dart @@ -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),