|
@@ -98,55 +98,6 @@ describe('Filters', function() {
|
|
|
|
|
|
});
|
|
|
|
|
|
- describe('htmlToAsciiMarkup', function() {
|
|
|
-
|
|
|
- this.testPatterns = (cases) => testPatterns('htmlToAsciiMarkup', cases);
|
|
|
-
|
|
|
- it('converts bold text', () => {
|
|
|
- this.testPatterns([
|
|
|
- ['<b>bold</b>', '*bold*'],
|
|
|
- ['< b >bold</b>', '*bold*'],
|
|
|
- ['<B>bold</b>', '*bold*'],
|
|
|
- ['<b class="gsdf">bold</b>', '*bold*'],
|
|
|
- ['<strong>bold</strong>', '*bold*'],
|
|
|
- ['<b><b>bold</b></b>', '**bold**'],
|
|
|
- ['<b><strong>bold</strong></b>', '**bold**'],
|
|
|
- ]);
|
|
|
- });
|
|
|
-
|
|
|
- it('converts italic text', () => {
|
|
|
- this.testPatterns([
|
|
|
- ['<i>italic</i>', '_italic_'],
|
|
|
- ['<i onclick="alert(1)">italic</i>', '_italic_'],
|
|
|
- ['<em>italic</em>', '_italic_'],
|
|
|
- ['<i><em>italic</em></i>', '__italic__'],
|
|
|
- ]);
|
|
|
- });
|
|
|
-
|
|
|
- it('converts strikethrough text', () => {
|
|
|
- this.testPatterns([
|
|
|
- ['<strike>strikethrough</strike>', '~strikethrough~'],
|
|
|
- ['<del>strikethrough</del>', '~strikethrough~'],
|
|
|
- ['<del href="/">strikethrough</del>', '~strikethrough~'],
|
|
|
- ['<s>strikethrough</s>', '~strikethrough~'],
|
|
|
- ['<strike><del><s>strikethrough</s></del></strike>', '~~~strikethrough~~~'],
|
|
|
- ]);
|
|
|
- });
|
|
|
-
|
|
|
- it('does not affect other tags', () => {
|
|
|
- this.testPatterns([
|
|
|
- ['<script>alert("pho soup time")</script>', '<script>alert("pho soup time")</script>'],
|
|
|
- ]);
|
|
|
- });
|
|
|
-
|
|
|
- it('combination of all', () => {
|
|
|
- this.testPatterns([
|
|
|
- ['<b><em><del>foo</del></em></b>', '*_~foo~_*'],
|
|
|
- ]);
|
|
|
- });
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
describe('escapeHtml', function() {
|
|
|
|
|
|
this.testPatterns = (cases) => testPatterns('escapeHtml', cases);
|