feat(doc): move input-output

This commit is contained in:
thomas
2023-10-17 23:12:11 +02:00
parent bbb00d60e6
commit be270efde1
26 changed files with 41 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
{ {
"extends": ["../../.eslintrc.json"], "extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"], "ignorePatterns": ["!**/*"],
"overrides": [ "overrides": [
{ {

View File

@@ -5,7 +5,7 @@
### Run Application ### Run Application
```bash ```bash
npx nx serve testing-input-output npx nx serve test-input-output
``` ```
### Documentation and Instruction ### Documentation and Instruction

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>testing-input-output Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>

View File

@@ -1,7 +1,7 @@
/* eslint-disable */ /* eslint-disable */
export default { export default {
displayName: 'testing-input-output', displayName: 'test-input-output',
preset: '../../jest.preset.js', preset: '../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'], setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
transform: { transform: {
'^.+\\.(ts|mjs|js|html)$': [ '^.+\\.(ts|mjs|js|html)$': [

View File

@@ -1,25 +1,25 @@
{ {
"name": "testing-input-output", "name": "test-input-output",
"$schema": "../node_modules/nx/schemas/project-schema.json", "$schema": "../../../node_modules/nx/schemas/project-schema.json",
"projectType": "application", "projectType": "application",
"sourceRoot": "apps/testing-input-output/src", "sourceRoot": "apps/test/input-output/src",
"prefix": "app", "prefix": "app",
"targets": { "targets": {
"build": { "build": {
"executor": "@angular-devkit/build-angular:browser", "executor": "@angular-devkit/build-angular:browser",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"options": { "options": {
"outputPath": "dist/apps/testing-input-output", "outputPath": "dist/apps/test/input-output",
"index": "apps/testing-input-output/src/index.html", "index": "apps/test/input-output/src/index.html",
"main": "apps/testing-input-output/src/main.ts", "main": "apps/test/input-output/src/main.ts",
"polyfills": ["zone.js"], "polyfills": ["zone.js"],
"tsConfig": "apps/testing-input-output/tsconfig.app.json", "tsConfig": "apps/test/input-output/tsconfig.app.json",
"inlineStyleLanguage": "scss", "inlineStyleLanguage": "scss",
"assets": [ "assets": [
"apps/testing-input-output/src/favicon.ico", "apps/test/input-output/src/favicon.ico",
"apps/testing-input-output/src/assets" "apps/test/input-output/src/assets"
], ],
"styles": ["apps/testing-input-output/src/styles.scss"], "styles": ["apps/test/input-output/src/styles.scss"],
"scripts": [] "scripts": []
}, },
"configurations": { "configurations": {
@@ -53,10 +53,10 @@
"executor": "@angular-devkit/build-angular:dev-server", "executor": "@angular-devkit/build-angular:dev-server",
"configurations": { "configurations": {
"production": { "production": {
"browserTarget": "testing-input-output:build:production" "browserTarget": "test-input-output:build:production"
}, },
"development": { "development": {
"browserTarget": "testing-input-output:build:development" "browserTarget": "test-input-output:build:development"
} }
}, },
"defaultConfiguration": "development" "defaultConfiguration": "development"
@@ -64,7 +64,7 @@
"extract-i18n": { "extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n", "executor": "@angular-devkit/build-angular:extract-i18n",
"options": { "options": {
"browserTarget": "testing-input-output:build" "browserTarget": "test-input-output:build"
} }
}, },
"lint": { "lint": {
@@ -72,8 +72,8 @@
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": [ "lintFilePatterns": [
"apps/testing-input-output/**/*.ts", "apps/test/input-output/**/*.ts",
"apps/testing-input-output/**/*.html" "apps/test/input-output/**/*.html"
] ]
} }
}, },
@@ -81,7 +81,7 @@
"executor": "@nx/jest:jest", "executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": { "options": {
"jestConfig": "apps/testing-input-output/jest.config.ts", "jestConfig": "apps/test/input-output/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
}, },
"configurations": { "configurations": {
@@ -94,10 +94,10 @@
"component-test": { "component-test": {
"executor": "@nx/cypress:cypress", "executor": "@nx/cypress:cypress",
"options": { "options": {
"cypressConfig": "apps/testing-input-output/cypress.config.ts", "cypressConfig": "apps/test/input-output/cypress.config.ts",
"testingType": "component", "testingType": "component",
"skipServe": true, "skipServe": true,
"devServerTarget": "testing-input-output:build" "devServerTarget": "test-input-output:build"
} }
} }
}, },

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,7 +1,7 @@
{ {
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "../../dist/out-tsc", "outDir": "../../../dist/out-tsc",
"types": [] "types": []
}, },
"files": ["src/main.ts"], "files": ["src/main.ts"],

View File

@@ -25,7 +25,7 @@
"path": "./cypress/tsconfig.json" "path": "./cypress/tsconfig.json"
} }
], ],
"extends": "../../tsconfig.base.json", "extends": "../../../tsconfig.base.json",
"angularCompilerOptions": { "angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false, "enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true, "strictInjectionParameters": true,

View File

@@ -1,7 +1,7 @@
{ {
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "../../dist/out-tsc", "outDir": "../../../dist/out-tsc",
"module": "commonjs", "module": "commonjs",
"types": ["jest", "node", "@testing-library/jest-dom"] "types": ["jest", "node", "@testing-library/jest-dom"]
}, },

View File

@@ -1,13 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>testing-input-output Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>

View File

@@ -3,7 +3,7 @@ title: 🟠 Input Output
description: Challenge 19 is about testing inputs and ouputs description: Challenge 19 is about testing inputs and ouputs
author: Thomas Laforge author: Thomas Laforge
challengeNumber: 19 challengeNumber: 19
command: testing-input-output command: test-input-output
sidebar: sidebar:
order: 110 order: 110
--- ---
@@ -12,11 +12,11 @@ sidebar:
We have a small counter application that increments or decrements a number. The `CounterComponent` takes an initial value as an `@Input` and emits the result of the counter as an `@Output` when we click on the **Send** button. Since we are testing our component as a black box, we only have access to our inputs and listen to the output values. <b>We should not rely on any internal implementation details!!!</b> We have a small counter application that increments or decrements a number. The `CounterComponent` takes an initial value as an `@Input` and emits the result of the counter as an `@Output` when we click on the **Send** button. Since we are testing our component as a black box, we only have access to our inputs and listen to the output values. <b>We should not rely on any internal implementation details!!!</b>
You can play with it by running : `npx nx serve testing-input-output`. You can play with it by running : `npx nx serve test-input-output`.
The file named `counter.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test testing-input-output`. You can also install [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) to execute your test by clicking on the `Run` button above each `describe` or `it` blocks. The file named `counter.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test test-input-output`. You can also install [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) to execute your test by clicking on the `Run` button above each `describe` or `it` blocks.
For testing cypress, you will execute your test inside the `child.component.cy.ts` and run `npx nx component-test testing-input-output` to execute your test suits. You can add the `--watch` flag to execute your test in watch mode. For testing cypress, you will execute your test inside the `child.component.cy.ts` and run `npx nx component-test test-input-output` to execute your test suits. You can add the `--watch` flag to execute your test in watch mode.
# Statement # Statement