Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs - html tester #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions angular-code-input/tsconfig.spec.json

This file was deleted.

126 changes: 116 additions & 10 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,150 @@
"newProjectRoot": "projects",
"projects": {
"angular-code-input": {
"root": "angular-code-input",
"sourceRoot": "angular-code-input/src",
"root": "projects/angular-code-input",
"sourceRoot": "projects/angular-code-input/src",
"projectType": "library",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "angular-code-input/tsconfig.lib.json",
"project": "angular-code-input/ng-package.json"
"tsConfig": "projects/angular-code-input/tsconfig.lib.json",
"project": "projects/angular-code-input/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "angular-code-input/tsconfig.lib.prod.json"
"tsConfig": "projects/angular-code-input/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "angular-code-input/src/test.ts",
"tsConfig": "angular-code-input/tsconfig.spec.json",
"karmaConfig": "angular-code-input/karma.conf.js"
"main": "projects/angular-code-input/src/test.ts",
"tsConfig": "projects/angular-code-input/tsconfig.spec.json",
"karmaConfig": "projects/angular-code-input/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"angular-code-input/tsconfig.lib.json",
"angular-code-input/tsconfig.spec.json"
"projects/angular-code-input/tsconfig.lib.json",
"projects/angular-code-input/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"angular-code-input-tester": {
"root": "projects/angular-code-input-tester/",
"sourceRoot": "projects/angular-code-input-tester/src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"aot": true,
"outputPath": "dist/angular-code-input-tester",
"index": "projects/angular-code-input-tester/src/index.html",
"main": "projects/angular-code-input-tester/src/main.ts",
"tsConfig": "projects/angular-code-input-tester/tsconfig.app.json",
"assets": [
"projects/angular-code-input-tester/src/favicon.ico",
"projects/angular-code-input-tester/src/assets"
],
"styles": [
"projects/angular-code-input-tester/src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "projects/angular-code-input-tester/src/environments/environment.ts",
"with": "projects/angular-code-input-tester/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"buildTarget": "angular-code-input-tester:build"
},
"configurations": {
"production": {
"buildTarget": "angular-code-input-tester:build:production"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "projects/angular-code-input-tester/tsconfig.spec.json",
"karmaConfig": "projects/angular-code-input-tester/karma.conf.js",
"polyfills": [
"zone.js",
"zone.js/testing"
],
"assets": [
"projects/angular-code-input-tester/src/favicon.ico",
"projects/angular-code-input-tester/src/assets"
],
"styles": [
"projects/angular-code-input-tester/src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/angular-code-input-tester//**/*.ts",
"projects/angular-code-input-tester//**/*.html"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "projects/angular-code-input-tester/e2e/protractor.conf.js",
"devServerTarget": "angular-code-input-tester:serve"
},
"configurations": {
"production": {
"devServerTarget": "angular-code-input-tester:serve:production"
}
}
}
}
}
}
}
11 changes: 11 additions & 0 deletions projects/angular-code-input-tester/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 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
47 changes: 47 additions & 0 deletions projects/angular-code-input-tester/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"extends": "../../.eslintrc.json",
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": [
"projects/angular-code-input-tester//tsconfig.app.json",
"projects/angular-code-input-tester//tsconfig.spec.json",
"projects/angular-code-input-tester//e2e/tsconfig.json"
],
"createDefaultProgram": true
},
"rules": {
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"arrow-parens": ["off", "always"],
"import/order": "off"
}
},
{
"files": ["*.html"],
"rules": {}
}
]
}
32 changes: 32 additions & 0 deletions projects/angular-code-input-tester/e2e/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');

/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
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.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
27 changes: 27 additions & 0 deletions projects/angular-code-input-tester/e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { browser, logging } from "protractor";
import { AppPage } from "./app.po";

describe("workspace-project App", () => {
let page: AppPage;

beforeEach(() => {
page = new AppPage();
});

it("should display welcome message", () => {
page.navigateTo();
expect(page.getTitleText()).toEqual(
"Welcome to angular-code-input-tester!"
);
});

afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(
jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry)
);
});
});
11 changes: 11 additions & 0 deletions projects/angular-code-input-tester/e2e/src/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { browser, by, element } from 'protractor';

export class AppPage {
navigateTo() {
return browser.get(browser.baseUrl) as Promise<any>;
}

getTitleText() {
return element(by.css('app-root h1')).getText() as Promise<string>;
}
}
9 changes: 9 additions & 0 deletions projects/angular-code-input-tester/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "../../../out-tsc/e2e",
"module": "commonjs",
"target": "es2020",
"types": ["jasmine", "jasminewd2", "node"]
}
}
41 changes: 41 additions & 0 deletions projects/angular-code-input-tester/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: "",
frameworks: ["jasmine", "@angular-devkit/build-angular"],
plugins: [
require("karma-jasmine"),
require("karma-chrome-launcher"),
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/angular-code-input-tester"
),
reports: ["html", "lcovonly", "text-summary"],
fixWebpackSourcePaths: true,
},
reporters: ["coverage-istanbul", "progress", "kjhtml"],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ["Chrome", "ChromeHeadless", "ChromeHeadlessCI"],
customLaunchers: {
ChromeHeadlessCI: {
base: "ChromeHeadless",
flags: ["--no-sandbox"],
},
},
singleRun: false,
restartOnFileChange: true,
});
};
13 changes: 13 additions & 0 deletions projects/angular-code-input-tester/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<h1>Test Angular code input</h1>

<!-- @TODO: add toggle -->

<code-input
[codeLength]="5"
(codeChanged)="onCodeChanged($event)"
(codeCompleted)="onCodeCompleted($event)"
>
</code-input>

<p>codeChange: {{ codeChanged }}</p>
<p>codeCompleted: {{ codeCompleted }}</p>
5 changes: 5 additions & 0 deletions projects/angular-code-input-tester/src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:host {
code-input {
max-width: 270px;
}
}
Loading