TF-4016 Add unit test for sanitize html with supress_time_adjustment tag

This commit is contained in:
dab246
2025-09-15 03:10:12 +07:00
committed by Dat H. Pham
parent d9c87a3994
commit f9aa844d7e
@@ -3,7 +3,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'dart:convert';
void main() {
group('StandardizeHtmlSanitizingTransformers::test', () {
group('StandardizeHtmlSanitizingTransformers.process', () {
const transformer = StandardizeHtmlSanitizingTransformers();
const htmlEscape = HtmlEscape();
const listHTMLTags = [
@@ -19,6 +19,7 @@ void main() {
'style',
'section',
'google-sheets-html-origin',
'supress_time_adjustment',
];
const listOnEventAttributes = [
'mousedown',
@@ -188,5 +189,15 @@ void main() {
expect(result, equals('<footer></footer>'));
});
test(
'SHOULD persist supress_time_adjustment tag and remove href attribute of A tag '
'WHEN href is invalid',
() {
const inputHtml = '<supress_time_adjustment href="javascript:alert(1)"></supress_time_adjustment>';
final result = transformer.process(inputHtml, htmlEscape);
expect(result, equals('<supress_time_adjustment></supress_time_adjustment>'));
});
});
}