diff --git a/src/app/converter-registry.service.ts b/src/app/converter-registry.service.ts index dd6e19d..f99639f 100644 --- a/src/app/converter-registry.service.ts +++ b/src/app/converter-registry.service.ts @@ -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'; diff --git a/src/app/converter/htmlentities-decoder.spec.ts b/src/app/converter/htmlentities-decoder.spec.ts new file mode 100644 index 0000000..08136ea --- /dev/null +++ b/src/app/converter/htmlentities-decoder.spec.ts @@ -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 "<span>"Hi" & "Lo"</span>" to ""Hi" & "Lo""', () => { + expect(new HTMLEntitiesDecoder().convert('<span>"Hi" & "Lo"</span>')) + .toEqual('"Hi" & "Lo"'); + }); +}); diff --git a/src/app/converter/htmlentitiesdecoder.ts b/src/app/converter/htmlentities-decoder.ts similarity index 100% rename from src/app/converter/htmlentitiesdecoder.ts rename to src/app/converter/htmlentities-decoder.ts diff --git a/src/app/converter/htmlentities-encoder.spec.ts b/src/app/converter/htmlentities-encoder.spec.ts new file mode 100644 index 0000000..5c6aa09 --- /dev/null +++ b/src/app/converter/htmlentities-encoder.spec.ts @@ -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 ""Hi" & "Lo"" to "<span>"Hi" & "Lo"</span>"', () => { + expect(new HTMLEntitiesEncoder().convert('"Hi" & "Lo"')) + .toEqual('<span>"Hi" & "Lo"</span>'); + }); +}); diff --git a/src/app/converter/htmlentitiesencoder.ts b/src/app/converter/htmlentities-encoder.ts similarity index 100% rename from src/app/converter/htmlentitiesencoder.ts rename to src/app/converter/htmlentities-encoder.ts