Skip to content

Commit 14b0c41

Browse files
Add missing tests for toPx function
1 parent cfdd199 commit 14b0c41

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

test/over_react/util/rem_util_test.dart

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,30 @@ main() {
167167
);
168168
});
169169

170-
test('throws when passed a CSS value string with a unit other than px/rem', () {
171-
expect(() => toPx('1em'), allOf(
172-
throwsArgumentError,
173-
throwsA(hasToStringValue(contains('must be a rem num or a String px/rem value'))))
174-
);
170+
group('throws when passed a CSS value string with a unit other than px/rem', () {
171+
test('', () {
172+
expect(() => toPx('1em'), allOf(
173+
throwsArgumentError,
174+
throwsA(hasToStringValue(contains('must be a rem num or a String px/rem value'))))
175+
);
176+
});
177+
178+
test('unless `passThroughUnsupportedUnits` is true', () {
179+
expect(toPx('1em', passThroughUnsupportedUnits: true), new CssValue.parse('1em'));
180+
});
175181
});
176182

177-
test('throws when passed a CssValue instance with a unit other than px/rem', () {
178-
expect(() => toPx(new CssValue.parse('1em')), allOf(
179-
throwsArgumentError,
180-
throwsA(hasToStringValue(contains('must be a rem num or a String px/rem value'))))
181-
);
183+
group('throws when passed a CssValue instance with a unit other than px/rem', () {
184+
test('', () {
185+
expect(() => toPx(new CssValue.parse('1em')), allOf(
186+
throwsArgumentError,
187+
throwsA(hasToStringValue(contains('must be a rem num or a String px/rem value'))))
188+
);
189+
});
190+
191+
test('unless `passThroughUnsupportedUnits` is true', () {
192+
expect(toPx(new CssValue.parse('1em'), passThroughUnsupportedUnits: true), new CssValue.parse('1em'));
193+
});
182194
});
183195
});
184196

0 commit comments

Comments
 (0)