Fixed HTMLEntities{De,En}coder file names and added tests.

This commit is contained in:
Manuel Friedli 2018-09-01 00:08:37 +02:00
parent 8280e0be94
commit f46604b523
5 changed files with 30 additions and 2 deletions

View file

@ -5,8 +5,8 @@ import {Converter} from './converter/converter';
import {DecToBinConverter} from './converter/dec-to-bin-converter';
import {DecToHexConverter} from './converter/dec-to-hex-converter';
import {HexToDecConverter} from './converter/hex-to-dec-converter';
import {HTMLEntitiesDecoder} from './converter/htmlentitiesdecoder';
import {HTMLEntitiesEncoder} from './converter/htmlentitiesencoder';
import {HTMLEntitiesDecoder} from './converter/htmlentities-decoder';
import {HTMLEntitiesEncoder} from './converter/htmlentities-encoder';
import {Injectable} from '@angular/core';
import {NativeLibraryWrapperService} from './native-library-wrapper.service';
import {PunycodeDecoder} from './converter/punycodedecoder';

View file

@ -0,0 +1,14 @@
import {HTMLEntitiesDecoder} from './htmlentities-decoder';
describe('HTMLEntitiesDecoder', () => {
it('should create an instance', () => {
expect(new HTMLEntitiesDecoder()).toBeTruthy();
});
it('should have the id "decodehtmlentities"', () => {
expect(new HTMLEntitiesDecoder().getId()).toEqual('decodehtmlentities');
});
it('should decode "&lt;span&gt;&quot;Hi&quot; &amp; &quot;Lo&quot;&lt;/span&gt;" to "<span>"Hi" & "Lo"</span>"', () => {
expect(new HTMLEntitiesDecoder().convert('&lt;span&gt;&quot;Hi&quot; &amp; &quot;Lo&quot;&lt;/span&gt;'))
.toEqual('<span>"Hi" & "Lo"</span>');
});
});

View file

@ -0,0 +1,14 @@
import {HTMLEntitiesEncoder} from './htmlentities-encoder';
describe('HTMLEntitiesEncoder', () => {
it('should create an instance', () => {
expect(new HTMLEntitiesEncoder()).toBeTruthy();
});
it('should have the id "encodehtmlentities"', () => {
expect(new HTMLEntitiesEncoder().getId()).toEqual('encodehtmlentities');
});
it('should encode "<span>"Hi" & "Lo"</span>" to "&lt;span&gt;&quot;Hi&quot; &amp; &quot;Lo&quot;&lt;/span&gt;"', () => {
expect(new HTMLEntitiesEncoder().convert('<span>"Hi" & "Lo"</span>'))
.toEqual('&lt;span&gt;&quot;Hi&quot; &amp; &quot;Lo&quot;&lt;/span&gt;');
});
});