From d079c885088575c15291dff5519a6e7a092f21d0 Mon Sep 17 00:00:00 2001 From: Olzhas Suleimen Date: Sun, 18 Jun 2023 19:51:41 +0600 Subject: [PATCH 1/2] Update processFont to handle null expressions. --- lib/parser.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/parser.dart b/lib/parser.dart index 15dd764..d28c013 100644 --- a/lib/parser.dart +++ b/lib/parser.dart @@ -2852,9 +2852,9 @@ class ExpressionsProcessor { } return FontExpression(_exprs.span, - size: fontSize!.font.size, - lineHeight: fontSize.font.lineHeight, - family: fontFamily!.font.family); + size: fontSize?.font.size, + lineHeight: fontSize?.font.lineHeight, + family: fontFamily?.font.family); } } From 08a4e8912fa30ee3d7613de4629fab2bfbee9d2f Mon Sep 17 00:00:00 2001 From: Olzhas Suleimen Date: Sat, 24 Jun 2023 18:46:50 +0600 Subject: [PATCH 2/2] Guidelines. --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- test/declaration_test.dart | 28 ++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70e7747..a4631cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.1-dev + +- Update `processFont` to handle null expressions. + ## 1.0.0 - Rev to `1.0.0` (note however that there are no API changes from `0.17.x`). diff --git a/pubspec.yaml b/pubspec.yaml index e0eab9a..694514a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: csslib -version: 1.0.0 +version: 1.0.1-dev description: A library for parsing and analyzing CSS (Cascading Style Sheets). repository: https://github.com/dart-lang/csslib diff --git a/test/declaration_test.dart b/test/declaration_test.dart index 5dc24f6..6406efd 100644 --- a/test/declaration_test.dart +++ b/test/declaration_test.dart @@ -260,6 +260,33 @@ void testUnits() { expect(prettyPrint(stylesheet), generated); } +void testNoValues() { + var errors = []; + final input = r''' +.foo { + color: ; +} +.bar { + font:; + color: blue; +} +'''; + + final generated = r''' +.foo { + color: ; +} +.bar { + font: ; + color: #00f; +}'''; + + var stylesheet = parseCss(input, errors: errors, opts: simpleOptions); + + expect(errors.isEmpty, true, reason: errors.toString()); + expect(prettyPrint(stylesheet), generated); +} + void testUnicode() { var errors = []; final input = r''' @@ -1435,6 +1462,7 @@ void main() { test('Identifiers', testIdentifiers); test('Composites', testComposites); test('Units', testUnits); + test('No Values', testNoValues); test('Unicode', testUnicode); test('Newer CSS', testNewerCss); test('Media Queries', testMediaQueries);