fix: issue-372, issue-227, issue-406

This commit is contained in:
misha
2026-09-02 09:32:14 +03:00
parent 10af279d87
commit c6ea1d414d
34 changed files with 1623 additions and 387 deletions

View File

@@ -0,0 +1,36 @@
import 'package:eatvio_app/core/utils/inline_svg_css.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('inlineSvgCss', () {
test(
'inlines class fills from a style block so flutter_svg can paint colors',
() {
const svg = '''
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
<style type="text/css">
.st0{fill:#FFD200;}
.st1{fill:#FFFFFF;}
</style>
<circle class="st0" cx="20" cy="20" r="18"/>
<path class="st1" d="M10 20h20"/>
</svg>
''';
final result = inlineSvgCss(svg);
expect(result, isNot(contains('<style')));
expect(result, contains('fill="#FFD200"'));
expect(result, contains('fill="#FFFFFF"'));
expect(result, isNot(contains('class="st0"')));
},
);
test('keeps SVG without style blocks unchanged', () {
const svg =
'<svg xmlns="http://www.w3.org/2000/svg"><circle fill="#00AA00" cx="10" cy="10" r="5"/></svg>';
expect(inlineSvgCss(svg), svg);
});
});
}