-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TF-2492 Write unit test
removeCollapsedSignatureEffect
method
Signed-off-by: dab246 <[email protected]>
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
core/test/utils/remove_collapsed_signature_effect_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'package:core/presentation/utils/html_transformer/html_utils.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
group('removeCollapsedSignatureEffect test', () { | ||
test('RemoveCollapsedSignatureEffect should remove all signature html tags when content CONTAIN ONE tag with attribute class is `tmail-signature-button`', () async { | ||
String originContent = '<p>Hello dab</p><div class="tmail-signature"><div class="tmail-signature-button">Signature</div><div class="tmail-signature-content">Content</div></div>'; | ||
String expectedContent = '<p>Hello dab</p><div class="tmail-signature"><div class="tmail-signature-content">Content</div></div>'; | ||
|
||
String actualContent = await HtmlUtils.removeCollapsedSignatureEffect(originContent); | ||
|
||
expect(actualContent, expectedContent); | ||
}); | ||
|
||
test('RemoveCollapsedSignatureEffect should remove all signature html tags when content CONTAIN MULTIPLE tag with attribute class is `tmail-signature-button`', () async { | ||
String originContent = '<p>Hello dab</p><div class="tmail-signature"><div class="tmail-signature-button">Signature 1</div><div class="tmail-signature-content">Content 1</div></div><div class="tmail-signature"><div class="tmail-signature-button">Signature 2</div><div class="tmail-signature-content">Content 2</div></div>'; | ||
String expectedContent = '<p>Hello dab</p><div class="tmail-signature"><div class="tmail-signature-content">Content 1</div></div><div class="tmail-signature"><div class="tmail-signature-content">Content 2</div></div>'; | ||
|
||
String actualContent = await HtmlUtils.removeCollapsedSignatureEffect(originContent); | ||
|
||
expect(actualContent, expectedContent); | ||
}); | ||
|
||
test('RemoveCollapsedSignatureEffect should be return origin content when content NOT CONTAIN tag with attribute class is `tmail-signature-button`', () async { | ||
String originContent = '<p>Hello dab</p><div class="tmail-signature"><div class="tmail-signature-content">Content</div></div>'; | ||
String expectedContent = '<p>Hello dab</p><div class="tmail-signature"><div class="tmail-signature-content">Content</div></div>'; | ||
|
||
String actualContent = await HtmlUtils.removeCollapsedSignatureEffect(originContent); | ||
|
||
expect(actualContent, expectedContent); | ||
}); | ||
}); | ||
} |