Tests run again. Regenerated all with angular 17.
This commit is contained in:
parent
59cb96f426
commit
d8e4c7689f
51 changed files with 704 additions and 3998 deletions
|
@ -1,4 +1,4 @@
|
|||
# Editor configuration, see http://editorconfig.org
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
|
@ -8,6 +8,9 @@ indent_size = 2
|
|||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
quote_type = single
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
|
|
30
.gitignore
vendored
30
.gitignore
vendored
|
@ -1,46 +1,42 @@
|
|||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
# Compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/bazel-out
|
||||
|
||||
# dependencies
|
||||
# Node
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
.idea/
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
*.iml
|
||||
|
||||
# IDE - VSCode
|
||||
.vscode/*
|
||||
# Visual Studio Code
|
||||
.vscode/tasks.json
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history/*
|
||||
|
||||
# misc
|
||||
/.sass-cache
|
||||
# Miscellaneous
|
||||
/.angular/cache
|
||||
.sass-cache/
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
npm-debug.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# e2e
|
||||
# /e2e/*.js
|
||||
/e2e/*.map
|
||||
|
||||
# System Files
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
*~
|
||||
|
||||
.angular/
|
||||
|
|
12
README.md
12
README.md
|
@ -1,4 +1,4 @@
|
|||
# convertorizr - Convert whatever you want!
|
||||
# Convertorizr - Convert whatever you want!
|
||||
|
||||
This is a short introduction to the awesome Convertorizr hosted at https://conv.friedli.info/.
|
||||
|
||||
|
@ -11,11 +11,11 @@ Cheers!
|
|||
|
||||
# Technical stuff
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.1.5.
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.1.0.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
|
@ -23,7 +23,7 @@ Run `ng generate component component-name` to generate a new component. You can
|
|||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
|
@ -31,8 +31,8 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
|
|||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
||||
|
|
123
angular.json
123
angular.json
|
@ -3,25 +3,28 @@
|
|||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"converter": {
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"convertorizr": {
|
||||
"projectType": "application",
|
||||
"prefix": "app",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"styleext": "scss"
|
||||
"style": "scss"
|
||||
}
|
||||
},
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"builder": "@angular-devkit/build-angular:application",
|
||||
"options": {
|
||||
"outputPath": "dist/converter",
|
||||
"outputPath": "dist/convertorizr",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "src/tsconfig.app.json",
|
||||
"browser": "src/main.ts",
|
||||
"polyfills": [
|
||||
"zone.js"
|
||||
],
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
|
@ -33,100 +36,66 @@
|
|||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"fileReplacements": [
|
||||
"budgets": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
"type": "initial",
|
||||
"maximumWarning": "500kb",
|
||||
"maximumError": "1mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"namedChunks": false,
|
||||
"aot": true,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false,
|
||||
"buildOptimizer": true
|
||||
}
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"optimization": false,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"options": {
|
||||
"buildTarget": "converter:build"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"buildTarget": "converter:build:production"
|
||||
}
|
||||
"buildTarget": "convertorizr:build:production"
|
||||
},
|
||||
"development": {
|
||||
"buildTarget": "convertorizr:build:development"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"buildTarget": "converter:build"
|
||||
"buildTarget": "convertorizr:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "src/test.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "src/tsconfig.spec.json",
|
||||
"karmaConfig": "src/karma.conf.js",
|
||||
"styles": [
|
||||
"src/styles.scss"
|
||||
"polyfills": [
|
||||
"zone.js",
|
||||
"zone.js/testing"
|
||||
],
|
||||
"scripts": [],
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
]
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"src/tsconfig.app.json",
|
||||
"src/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"converter-e2e": {
|
||||
"root": "e2e/",
|
||||
"projectType": "application",
|
||||
"architect": {
|
||||
"e2e": {
|
||||
"builder": "@angular-devkit/build-angular:protractor",
|
||||
"options": {
|
||||
"protractorConfig": "e2e/protractor.conf.js",
|
||||
"devServerTarget": "converter:serve"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"devServerTarget": "converter:serve:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": "e2e/tsconfig.e2e.json",
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
"styles": [
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cli": {
|
||||
"analytics": false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
// Protractor configuration file, see link for more information
|
||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||
|
||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
||||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
specs: [
|
||||
'./src/**/*.e2e-spec.ts'
|
||||
],
|
||||
capabilities: {
|
||||
'browserName': 'chrome',
|
||||
chromeOptions: {
|
||||
args: [ "--headless", "--disable-gpu", "--no-sandbox" ]
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:4200/',
|
||||
framework: 'jasmine',
|
||||
jasmineNodeOpts: {
|
||||
showColors: true,
|
||||
defaultTimeoutInterval: 30000,
|
||||
print: function() {}
|
||||
},
|
||||
onPrepare() {
|
||||
require('ts-node').register({
|
||||
project: require('path').join(__dirname, './tsconfig.e2e.json')
|
||||
});
|
||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
||||
}
|
||||
};
|
|
@ -1,41 +0,0 @@
|
|||
import {ConvertorizrPage} from './app.po';
|
||||
|
||||
describe('convertorizr App', () => {
|
||||
let page: ConvertorizrPage;
|
||||
|
||||
beforeEach(() => {
|
||||
page = new ConvertorizrPage();
|
||||
});
|
||||
|
||||
it('should display a textarea that is initially empty', () => {
|
||||
page.navigateTo()
|
||||
.then(() => page.getInputFieldContent(0))
|
||||
.then((value: string) => {
|
||||
expect(value).toEqual('');
|
||||
});
|
||||
});
|
||||
|
||||
it('should convert a string to its base64 representation', () => {
|
||||
page.navigateTo()
|
||||
.then(() => page.setInputFieldContent(0, 'Hello, World!'))
|
||||
.then(() => page.getSelectedConverterOption(0))
|
||||
.then((option: string) => {
|
||||
expect(option).toEqual('Select conversion ...');
|
||||
})
|
||||
.then(() => page.selectConverterOption(0, 'Encode Base 64'))
|
||||
.then(() => page.getInputFieldContent(1))
|
||||
.then((content: string) => {
|
||||
expect(content).toEqual('SGVsbG8sIFdvcmxkIQ==');
|
||||
});
|
||||
});
|
||||
|
||||
it('should display an error message if the conversion fails', () => {
|
||||
page.navigateTo()
|
||||
.then(() => page.setInputFieldContent(0, 'Oh noes!'))
|
||||
.then(() => page.selectConverterOption(0, 'Decode Base 64'))
|
||||
.then(() => page.getErrorMessage(0))
|
||||
.then((content: string) => {
|
||||
expect(content).toEqual('Could not decode base64 string. Maybe corrupt input?');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,53 +0,0 @@
|
|||
import {browser, by, element, ElementFinder} from 'protractor';
|
||||
import {promise, WebElementPromise} from 'selenium-webdriver';
|
||||
|
||||
export class ConvertorizrPage {
|
||||
navigateTo(): promise.Promise<any> {
|
||||
return browser.get('/');
|
||||
}
|
||||
|
||||
private getInputField(index: number): WebElementPromise {
|
||||
return element
|
||||
.all(by.css('app-root div.inputwrapper'))
|
||||
.get(index)
|
||||
.element(by.css('.textwrapper textarea'))
|
||||
.getWebElement();
|
||||
}
|
||||
|
||||
getInputFieldContent(index: number): promise.Promise<string> {
|
||||
return this.getInputField(index).getText();
|
||||
}
|
||||
|
||||
setInputFieldContent(index: number, content: string): promise.Promise<void> {
|
||||
return this.getInputField(index).sendKeys(content);
|
||||
}
|
||||
|
||||
private getConverterDropdown(index: number): ElementFinder {
|
||||
return element
|
||||
.all(by.css('app-root div.inputwrapper'))
|
||||
.get(index)
|
||||
.element(by.css('.selectwrapper select'));
|
||||
}
|
||||
|
||||
getSelectedConverterOption(index: number): promise.Promise<string> {
|
||||
return this.getConverterDropdown(index)
|
||||
.$('option:checked')
|
||||
.getWebElement()
|
||||
.getText();
|
||||
}
|
||||
|
||||
selectConverterOption(index: number, optionName: string): promise.Promise<void> {
|
||||
return this.getConverterDropdown(index)
|
||||
.element(by.cssContainingText('option', optionName))
|
||||
.click();
|
||||
}
|
||||
|
||||
getErrorMessage(index: number): promise.Promise<string> {
|
||||
return element
|
||||
.all(by.css('app-root div.inputwrapper'))
|
||||
.get(index)
|
||||
.element(by.css('app-error-message div.errormessage'))
|
||||
.getWebElement()
|
||||
.getText();
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"jasminewd2",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
3677
package-lock.json
generated
3677
package-lock.json
generated
File diff suppressed because it is too large
Load diff
45
package.json
45
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "convertorizr",
|
||||
"version": "1.3.1-1",
|
||||
"version": "2.0.0-dev.1",
|
||||
"description": "Decode or encode base64, punycode, HTML entities, URI components, ...",
|
||||
"keywords": [
|
||||
"encode",
|
||||
|
@ -14,7 +14,7 @@
|
|||
"email": "manuel@fritteli.ch"
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage": "https://manuel.pages.gittr.ch/dencode.org",
|
||||
"homepage": "https://conv.friedli.info/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gittr.ch/manuel/converter.git"
|
||||
|
@ -23,15 +23,13 @@
|
|||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"build-prod": "ng build --configuration production --build-optimizer",
|
||||
"test": "ng test --code-coverage",
|
||||
"test:ci": "ng test --browsers ChromeHeadlessNoSandbox --watch=false --code-coverage",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"postinstall": "npm rebuild node-sass"
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test",
|
||||
"test:ci": "ng test --no-watch --no-progress --browsers=ChromiumHeadless"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^17.1.0",
|
||||
"@angular/common": "^17.1.0",
|
||||
"@angular/compiler": "^17.1.0",
|
||||
"@angular/core": "^17.1.0",
|
||||
|
@ -39,35 +37,28 @@
|
|||
"@angular/platform-browser": "^17.1.0",
|
||||
"@angular/platform-browser-dynamic": "^17.1.0",
|
||||
"@angular/router": "^17.1.0",
|
||||
"core-js": "^3.35.1",
|
||||
"punycode": "^2.3.1",
|
||||
"quoted-printable": "^1.0.1",
|
||||
"rxjs": "^7",
|
||||
"rxjs": "~7.8.0",
|
||||
"tslib": "^2.3.0",
|
||||
"utf8": "^3.0.0",
|
||||
"zone.js": "^0.14"
|
||||
"zone.js": "~0.14.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^17.1.0",
|
||||
"@angular/cli": "^17.1.0",
|
||||
"@angular/compiler-cli": "^17.1.0",
|
||||
"@types/jasmine": "^5.1.4",
|
||||
"@types/jasminewd2": "^2.0.13",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"@types/node": "^20.11.5",
|
||||
"@types/punycode": "^2.1.3",
|
||||
"@types/quoted-printable": "^1.0.2",
|
||||
"@types/utf8": "^3.0.3",
|
||||
"codelyzer": "^6.0.2",
|
||||
"jasmine-core": "^5.1.1",
|
||||
"jasmine-spec-reporter": "^7.0.0",
|
||||
"karma": "^6.4.2",
|
||||
"karma-chrome-launcher": "^3.2.0",
|
||||
"karma-coverage-istanbul-reporter": "^3.0.3",
|
||||
"karma-jasmine": "^5.1.0",
|
||||
"karma-jasmine-html-reporter": "^2.1.0",
|
||||
"karma-nightmare": "^0.4.15",
|
||||
"protractor": "^7.0.0",
|
||||
"puppeteer": "^21.7.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"tslint": "^6.1.3",
|
||||
"typescript": "^5.2"
|
||||
"jasmine-core": "~5.1.0",
|
||||
"karma": "~6.4.0",
|
||||
"karma-chrome-launcher": "~3.2.0",
|
||||
"karma-coverage": "~2.2.0",
|
||||
"karma-jasmine": "~5.1.0",
|
||||
"karma-jasmine-html-reporter": "~2.1.0",
|
||||
"typescript": "~5.3.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<div *ngFor="let step of steps" class="inputwrapper">
|
||||
@for (step of steps; track step.index) {
|
||||
<div class="inputwrapper">
|
||||
<app-text-input-field [step]="step" #ti></app-text-input-field>
|
||||
<app-converter-selector [step]="step" [textInput]="ti"></app-converter-selector>
|
||||
<app-error-message [step]="step"></app-error-message>
|
||||
</div>
|
||||
}
|
||||
<app-version></app-version>
|
||||
<!--<router-outlet></router-outlet>-->
|
||||
|
|
|
@ -1,39 +1,26 @@
|
|||
import {AppComponent} from './app.component';
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {Step} from './step';
|
||||
import {VersionComponent} from './version/version.component';
|
||||
import {ConverterSelectorComponent} from './converter-selector/converter-selector.component';
|
||||
import {TextInputFieldComponent} from './text-input-field/text-input-field.component';
|
||||
import {ErrorMessageComponent} from './error-message/error-message.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
let sut: AppComponent;
|
||||
let fixture: ComponentFixture<AppComponent>;
|
||||
const firstStep: Step = new Step(0);
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
ConverterSelectorComponent,
|
||||
ErrorMessageComponent,
|
||||
TextInputFieldComponent,
|
||||
VersionComponent
|
||||
],
|
||||
imports: [FormsModule]
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [AppComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AppComponent);
|
||||
sut = fixture.componentInstance;
|
||||
});
|
||||
|
||||
it('should create the app', async(() => {
|
||||
it('should create the app', () => {
|
||||
// const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
}));
|
||||
expect(sut).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {InputComponentManagerService} from './input-component-manager.service';
|
||||
import {Step} from './step';
|
||||
import {RouterOutlet} from '@angular/router';
|
||||
import {TextInputFieldComponent} from './text-input-field/text-input-field.component';
|
||||
import {ConverterSelectorComponent} from './converter-selector/converter-selector.component';
|
||||
import {ErrorMessageComponent} from './error-message/error-message.component';
|
||||
import {VersionComponent} from './version/version.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
standalone: true,
|
||||
imports: [
|
||||
ConverterSelectorComponent,
|
||||
ErrorMessageComponent,
|
||||
RouterOutlet,
|
||||
TextInputFieldComponent,
|
||||
VersionComponent
|
||||
],
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss']
|
||||
styleUrl: './app.component.scss'
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
public steps: Step[] = [];
|
||||
|
|
8
src/app/app.config.ts
Normal file
8
src/app/app.config.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
import { routes } from './app.routes';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [provideRouter(routes)]
|
||||
};
|
|
@ -12,11 +12,11 @@ import { ErrorMessageComponent } from './error-message/error-message.component';
|
|||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
VersionComponent,
|
||||
TextInputFieldComponent,
|
||||
ConverterSelectorComponent,
|
||||
ErrorMessageComponent
|
||||
// AppComponent,
|
||||
// VersionComponent,
|
||||
// TextInputFieldComponent,
|
||||
// ConverterSelectorComponent,
|
||||
// ErrorMessageComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
@ -27,7 +27,7 @@ import { ErrorMessageComponent } from './error-message/error-message.component';
|
|||
InputComponentManagerService,
|
||||
NativeLibraryWrapperService
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
// bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule {
|
||||
}
|
||||
|
|
3
src/app/app.routes.ts
Normal file
3
src/app/app.routes.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { Routes } from '@angular/router';
|
||||
|
||||
export const routes: Routes = [];
|
|
@ -35,7 +35,7 @@ export class ConverterRegistryService {
|
|||
return this.converters;
|
||||
}
|
||||
|
||||
public getConverter(id: string): Converter {
|
||||
public getConverter(id: string): Converter | undefined {
|
||||
return this.converters.find((converter: Converter): boolean => converter.getId() === id);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
<div class="arrow_box">
|
||||
<select class="select" (change)="convert($event)">
|
||||
<option id="undefined">Select conversion ...</option>
|
||||
<option class="option" *ngFor="let c of converters" id="{{c.getId()}}">{{c.getDisplayname()}}
|
||||
</option>
|
||||
@for (c of converters; track c.getId()) {
|
||||
<option class="option" id="{{c.getId()}}">{{ c.getDisplayname() }}</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {ConverterSelectorComponent} from './converter-selector.component';
|
||||
import {Component, ViewChild} from '@angular/core';
|
||||
|
@ -17,7 +17,7 @@ class TestHostComponent {
|
|||
public step: Step = new Step(42);
|
||||
public textInputComponent: TextInputFieldComponent = new TextInputFieldComponent(inputComponentManagerServiceStub);
|
||||
@ViewChild(ConverterSelectorComponent)
|
||||
public sutComponent: ConverterSelectorComponent;
|
||||
public sutComponent!: ConverterSelectorComponent;
|
||||
}
|
||||
|
||||
const inputComponentManagerServiceStub = createSpyObj(['getNext']);
|
||||
|
@ -39,10 +39,10 @@ describe('ConverterSelectorComponent', () => {
|
|||
converterRegistryServiceStub.getAllConverters.and.returnValue([converter1, converter2, converter3]);
|
||||
converterRegistryServiceStub.getConverter.and.returnValue(undefined);
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ConverterSelectorComponent],
|
||||
declarations: [
|
||||
ConverterSelectorComponent,
|
||||
TestHostComponent
|
||||
],
|
||||
providers: [
|
||||
|
@ -51,7 +51,7 @@ describe('ConverterSelectorComponent', () => {
|
|||
]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
testHostFixture = TestBed.createComponent(TestHostComponent);
|
||||
|
@ -59,7 +59,7 @@ describe('ConverterSelectorComponent', () => {
|
|||
testHostFixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
it('should create the component', () => {
|
||||
expect(testHostComponent.sutComponent).toBeTruthy();
|
||||
});
|
||||
|
||||
|
|
|
@ -3,17 +3,20 @@ import {Step} from '../step';
|
|||
import {Converter} from '../converter/converter';
|
||||
import {ConverterRegistryService} from '../converter-registry.service';
|
||||
import {TextInputFieldComponent} from '../text-input-field/text-input-field.component';
|
||||
import {CommonModule} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-converter-selector',
|
||||
templateUrl: './converter-selector.component.html',
|
||||
styleUrls: ['./converter-selector.component.scss']
|
||||
standalone: true,
|
||||
styleUrls: ['./converter-selector.component.scss'],
|
||||
imports: [CommonModule]
|
||||
})
|
||||
export class ConverterSelectorComponent implements OnInit {
|
||||
@Input()
|
||||
public step: Step;
|
||||
public step!: Step;
|
||||
@Input()
|
||||
private textInput: TextInputFieldComponent;
|
||||
textInput!: TextInputFieldComponent;
|
||||
public converters: Converter[] = [];
|
||||
|
||||
constructor(private converterRegistryService: ConverterRegistryService) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {PunycodeDecoder} from './punycode-decoder';
|
||||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService, Punycode} from '../native-library-wrapper.service';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
||||
|
@ -9,8 +9,8 @@ describe('PunycodeDecoder', () => {
|
|||
let decodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {punycode: createSpyObj(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.punycode.decode as Spy;
|
||||
nativeWrapperSpy = {punycode: createSpyObj<Punycode>(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.punycode!.decode as Spy;
|
||||
sut = new PunycodeDecoder((nativeWrapperSpy as NativeLibraryWrapperService));
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService, Punycode} from '../native-library-wrapper.service';
|
||||
import {PunycodeEncoder} from './punycode-encoder';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
@ -9,8 +9,8 @@ describe('PunycodeEncoder', () => {
|
|||
let encodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {punycode: createSpyObj(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.punycode.encode as Spy;
|
||||
nativeWrapperSpy = {punycode: createSpyObj<Punycode>(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.punycode!.encode as Spy;
|
||||
sut = new PunycodeEncoder(nativeWrapperSpy as NativeLibraryWrapperService);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService, QuotedPrintable} from '../native-library-wrapper.service';
|
||||
import {QuotedPrintableDecoder} from './quoted-printable-decoder';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
@ -9,8 +9,8 @@ describe('QuotedPrintableDecoder', () => {
|
|||
let decodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {quotedPrintable: createSpyObj(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.quotedPrintable.decode as Spy;
|
||||
nativeWrapperSpy = {quotedPrintable: createSpyObj<QuotedPrintable>(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.quotedPrintable!.decode as Spy;
|
||||
sut = new QuotedPrintableDecoder((nativeWrapperSpy as NativeLibraryWrapperService));
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService, QuotedPrintable} from '../native-library-wrapper.service';
|
||||
import {QuotedPrintableEncoder} from './quoted-printable-encoder';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
@ -9,8 +9,8 @@ describe('QuotedPrintableEncoder', () => {
|
|||
let encodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {quotedPrintable: createSpyObj(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.quotedPrintable.encode as Spy;
|
||||
nativeWrapperSpy = {quotedPrintable: createSpyObj<QuotedPrintable>(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.quotedPrintable!.encode as Spy;
|
||||
sut = new QuotedPrintableEncoder(nativeWrapperSpy as NativeLibraryWrapperService);
|
||||
});
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ export class ROT13Converter implements Converter {
|
|||
try {
|
||||
const inChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||
const outChars = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm';
|
||||
const translate = c => {
|
||||
const translate = (c: string) => {
|
||||
const charIndex = inChars.indexOf(c);
|
||||
return charIndex > -1 ? outChars[charIndex] : c;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService, Utf8} from '../native-library-wrapper.service';
|
||||
import {UTF8Decoder} from './utf8-decoder';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
@ -9,8 +9,8 @@ describe('UTF8Decoder', () => {
|
|||
let decodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {utf8: createSpyObj(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.utf8.decode as Spy;
|
||||
nativeWrapperSpy = {utf8: createSpyObj<Utf8>(['decode'])};
|
||||
decodeSpy = nativeWrapperSpy.utf8!.decode as Spy;
|
||||
sut = new UTF8Decoder((nativeWrapperSpy as NativeLibraryWrapperService));
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {NativeLibraryWrapperService} from '../native-library-wrapper.service';
|
||||
import {NativeLibraryWrapperService, Utf8} from '../native-library-wrapper.service';
|
||||
import {UTF8Encoder} from './utf8-encoder';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import Spy = jasmine.Spy;
|
||||
|
@ -9,8 +9,8 @@ describe('UTF8Encoder', () => {
|
|||
let encodeSpy: Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
nativeWrapperSpy = {utf8: createSpyObj(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.utf8.encode as Spy;
|
||||
nativeWrapperSpy = {utf8: createSpyObj<Utf8>(['encode'])};
|
||||
encodeSpy = nativeWrapperSpy.utf8!.encode as Spy;
|
||||
sut = new UTF8Encoder(nativeWrapperSpy as NativeLibraryWrapperService);
|
||||
});
|
||||
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
<div class="errormessage" *ngIf="step.error" [innerHTML]="step.message"></div>
|
||||
@if (step.error) {
|
||||
<div class="errormessage" [innerHTML]="step.message"></div>
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {ErrorMessageComponent} from './error-message.component';
|
||||
import {Component, ViewChild} from '@angular/core';
|
||||
|
@ -10,22 +10,20 @@ import {Step} from '../step';
|
|||
class TestHostComponent {
|
||||
public step: Step = new Step(42);
|
||||
@ViewChild(ErrorMessageComponent)
|
||||
public sutComponent: ErrorMessageComponent;
|
||||
public sutComponent!: ErrorMessageComponent;
|
||||
}
|
||||
|
||||
describe('ErrorMessageComponent', () => {
|
||||
let testHostComponent: TestHostComponent;
|
||||
let testHostFixture: ComponentFixture<TestHostComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
ErrorMessageComponent,
|
||||
TestHostComponent
|
||||
]
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ErrorMessageComponent],
|
||||
declarations: [TestHostComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
testHostFixture = TestBed.createComponent(TestHostComponent);
|
||||
|
|
|
@ -4,11 +4,12 @@ import {Step} from '../step';
|
|||
@Component({
|
||||
selector: 'app-error-message',
|
||||
templateUrl: './error-message.component.html',
|
||||
standalone: true,
|
||||
styleUrls: ['./error-message.component.scss']
|
||||
})
|
||||
export class ErrorMessageComponent {
|
||||
@Input()
|
||||
public step: Step;
|
||||
public step!: Step;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
|
|
@ -24,12 +24,12 @@ describe('InputComponentManagerService', () => {
|
|||
);
|
||||
|
||||
it('must not add a null Step', inject([InputComponentManagerService], (service: InputComponentManagerService) => {
|
||||
expect(() => service.register(null)).toThrowError();
|
||||
expect(() => service.register(null!)).toThrowError();
|
||||
expect(service.getAllComponents().length).toEqual(0);
|
||||
}));
|
||||
|
||||
it('must not add an undefined Step', inject([InputComponentManagerService], (service: InputComponentManagerService) => {
|
||||
expect(() => service.register(undefined)).toThrowError();
|
||||
expect(() => service.register(undefined!)).toThrowError();
|
||||
expect(service.getAllComponents().length).toEqual(0);
|
||||
}));
|
||||
|
||||
|
|
|
@ -18,19 +18,19 @@ export class NativeLibraryWrapperService {
|
|||
}
|
||||
}
|
||||
|
||||
interface Punycode {
|
||||
export interface Punycode {
|
||||
encode(input: string): string;
|
||||
|
||||
decode(input: string): string;
|
||||
}
|
||||
|
||||
interface QuotedPrintable {
|
||||
export interface QuotedPrintable {
|
||||
encode(input: string): string;
|
||||
|
||||
decode(input: string): string;
|
||||
}
|
||||
|
||||
interface Utf8 {
|
||||
export interface Utf8 {
|
||||
encode(input: any): string;
|
||||
|
||||
decode(input: string): any;
|
||||
|
|
|
@ -2,7 +2,7 @@ import {Converter} from './converter/converter';
|
|||
|
||||
export class Step {
|
||||
public content = '';
|
||||
public selectedConverter: Converter = undefined;
|
||||
public selectedConverter: Converter | undefined;
|
||||
public index: number;
|
||||
public error = false;
|
||||
public message = '';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {TextInputFieldComponent} from './text-input-field.component';
|
||||
import {Step} from '../step';
|
||||
|
@ -13,7 +13,7 @@ import createSpyObj = jasmine.createSpyObj;
|
|||
class TestHostComponent {
|
||||
public step: Step = new Step(42);
|
||||
@ViewChild(TextInputFieldComponent)
|
||||
public sutComponent: TextInputFieldComponent;
|
||||
public sutComponent!: TextInputFieldComponent;
|
||||
}
|
||||
|
||||
describe('TextInputFieldComponent', () => {
|
||||
|
@ -23,17 +23,16 @@ describe('TextInputFieldComponent', () => {
|
|||
const inputComponentManagerServiceStub = createSpyObj(['getNext']);
|
||||
inputComponentManagerServiceStub.getNext.and.returnValue(undefined);
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
TestHostComponent,
|
||||
TextInputFieldComponent
|
||||
TestHostComponent
|
||||
],
|
||||
imports: [FormsModule],
|
||||
imports: [TextInputFieldComponent, FormsModule],
|
||||
providers: [{provide: InputComponentManagerService, useValue: inputComponentManagerServiceStub}]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
testHostFixture = TestBed.createComponent(TestHostComponent);
|
||||
|
@ -41,7 +40,7 @@ describe('TextInputFieldComponent', () => {
|
|||
testHostFixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
it('should create the component', () => {
|
||||
expect(testHostComponent.sutComponent).toBeTruthy();
|
||||
});
|
||||
|
||||
|
|
|
@ -2,32 +2,35 @@ import {Component, Input} from '@angular/core';
|
|||
import {Step} from '../step';
|
||||
import {Converter} from '../converter/converter';
|
||||
import {InputComponentManagerService} from '../input-component-manager.service';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-text-input-field',
|
||||
templateUrl: './text-input-field.component.html',
|
||||
styleUrls: ['./text-input-field.component.scss']
|
||||
standalone: true,
|
||||
styleUrls: ['./text-input-field.component.scss'],
|
||||
imports: [FormsModule]
|
||||
})
|
||||
export class TextInputFieldComponent {
|
||||
@Input()
|
||||
public step: Step;
|
||||
public step!: Step;
|
||||
|
||||
constructor(private inputComponentManagerService: InputComponentManagerService) {
|
||||
}
|
||||
|
||||
update(step: Step): void {
|
||||
const converter: Converter = step.selectedConverter;
|
||||
const converter: Converter | undefined = step.selectedConverter;
|
||||
|
||||
if (converter !== undefined) {
|
||||
const content: string = step.content;
|
||||
let result: string;
|
||||
let result: string | null;
|
||||
try {
|
||||
result = converter.convert(content);
|
||||
} catch (error) {
|
||||
if (typeof console === 'object' && typeof console.log === 'function') {
|
||||
console.log(error);
|
||||
}
|
||||
step.message = error.message;
|
||||
step.message = (error as Error).message;
|
||||
step.error = true;
|
||||
result = null;
|
||||
}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {VersionComponent} from './version.component';
|
||||
import {environment} from '../../environments/environment';
|
||||
import packageInfo from '../../../package.json';
|
||||
|
||||
describe('VersionComponent', () => {
|
||||
let component: VersionComponent;
|
||||
let fixture: ComponentFixture<VersionComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [VersionComponent]
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [VersionComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(VersionComponent);
|
||||
|
@ -20,13 +20,13 @@ describe('VersionComponent', () => {
|
|||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
it('should create the component', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should contain the correct version', () => {
|
||||
// when executing the test, we're always running with the dev environment
|
||||
expect(component.VERSION).toEqual(`${environment.appVersion} (development build)`);
|
||||
expect(component.VERSION).toEqual(`${packageInfo.version} (development build)`);
|
||||
});
|
||||
|
||||
it('should have the correct value for the "production" property', () => {
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {environment} from '../../environments/environment';
|
||||
import {Component, isDevMode} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import packageInfo from '../../../package.json';
|
||||
|
||||
@Component({
|
||||
selector: 'app-version',
|
||||
templateUrl: './version.component.html',
|
||||
styleUrls: ['./version.component.scss']
|
||||
standalone: true,
|
||||
styleUrls: ['./version.component.scss'],
|
||||
imports: [CommonModule]
|
||||
})
|
||||
export class VersionComponent {
|
||||
public readonly PROD: boolean = environment.production;
|
||||
public readonly VERSION: string = environment.appVersion + (this.PROD ? '' : ' (development build)');
|
||||
public readonly PROD: boolean = !isDevMode();
|
||||
public readonly VERSION: string = packageInfo.version + (this.PROD ? '' : ' (development build)');
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
#
|
||||
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
|
||||
|
||||
> 0.5%
|
||||
last 2 versions
|
||||
Firefox ESR
|
||||
not dead
|
||||
not IE 9-11
|
|
@ -1,4 +0,0 @@
|
|||
export const environment = {
|
||||
production: true,
|
||||
appVersion: require('../../package.json').version
|
||||
};
|
|
@ -1,16 +0,0 @@
|
|||
// This file can be replaced during build by using the `fileReplacements` array.
|
||||
// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
appVersion: require('../../package.json').version
|
||||
};
|
||||
|
||||
/*
|
||||
* In development mode, for easier debugging, you can ignore zone related error
|
||||
* stack frames such as `zone.run`/`zoneDelegate.invokeTask` by importing the
|
||||
* below file. Don't forget to comment it out in production mode
|
||||
* because it will have a performance impact when errors are thrown
|
||||
*/
|
||||
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
|
@ -1,40 +0,0 @@
|
|||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine'),
|
||||
require('karma-nightmare'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client: {
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
dir: require('path').join(__dirname, '../coverage'),
|
||||
reports: ['html', 'lcovonly'],
|
||||
fixWebpackSourcePaths: true
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['ChromeHeadless'],
|
||||
customLaunchers: {
|
||||
ChromeHeadlessNoSandbox: {
|
||||
base: 'ChromeHeadless',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
singleRun: false
|
||||
});
|
||||
};
|
16
src/main.ts
16
src/main.ts
|
@ -1,12 +1,6 @@
|
|||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
import { appConfig } from './app/app.config';
|
||||
import { AppComponent } from './app/app.component';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.log(err));
|
||||
bootstrapApplication(AppComponent, appConfig)
|
||||
.catch((err) => console.error(err));
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
||||
// import 'core-js/es6/symbol';
|
||||
// import 'core-js/es6/object';
|
||||
// import 'core-js/es6/function';
|
||||
// import 'core-js/es6/parse-int';
|
||||
// import 'core-js/es6/parse-float';
|
||||
// import 'core-js/es6/number';
|
||||
// import 'core-js/es6/math';
|
||||
// import 'core-js/es6/string';
|
||||
// import 'core-js/es6/date';
|
||||
// import 'core-js/es6/array';
|
||||
// import 'core-js/es6/regexp';
|
||||
// import 'core-js/es6/map';
|
||||
// import 'core-js/es6/weak-map';
|
||||
// import 'core-js/es6/set';
|
||||
|
||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||
|
||||
/** IE10 and IE11 requires the following for the Reflect API. */
|
||||
// import 'core-js/es6/reflect';
|
||||
/** Evergreen browsers require these. **/
|
||||
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
|
||||
// import 'core-js/es7/reflect';
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js'; // Included with Angular CLI.
|
||||
|
||||
|
||||
/**
|
||||
* Web Animations `@angular/platform-browser/animations`
|
||||
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
||||
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
||||
**/
|
||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||
|
||||
/**
|
||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
*/
|
||||
|
||||
// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
|
||||
/*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*/
|
||||
// (window as any).__Zone_enable_cross_context_check = true;
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
20
src/test.ts
20
src/test.ts
|
@ -1,20 +0,0 @@
|
|||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: any;
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
"test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"test.ts",
|
||||
"polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"app",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"app",
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
16
tsconfig.app.json
Normal file
16
tsconfig.app.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/main.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
|
@ -1,21 +1,35 @@
|
|||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "ES2022",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"module": "ES2022",
|
||||
"useDefineForClassFields": false,
|
||||
"lib": [
|
||||
"ES2017",
|
||||
"DOM"
|
||||
]
|
||||
"ES2022",
|
||||
"dom"
|
||||
],
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true,
|
||||
"strictTemplates": true
|
||||
}
|
||||
}
|
||||
|
|
14
tsconfig.spec.json
Normal file
14
tsconfig.spec.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
130
tslint.json
130
tslint.json
|
@ -1,130 +0,0 @@
|
|||
{
|
||||
"rulesDirectory": [
|
||||
"node_modules/codelyzer"
|
||||
],
|
||||
"rules": {
|
||||
"arrow-return-shorthand": true,
|
||||
"callable-types": true,
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
"check-space"
|
||||
],
|
||||
"curly": true,
|
||||
"deprecation": {
|
||||
"severity": "warn"
|
||||
},
|
||||
"eofline": true,
|
||||
"forin": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs/Rx"
|
||||
],
|
||||
"import-spacing": true,
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"interface-over-type-literal": true,
|
||||
"label-position": true,
|
||||
"max-line-length": [
|
||||
true,
|
||||
140
|
||||
],
|
||||
"member-access": false,
|
||||
"member-ordering": [
|
||||
true,
|
||||
{
|
||||
"order": [
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"static-method",
|
||||
"instance-method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-arg": true,
|
||||
"no-bitwise": true,
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-construct": true,
|
||||
"no-debugger": true,
|
||||
"no-duplicate-super": true,
|
||||
"no-empty": false,
|
||||
"no-empty-interface": true,
|
||||
"no-eval": true,
|
||||
"no-inferrable-types": [
|
||||
true,
|
||||
"ignore-params"
|
||||
],
|
||||
"no-misused-new": true,
|
||||
"no-non-null-assertion": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-string-literal": false,
|
||||
"no-string-throw": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unnecessary-initializer": true,
|
||||
"no-unused-expression": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-keyword": true,
|
||||
"object-literal-sort-keys": false,
|
||||
"one-line": [
|
||||
true,
|
||||
"check-open-brace",
|
||||
"check-catch",
|
||||
"check-else",
|
||||
"check-whitespace"
|
||||
],
|
||||
"prefer-const": true,
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"radix": true,
|
||||
"semicolon": [
|
||||
true,
|
||||
"always"
|
||||
],
|
||||
"triple-equals": [
|
||||
true,
|
||||
"allow-null-check"
|
||||
],
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}
|
||||
],
|
||||
"unified-signatures": true,
|
||||
"variable-name": false,
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type"
|
||||
],
|
||||
"no-output-on-prefix": true,
|
||||
"use-input-property-decorator": true,
|
||||
"use-output-property-decorator": true,
|
||||
"use-host-property-decorator": true,
|
||||
"no-input-rename": true,
|
||||
"no-output-rename": true,
|
||||
"use-life-cycle-interface": true,
|
||||
"use-pipe-transform-interface": true,
|
||||
"component-class-suffix": true,
|
||||
"directive-class-suffix": true
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue