TF-4016 Add unit test for sanitize html with supress_time_adjustment tag
This commit is contained in:
@@ -3,7 +3,7 @@ import 'package:flutter_test/flutter_test.dart';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('StandardizeHtmlSanitizingTransformers::test', () {
|
group('StandardizeHtmlSanitizingTransformers.process', () {
|
||||||
const transformer = StandardizeHtmlSanitizingTransformers();
|
const transformer = StandardizeHtmlSanitizingTransformers();
|
||||||
const htmlEscape = HtmlEscape();
|
const htmlEscape = HtmlEscape();
|
||||||
const listHTMLTags = [
|
const listHTMLTags = [
|
||||||
@@ -19,6 +19,7 @@ void main() {
|
|||||||
'style',
|
'style',
|
||||||
'section',
|
'section',
|
||||||
'google-sheets-html-origin',
|
'google-sheets-html-origin',
|
||||||
|
'supress_time_adjustment',
|
||||||
];
|
];
|
||||||
const listOnEventAttributes = [
|
const listOnEventAttributes = [
|
||||||
'mousedown',
|
'mousedown',
|
||||||
@@ -188,5 +189,15 @@ void main() {
|
|||||||
|
|
||||||
expect(result, equals('<footer></footer>'));
|
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>'));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user