feat(doc): move forms

This commit is contained in:
thomas
2023-10-17 23:08:41 +02:00
parent fcd125d001
commit 3bed1449f5
25 changed files with 42 additions and 43 deletions

View File

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

View File

@@ -8,13 +8,13 @@ NOT IMPLEMENTED YET
<!-- We have a small application that send a title to a fake backend that you type inside a input.
If the title is correctly typed, you can send the request otherwise you get a nice error and the request is not sent.
You can play with it by running : `npx nx serve testing-forms`.
You can play with it by running : `npx nx serve test-forms`.
The goal is to test this behavior with Testing library and Cypress
The file named `child.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test testing-forms`. 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 `child.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test test-forms`. 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-forms` 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-forms` to execute your test suits. You can add the `--watch` flag to execute your test in watch mode.
I created some `it` blocks but feel free to add more test if you like to. -->
@@ -23,9 +23,9 @@ I created some `it` blocks but feel free to add more test if you like to. -->
1. Fork the project
2. clone it
3. npm ci
4. `npx nx serve testing-forms` to play with the application
5. `npx nx test testing-forms` to test your application with Testing Library
6. `npx nx component-test testing-forms --watch` to test your application with Cypress
4. `npx nx serve test-forms` to play with the application
5. `npx nx test test-forms` to test your application with Testing Library
6. `npx nx component-test test-forms --watch` to test your application with Cypress
7. _...work on it_
8. Commit your work
9. Submit a PR with a title beginning with **Answer:20** that I will review and other dev can review.

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-forms Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>

View File

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

View File

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

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"outDir": "../../../dist/out-tsc",
"module": "commonjs",
"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-forms Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>