feat(app): 完善播放协议搜索与空状态
This commit is contained in:
1 parent
671e0ce143
commit
ef29fc5f15
85 files changed
+2976
-768
No files matched your search
@@ -0,0 +1,27 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/core/config/app_config.dart';
|
||||
import 'package:fruitshorts/core/legal/legal_page.dart';
|
||||
|
||||
void main() {
|
||||
tearDown(AppConfig.clearRuntimeBaseUrl);
|
||||
|
||||
test('should_build_language_page_when_locale_is_supported', () {
|
||||
AppConfig.applyRuntimeBaseUrl('http://192.168.31.243:8081');
|
||||
|
||||
expect(
|
||||
legalPageUrl(legalPrivacyPath, const Locale('zh')),
|
||||
'http://192.168.31.243:8081/privacy/zh',
|
||||
);
|
||||
expect(
|
||||
legalPageUrl(legalTermsPath, const Locale('id')),
|
||||
'http://192.168.31.243:8081/terms/id',
|
||||
);
|
||||
expect(
|
||||
legalPageUrl(legalPrivacyPath, const Locale('fr')),
|
||||
'http://192.168.31.243:8081/privacy/en',
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/core/legal/legal_html.dart';
|
||||
import 'package:fruitshorts/core/legal/legal_web_page.dart';
|
||||
import 'package:fruitshorts/l10n/app_localizations.dart';
|
||||
|
||||
void main() {
|
||||
test('should_keep_article_body_when_page_wraps_html', () {
|
||||
const html = '<html><body><main><article><p>第一行</p></article></main></body></html>';
|
||||
|
||||
expect(legalArticle(html), '<p>第一行</p>');
|
||||
});
|
||||
|
||||
testWidgets('should_show_agreement_text_when_page_loads', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
locale: const Locale('zh'),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: LegalWebPage(
|
||||
url: 'http://example.test/privacy/zh',
|
||||
load: (_) async => '<p>协议正文</p>',
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('协议正文'), findsOneWidget);
|
||||
expect(find.byKey(const Key('legal-web-loading')), findsNothing);
|
||||
});
|
||||
}
|
||||
@@ -97,8 +97,8 @@ void main() {
|
||||
);
|
||||
expect(material.color, AppColors.headerScrim);
|
||||
expect(icon.color, AppColors.onSurface);
|
||||
expect(icon.size, 22);
|
||||
expect(icon.weight, 600);
|
||||
expect(icon.size, 34);
|
||||
expect(icon.weight, 400);
|
||||
final shadow =
|
||||
tester
|
||||
.widget<DecoratedBox>(
|
||||
|
||||
Reference in new issue
Block a user