mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 17:42:15 +08:00
test(angular): add support for multi-version testing (#25665)
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
name: 'Test Angular E2E'
|
||||
description: 'Test Angular E2E'
|
||||
inputs:
|
||||
app:
|
||||
description: 'The specific test application'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
@ -29,15 +32,19 @@ runs:
|
||||
name: ionic-angular-server
|
||||
path: ./packages/angular-server
|
||||
filename: AngularServerBuild.zip
|
||||
- name: Create Test App
|
||||
run: ./build.sh ${{ inputs.app }}
|
||||
shell: bash
|
||||
working-directory: ./angular/test
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
shell: bash
|
||||
working-directory: ./angular/test/test-app
|
||||
working-directory: ./angular/test/build/${{ inputs.app }}
|
||||
- name: Sync Built Changes
|
||||
run: npm run sync
|
||||
shell: bash
|
||||
working-directory: ./angular/test/test-app
|
||||
working-directory: ./angular/test/build/${{ inputs.app }}
|
||||
- name: Run Tests
|
||||
run: npm run test
|
||||
shell: bash
|
||||
working-directory: ./angular/test/test-app
|
||||
working-directory: ./angular/test/build/${{ inputs.app }}
|
||||
|
15
.github/workflows/build.yml
vendored
15
.github/workflows/build.yml
vendored
@ -127,11 +127,26 @@ jobs:
|
||||
- uses: ./.github/workflows/actions/build-angular-server
|
||||
|
||||
test-angular-e2e:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
apps: [ng12, ng13, ng14]
|
||||
needs: [build-angular, build-angular-server]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ./.github/workflows/actions/test-angular-e2e
|
||||
with:
|
||||
app: ${{ matrix.apps }}
|
||||
|
||||
verify-test-angular-e2e:
|
||||
if: ${{ always() }}
|
||||
needs: test-angular-e2e
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check build matrix status
|
||||
if: ${{ needs.test-angular-e2e.result != 'success' }}
|
||||
run: exit 1
|
||||
|
||||
build-react:
|
||||
needs: [build-core]
|
||||
|
8
.gitignore
vendored
8
.gitignore
vendored
@ -22,7 +22,6 @@ temp/
|
||||
core/theme-builder/
|
||||
core/test-components/
|
||||
core/css/
|
||||
angular/css/
|
||||
$RECYCLE.BIN/
|
||||
|
||||
.DS_Store
|
||||
@ -56,7 +55,6 @@ prerender-hydrated.html
|
||||
prerender-static.html
|
||||
|
||||
# stencil
|
||||
angular/css/
|
||||
packages/react/css/
|
||||
packages/vue/css/
|
||||
core/components/
|
||||
@ -65,11 +63,15 @@ core/hydrate/
|
||||
core/loader/
|
||||
core/www/
|
||||
.stencil/
|
||||
angular/build/
|
||||
|
||||
# playwright
|
||||
core/test-results/
|
||||
core/playwright-report/
|
||||
core/**/*-snapshots
|
||||
|
||||
# angular
|
||||
angular/css/
|
||||
angular/test/build/
|
||||
.angular/
|
||||
|
||||
.npmrc
|
||||
|
69
angular/test/README.md
Normal file
69
angular/test/README.md
Normal file
@ -0,0 +1,69 @@
|
||||
# Angular E2E Test Apps
|
||||
|
||||
Ionic Framework supports multiple versions of Angular. As a result, we need to verify that Ionic works correctly with each of these Angular versions.
|
||||
|
||||
## Test App Build Structure
|
||||
|
||||
Unlike other test applications, these test apps are broken up into multiple directories. These directories are then combined to create a single application. This allows us to share common application code, tests, etc so that each app is being tested the same way. Below details the different pieces that help create a single test application.
|
||||
|
||||
**apps** - This directory contains partial applications for each version of Angular we want to test. Typically these directories contain new `package.json` files, `angular.json` files, and more. If you have code that is specific to a particular version of Angular, put it in this directory.
|
||||
|
||||
**base** - This directory contains the base application that each test app will use. This is where tests, application logic, and more live. If you have code that needs to be run on every test app, put it in this directory.
|
||||
|
||||
**build** - When the `apps` and `base` directories are merged, the final result is put in this directory. The `build` directory should never be committed to git.
|
||||
|
||||
**build.sh** - This is the script that merges the `apps` and `base` directories and places the built application in the `build` directory.
|
||||
|
||||
Usage:
|
||||
|
||||
```shell
|
||||
# Build a test app using apps/ng14 as a reference
|
||||
./build.sh ng14
|
||||
```
|
||||
|
||||
## How to modify test apps
|
||||
|
||||
To add new tests, components, or pages, modify the `base` project. This ensures that tests are run for every tested version.
|
||||
|
||||
If you want to add a version-specific change, add the change inside of the appropriate projects in `apps`. Be sure to replicate the directory structure. For example, if you are adding a new E2E test file called `test.spec.ts` in `apps/ng14`, make sure you place the file in `apps/ng14/e2e/src/test.spec.ts`.
|
||||
|
||||
### Version-specific tests
|
||||
|
||||
If you need to add E2E tests that are only run on a specific version of the JS Framework, replicate the `VersionTest` component on each partial application. This ensures that tests for framework version X do not get run for framework version Y.
|
||||
|
||||
## Adding New Test Apps
|
||||
|
||||
As we add support for new versions of Angular, we will also need to update this directory to test against new applications. The following steps can serve as a guide for adding new apps:
|
||||
|
||||
1. Navigate to the built app for the most recent version of Angular that Ionic tests.
|
||||
2. Update the application by following the steps on https://update.angular.io/.
|
||||
3. Make note of any files that changed during the upgrade (`package.json`, `package-lock.json`, `angular.json`, etc).
|
||||
4. Copy the changed files to a new directory in `apps`.
|
||||
5. Add a new entry to the matrix for `test-core-angular` in `./github/workflows/build.yml`. This will allow the new test app to run against all PRs.
|
||||
6. Commit these changes and push.
|
||||
|
||||
Example:
|
||||
|
||||
In this example, we are going to add the Angular 14 test app.
|
||||
|
||||
1. Build the Angular 13 test app using `./build.sh ng13`.
|
||||
2. Navigate to `build/ng13`.
|
||||
3. Perform the upgrade steps on https://update.angular.io/. The "From" field should say "13.0" and the "To" field should say "14.0".
|
||||
|
||||
Note: You may encounter some other peer dependency issues not covered by the Angular Upgrade Guide. These peer dependency issues can be resolved manually by updating the installed version of each dependency.
|
||||
|
||||
4. Observe that the output of the Angular upgrade indicates that the following files were modified:
|
||||
|
||||
`angular.json`
|
||||
`package-lock.json`
|
||||
`package.json`
|
||||
`tsconfig.json`
|
||||
`src/app/form/form.component.ts`
|
||||
`src/app/modal-example/modal-example.component.ts`
|
||||
|
||||
5. Create a directory in `apps` named `ng14`.
|
||||
6. Copy the modified files to the `apps/ng14` directory.
|
||||
7. Open `./github/workflows/build.yml` and find the `test-angular-e2e` job.
|
||||
8. Find the `apps` field under `matrix`.
|
||||
9. Add "ng14" to the `apps` field.
|
||||
10. Committ these changes and push.
|
34797
angular/test/apps/ng12/package-lock.json
generated
Normal file
34797
angular/test/apps/ng12/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
68
angular/test/apps/ng12/package.json
Normal file
68
angular/test/apps/ng12/package.json
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"name": "ionic-angular-test-app",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"sync:build": "sh scripts/build-ionic.sh",
|
||||
"sync": "sh scripts/sync.sh",
|
||||
"build": "ng build --configuration production --no-progress",
|
||||
"lint": "ng lint",
|
||||
"postinstall": "ngcc",
|
||||
"serve:ssr": "node dist/test-app/server/main.js",
|
||||
"build:ssr": "ng build --prod && ng run test-app:server:production",
|
||||
"dev:ssr": "ng run test-app:serve-ssr",
|
||||
"prerender": "ng run test-app:prerender",
|
||||
"cy.open": "cypress open",
|
||||
"cy.run": "cypress run",
|
||||
"test": "concurrently \"npm run start -- --configuration production\" \"wait-on http-get://localhost:4200 && npm run cy.run\" --kill-others --success first",
|
||||
"test.watch": "concurrently \"npm run start\" \"wait-on http-get://localhost:4200 && npm run cy.open\" --kill-others --success first"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular/animations": "^12.2.16",
|
||||
"@angular/common": "^12.2.16",
|
||||
"@angular/compiler": "^12.2.16",
|
||||
"@angular/core": "^12.2.16",
|
||||
"@angular/forms": "^12.2.16",
|
||||
"@angular/platform-browser": "^12.2.16",
|
||||
"@angular/platform-browser-dynamic": "^12.2.16",
|
||||
"@angular/platform-server": "^12.2.16",
|
||||
"@angular/router": "^12.2.16",
|
||||
"@ionic/angular": "^6.1.15",
|
||||
"@ionic/angular-server": "^6.1.15",
|
||||
"@nguniversal/express-engine": "^12.1.3",
|
||||
"angular-in-memory-web-api": "^0.11.0",
|
||||
"core-js": "^2.6.11",
|
||||
"express": "^4.15.2",
|
||||
"rxjs": "^6.5.5",
|
||||
"tslib": "^2.0.0",
|
||||
"typescript-eslint-language-service": "^4.1.5",
|
||||
"zone.js": "^0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^12.2.18",
|
||||
"@angular-eslint/builder": "^12.7.0",
|
||||
"@angular-eslint/eslint-plugin": "^12.7.0",
|
||||
"@angular-eslint/eslint-plugin-template": "^12.7.0",
|
||||
"@angular-eslint/schematics": "^12.7.0",
|
||||
"@angular-eslint/template-parser": "^12.7.0",
|
||||
"@angular/cli": "^12.2.16",
|
||||
"@angular/compiler-cli": "^12.2.16",
|
||||
"@angular/language-service": "^12.2.16",
|
||||
"@nguniversal/builders": "^12.1.3",
|
||||
"@types/express": "^4.17.7",
|
||||
"@types/node": "^12.12.54",
|
||||
"@typescript-eslint/eslint-plugin": "4.28.2",
|
||||
"@typescript-eslint/parser": "4.28.2",
|
||||
"concurrently": "^6.0.0",
|
||||
"cypress": "^10.2.0",
|
||||
"eslint": "^7.26.0",
|
||||
"ts-loader": "^6.2.2",
|
||||
"ts-node": "^8.3.0",
|
||||
"typescript": "~4.3.5",
|
||||
"wait-on": "^5.2.1",
|
||||
"webpack": "^5.61.0",
|
||||
"webpack-cli": "^4.9.2"
|
||||
}
|
||||
}
|
@ -18,8 +18,8 @@
|
||||
"@angular/platform-browser-dynamic": "^13.1.3",
|
||||
"@angular/platform-server": "^13.1.3",
|
||||
"@angular/router": "^13.1.3",
|
||||
"@ionic/angular": "^6.0.12",
|
||||
"@ionic/angular-server": "^6.0.12",
|
||||
"@ionic/angular": "^6.1.15",
|
||||
"@ionic/angular-server": "^6.1.15",
|
||||
"@nguniversal/express-engine": "^13.1.1",
|
||||
"angular-in-memory-web-api": "^0.11.0",
|
||||
"core-js": "^2.6.11",
|
||||
@ -2690,11 +2690,11 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@ionic/angular": {
|
||||
"version": "6.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-6.1.9.tgz",
|
||||
"integrity": "sha512-TeuMZnDMTpmueOJNACQ52ERUlb0pgwl5EgdRzl1R5bl8d8qjkUCnXgn042xPVfsEjD2ZxPGDFfOuYGqeYIfYkQ==",
|
||||
"version": "6.1.15",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-6.1.15.tgz",
|
||||
"integrity": "sha512-1CY/MwlOMlUbyDwlTOYzsxGzugFrgY0QftyMQE99KeMC1z/a8ZazNYvSHGNUAetneO+hU9LIXtM/q14a9bC/Hw==",
|
||||
"dependencies": {
|
||||
"@ionic/core": "^6.1.9",
|
||||
"@ionic/core": "^6.1.15",
|
||||
"jsonc-parser": "^3.0.0",
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
@ -2707,9 +2707,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@ionic/angular-server": {
|
||||
"version": "6.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/angular-server/-/angular-server-6.1.9.tgz",
|
||||
"integrity": "sha512-9psF+OSDXnPH1fLJA+kcRlGea4U5v6MCKBbcHeCa1Hwf7B7/AyZtYcB7rC5HI3EkmlvV0GtIjzeJ508RHvMamw==",
|
||||
"version": "6.1.15",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/angular-server/-/angular-server-6.1.15.tgz",
|
||||
"integrity": "sha512-2ygmB54PTW2SnSqfpjnqVVtCTj1WE8qloUOcma1oK7tfJnJYrzgO5YKDqmlUJMaaquxZa6YvJaenHRj6b0G54w==",
|
||||
"dependencies": {
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
@ -2722,9 +2722,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@ionic/core": {
|
||||
"version": "6.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/core/-/core-6.1.9.tgz",
|
||||
"integrity": "sha512-EaClsiGB/E9wPkujnrMZ71BLVcA8t6DBZu+caJMmqPLF/64S37CiyfrrMbL1UnxDWP2TXsPFH3seWl6Ek/W1bw==",
|
||||
"version": "6.1.15",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/core/-/core-6.1.15.tgz",
|
||||
"integrity": "sha512-NvBlHR7O4kfp9KYz6oLsghFzGZImA7hM4qS4tFRUI62R+Q5iCJEY4OmXE5bif5K+SQkMhQY+x1l2Nq20waLzLg==",
|
||||
"dependencies": {
|
||||
"@stencil/core": "^2.16.0",
|
||||
"ionicons": "^6.0.2",
|
||||
@ -3423,9 +3423,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@stencil/core": {
|
||||
"version": "2.16.1",
|
||||
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-2.16.1.tgz",
|
||||
"integrity": "sha512-s/UJp9qxExL3DyQPT70kiuWeb3AdjbUZM+5lEIXn30I2DLcLYPOPXfsoWJODieQywq+3vPiLZeIdkoqjf6jcSw==",
|
||||
"version": "2.17.1",
|
||||
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-2.17.1.tgz",
|
||||
"integrity": "sha512-ErjQsNALgZQ9SYeBHhqwL1UO+Zbptwl3kwrRJC2tGlc3G/T6UvPuaKr+PGsqI+CZGia+0+R5EELQvFu74mYeIg==",
|
||||
"bin": {
|
||||
"stencil": "bin/stencil"
|
||||
},
|
||||
@ -9851,6 +9851,18 @@
|
||||
"@stencil/core": "~2.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ionicons/node_modules/@stencil/core": {
|
||||
"version": "2.16.1",
|
||||
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-2.16.1.tgz",
|
||||
"integrity": "sha512-s/UJp9qxExL3DyQPT70kiuWeb3AdjbUZM+5lEIXn30I2DLcLYPOPXfsoWJODieQywq+3vPiLZeIdkoqjf6jcSw==",
|
||||
"bin": {
|
||||
"stencil": "bin/stencil"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.10.0",
|
||||
"npm": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ip": {
|
||||
"version": "1.1.8",
|
||||
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz",
|
||||
@ -18207,27 +18219,27 @@
|
||||
"dev": true
|
||||
},
|
||||
"@ionic/angular": {
|
||||
"version": "6.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-6.1.9.tgz",
|
||||
"integrity": "sha512-TeuMZnDMTpmueOJNACQ52ERUlb0pgwl5EgdRzl1R5bl8d8qjkUCnXgn042xPVfsEjD2ZxPGDFfOuYGqeYIfYkQ==",
|
||||
"version": "6.1.15",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-6.1.15.tgz",
|
||||
"integrity": "sha512-1CY/MwlOMlUbyDwlTOYzsxGzugFrgY0QftyMQE99KeMC1z/a8ZazNYvSHGNUAetneO+hU9LIXtM/q14a9bC/Hw==",
|
||||
"requires": {
|
||||
"@ionic/core": "^6.1.9",
|
||||
"@ionic/core": "^6.1.15",
|
||||
"jsonc-parser": "^3.0.0",
|
||||
"tslib": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"@ionic/angular-server": {
|
||||
"version": "6.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/angular-server/-/angular-server-6.1.9.tgz",
|
||||
"integrity": "sha512-9psF+OSDXnPH1fLJA+kcRlGea4U5v6MCKBbcHeCa1Hwf7B7/AyZtYcB7rC5HI3EkmlvV0GtIjzeJ508RHvMamw==",
|
||||
"version": "6.1.15",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/angular-server/-/angular-server-6.1.15.tgz",
|
||||
"integrity": "sha512-2ygmB54PTW2SnSqfpjnqVVtCTj1WE8qloUOcma1oK7tfJnJYrzgO5YKDqmlUJMaaquxZa6YvJaenHRj6b0G54w==",
|
||||
"requires": {
|
||||
"tslib": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"@ionic/core": {
|
||||
"version": "6.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/core/-/core-6.1.9.tgz",
|
||||
"integrity": "sha512-EaClsiGB/E9wPkujnrMZ71BLVcA8t6DBZu+caJMmqPLF/64S37CiyfrrMbL1UnxDWP2TXsPFH3seWl6Ek/W1bw==",
|
||||
"version": "6.1.15",
|
||||
"resolved": "https://registry.npmjs.org/@ionic/core/-/core-6.1.15.tgz",
|
||||
"integrity": "sha512-NvBlHR7O4kfp9KYz6oLsghFzGZImA7hM4qS4tFRUI62R+Q5iCJEY4OmXE5bif5K+SQkMhQY+x1l2Nq20waLzLg==",
|
||||
"requires": {
|
||||
"@stencil/core": "^2.16.0",
|
||||
"ionicons": "^6.0.2",
|
||||
@ -18760,9 +18772,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@stencil/core": {
|
||||
"version": "2.16.1",
|
||||
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-2.16.1.tgz",
|
||||
"integrity": "sha512-s/UJp9qxExL3DyQPT70kiuWeb3AdjbUZM+5lEIXn30I2DLcLYPOPXfsoWJODieQywq+3vPiLZeIdkoqjf6jcSw=="
|
||||
"version": "2.17.1",
|
||||
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-2.17.1.tgz",
|
||||
"integrity": "sha512-ErjQsNALgZQ9SYeBHhqwL1UO+Zbptwl3kwrRJC2tGlc3G/T6UvPuaKr+PGsqI+CZGia+0+R5EELQvFu74mYeIg=="
|
||||
},
|
||||
"@tootallnate/once": {
|
||||
"version": "2.0.0",
|
||||
@ -23492,6 +23504,13 @@
|
||||
"integrity": "sha512-AyKfFaUKVoBz4eB8XkU7H1R5HFnVsgq5ijqSdbXC0lES9PDK/J6LUQz6XUJq0mVVQF5k9kczSPOLMW3mszG0mQ==",
|
||||
"requires": {
|
||||
"@stencil/core": "~2.16.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@stencil/core": {
|
||||
"version": "2.16.1",
|
||||
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-2.16.1.tgz",
|
||||
"integrity": "sha512-s/UJp9qxExL3DyQPT70kiuWeb3AdjbUZM+5lEIXn30I2DLcLYPOPXfsoWJODieQywq+3vPiLZeIdkoqjf6jcSw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"ip": {
|
@ -29,8 +29,8 @@
|
||||
"@angular/platform-browser-dynamic": "^13.1.3",
|
||||
"@angular/platform-server": "^13.1.3",
|
||||
"@angular/router": "^13.1.3",
|
||||
"@ionic/angular": "^6.0.12",
|
||||
"@ionic/angular-server": "^6.0.12",
|
||||
"@ionic/angular": "^6.1.15",
|
||||
"@ionic/angular-server": "^6.1.15",
|
||||
"@nguniversal/express-engine": "^13.1.1",
|
||||
"angular-in-memory-web-api": "^0.11.0",
|
||||
"core-js": "^2.6.11",
|
53
angular/test/apps/ng13/src/app/form/form.component.ts
Normal file
53
angular/test/apps/ng13/src/app/form/form.component.ts
Normal file
@ -0,0 +1,53 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-form',
|
||||
templateUrl: './form.component.html',
|
||||
})
|
||||
export class FormComponent {
|
||||
|
||||
submitted = 'false';
|
||||
profileForm: FormGroup;
|
||||
outsideToggle = new FormControl(true);
|
||||
|
||||
constructor(fb: FormBuilder) {
|
||||
this.profileForm = fb.group({
|
||||
datetime: ['2010-08-20', Validators.required],
|
||||
select: [undefined, Validators.required],
|
||||
toggle: [false],
|
||||
input: ['', Validators.required],
|
||||
input2: ['Default Value'],
|
||||
checkbox: [false],
|
||||
range: [5, Validators.min(10)],
|
||||
}, {
|
||||
updateOn: typeof (window as any) !== 'undefined' && window.location.hash === '#blur' ? 'blur' : 'change'
|
||||
});
|
||||
}
|
||||
|
||||
setTouched() {
|
||||
const formControl = this.profileForm.get('input');
|
||||
formControl.markAsTouched();
|
||||
}
|
||||
|
||||
onSubmit(_ev) {
|
||||
this.submitted = 'true';
|
||||
}
|
||||
|
||||
setValues() {
|
||||
this.profileForm.patchValue({
|
||||
datetime: '2010-08-20',
|
||||
select: 'nes',
|
||||
toggle: true,
|
||||
input: 'Some value',
|
||||
input2: 'Another values',
|
||||
checkbox: true,
|
||||
range: 50
|
||||
});
|
||||
}
|
||||
|
||||
markAllAsTouched() {
|
||||
this.profileForm.markAllAsTouched();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
import { Component, Input, NgZone, OnInit, Optional } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { ModalController, NavParams, IonNav, ViewWillLeave, ViewDidEnter, ViewDidLeave } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-modal-example',
|
||||
templateUrl: './modal-example.component.html',
|
||||
})
|
||||
export class ModalExampleComponent implements OnInit, ViewWillLeave, ViewDidEnter, ViewWillLeave, ViewDidLeave {
|
||||
|
||||
@Input() value: string;
|
||||
|
||||
form = new FormGroup({
|
||||
select: new FormControl([])
|
||||
});
|
||||
|
||||
valueFromParams: string;
|
||||
onInit = 0;
|
||||
willEnter = 0;
|
||||
didEnter = 0;
|
||||
willLeave = 0;
|
||||
didLeave = 0;
|
||||
|
||||
modal: HTMLElement;
|
||||
|
||||
constructor(
|
||||
private modalCtrl: ModalController,
|
||||
@Optional() public nav: IonNav,
|
||||
navParams: NavParams
|
||||
) {
|
||||
this.valueFromParams = navParams.get('prop');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
NgZone.assertInAngularZone();
|
||||
this.onInit++;
|
||||
}
|
||||
|
||||
ionViewWillEnter() {
|
||||
if (this.onInit !== 1) {
|
||||
throw new Error('ngOnInit was not called');
|
||||
}
|
||||
NgZone.assertInAngularZone();
|
||||
this.willEnter++;
|
||||
}
|
||||
ionViewDidEnter() {
|
||||
NgZone.assertInAngularZone();
|
||||
this.didEnter++;
|
||||
}
|
||||
ionViewWillLeave() {
|
||||
NgZone.assertInAngularZone();
|
||||
this.willLeave++;
|
||||
}
|
||||
ionViewDidLeave() {
|
||||
NgZone.assertInAngularZone();
|
||||
this.didLeave++;
|
||||
}
|
||||
closeModal() {
|
||||
this.modalCtrl.dismiss();
|
||||
}
|
||||
|
||||
push() {
|
||||
this.nav.push(ModalExampleComponent, {
|
||||
'value': 'pushed!'
|
||||
});
|
||||
}
|
||||
pop() {
|
||||
this.nav.pop();
|
||||
}
|
||||
}
|
26
angular/test/apps/ng13/tsconfig.json
Normal file
26
angular/test/apps/ng13/tsconfig.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"importHelpers": true,
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"module": "es2020",
|
||||
"target": "es2015",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"lib": [
|
||||
"es2018",
|
||||
"dom"
|
||||
],
|
||||
"plugins": [
|
||||
{
|
||||
"name": "typescript-eslint-language-service"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
28316
angular/test/apps/ng14/package-lock.json
generated
Normal file
28316
angular/test/apps/ng14/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
68
angular/test/apps/ng14/package.json
Normal file
68
angular/test/apps/ng14/package.json
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"name": "ionic-angular-test-app",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"sync:build": "sh scripts/build-ionic.sh",
|
||||
"sync": "sh scripts/sync.sh",
|
||||
"build": "ng build --configuration production --no-progress",
|
||||
"lint": "ng lint",
|
||||
"postinstall": "ngcc",
|
||||
"serve:ssr": "node dist/test-app/server/main.js",
|
||||
"build:ssr": "ng build --prod && ng run test-app:server:production",
|
||||
"dev:ssr": "ng run test-app:serve-ssr",
|
||||
"prerender": "ng run test-app:prerender",
|
||||
"cy.open": "cypress open",
|
||||
"cy.run": "cypress run",
|
||||
"test": "concurrently \"npm run start -- --configuration production\" \"wait-on http-get://localhost:4200 && npm run cy.run\" --kill-others --success first",
|
||||
"test.watch": "concurrently \"npm run start\" \"wait-on http-get://localhost:4200 && npm run cy.open\" --kill-others --success first"
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular/animations": "^14.1.0",
|
||||
"@angular/common": "^14.1.0",
|
||||
"@angular/compiler": "^14.1.0",
|
||||
"@angular/core": "^14.1.0",
|
||||
"@angular/forms": "^14.1.0",
|
||||
"@angular/platform-browser": "^14.1.0",
|
||||
"@angular/platform-browser-dynamic": "^14.1.0",
|
||||
"@angular/platform-server": "^14.1.0",
|
||||
"@angular/router": "^14.1.0",
|
||||
"@ionic/angular": "^6.1.15",
|
||||
"@ionic/angular-server": "^6.1.15",
|
||||
"@nguniversal/express-engine": "^14.0.3",
|
||||
"angular-in-memory-web-api": "^0.11.0",
|
||||
"core-js": "^2.6.11",
|
||||
"express": "^4.15.2",
|
||||
"rxjs": "^6.5.5",
|
||||
"tslib": "^2.0.0",
|
||||
"typescript-eslint-language-service": "^4.1.5",
|
||||
"zone.js": "^0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^14.1.0",
|
||||
"@angular-eslint/builder": "^14.0.2",
|
||||
"@angular-eslint/eslint-plugin": "^14.0.2",
|
||||
"@angular-eslint/eslint-plugin-template": "^14.0.2",
|
||||
"@angular-eslint/schematics": "^14.0.2",
|
||||
"@angular-eslint/template-parser": "^14.0.2",
|
||||
"@angular/cli": "^14.1.0",
|
||||
"@angular/compiler-cli": "^14.1.0",
|
||||
"@angular/language-service": "^14.1.0",
|
||||
"@nguniversal/builders": "^14.0.3",
|
||||
"@types/express": "^4.17.7",
|
||||
"@types/node": "^12.12.54",
|
||||
"@typescript-eslint/eslint-plugin": "4.28.2",
|
||||
"@typescript-eslint/parser": "4.28.2",
|
||||
"concurrently": "^6.0.0",
|
||||
"cypress": "^10.2.0",
|
||||
"eslint": "^7.26.0",
|
||||
"ts-loader": "^6.2.2",
|
||||
"ts-node": "^8.3.0",
|
||||
"typescript": "~4.6.0",
|
||||
"wait-on": "^5.2.1",
|
||||
"webpack": "^5.61.0",
|
||||
"webpack-cli": "^4.9.2"
|
||||
}
|
||||
}
|
26
angular/test/apps/ng14/tsconfig.json
Normal file
26
angular/test/apps/ng14/tsconfig.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"importHelpers": true,
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"module": "es2020",
|
||||
"target": "es2020",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"lib": [
|
||||
"es2018",
|
||||
"dom"
|
||||
],
|
||||
"plugins": [
|
||||
{
|
||||
"name": "typescript-eslint-language-service"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -140,8 +140,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "test-app",
|
||||
"cli": {
|
||||
"defaultCollection": "@angular-eslint/schematics"
|
||||
"schematicCollections": [
|
||||
"@angular-eslint/schematics"
|
||||
]
|
||||
}
|
||||
}
|
20
angular/test/base/scripts/sync.sh
Normal file
20
angular/test/base/scripts/sync.sh
Normal file
@ -0,0 +1,20 @@
|
||||
# Copy angular dist
|
||||
rm -rf node_modules/@ionic/angular
|
||||
cp -a ../../../dist node_modules/@ionic/angular
|
||||
|
||||
# Copy angular server
|
||||
rm -rf node_modules/@ionic/angular-server
|
||||
cp -a ../../../../packages/angular-server/dist node_modules/@ionic/angular-server
|
||||
|
||||
# # Copy core dist
|
||||
rm -rf node_modules/@ionic/core
|
||||
mkdir node_modules/@ionic/core
|
||||
cp -a ../../../../core/css node_modules/@ionic/core/css
|
||||
cp -a ../../../../core/dist node_modules/@ionic/core/dist
|
||||
cp -a ../../../../core/hydrate node_modules/@ionic/core/hydrate
|
||||
cp -a ../../../../core/loader node_modules/@ionic/core/loader
|
||||
cp -a ../../../../core/package.json node_modules/@ionic/core/package.json
|
||||
|
||||
# # Copy ionicons
|
||||
rm -rf node_modules/ionicons
|
||||
cp -a ../../../../core/node_modules/ionicons node_modules/ionicons
|
@ -24,6 +24,7 @@ import { AccordionComponent } from './accordion/accordion.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: HomePageComponent },
|
||||
{ path: 'version-test', loadChildren: () => import('./version-test').then(m => m.VersionTestModule) },
|
||||
{ path: 'accordions', component: AccordionComponent },
|
||||
{ path: 'alerts', component: AlertComponent },
|
||||
{ path: 'inputs', component: InputsComponent },
|
53
angular/test/base/src/app/form/form.component.ts
Normal file
53
angular/test/base/src/app/form/form.component.ts
Normal file
@ -0,0 +1,53 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, UntypedFormControl } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-form',
|
||||
templateUrl: './form.component.html',
|
||||
})
|
||||
export class FormComponent {
|
||||
|
||||
submitted = 'false';
|
||||
profileForm: UntypedFormGroup;
|
||||
outsideToggle = new UntypedFormControl(true);
|
||||
|
||||
constructor(fb: UntypedFormBuilder) {
|
||||
this.profileForm = fb.group({
|
||||
datetime: ['2010-08-20', Validators.required],
|
||||
select: [undefined, Validators.required],
|
||||
toggle: [false],
|
||||
input: ['', Validators.required],
|
||||
input2: ['Default Value'],
|
||||
checkbox: [false],
|
||||
range: [5, Validators.min(10)],
|
||||
}, {
|
||||
updateOn: typeof (window as any) !== 'undefined' && window.location.hash === '#blur' ? 'blur' : 'change'
|
||||
});
|
||||
}
|
||||
|
||||
setTouched() {
|
||||
const formControl = this.profileForm.get('input');
|
||||
formControl.markAsTouched();
|
||||
}
|
||||
|
||||
onSubmit(_ev) {
|
||||
this.submitted = 'true';
|
||||
}
|
||||
|
||||
setValues() {
|
||||
this.profileForm.patchValue({
|
||||
datetime: '2010-08-20',
|
||||
select: 'nes',
|
||||
toggle: true,
|
||||
input: 'Some value',
|
||||
input2: 'Another values',
|
||||
checkbox: true,
|
||||
range: 50
|
||||
});
|
||||
}
|
||||
|
||||
markAllAsTouched() {
|
||||
this.profileForm.markAllAsTouched();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
import { Component, Input, NgZone, OnInit, Optional } from '@angular/core';
|
||||
import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { ModalController, NavParams, IonNav, ViewWillLeave, ViewDidEnter, ViewDidLeave } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-modal-example',
|
||||
templateUrl: './modal-example.component.html',
|
||||
})
|
||||
export class ModalExampleComponent implements OnInit, ViewWillLeave, ViewDidEnter, ViewWillLeave, ViewDidLeave {
|
||||
|
||||
@Input() value: string;
|
||||
|
||||
form = new UntypedFormGroup({
|
||||
select: new UntypedFormControl([])
|
||||
});
|
||||
|
||||
valueFromParams: string;
|
||||
onInit = 0;
|
||||
willEnter = 0;
|
||||
didEnter = 0;
|
||||
willLeave = 0;
|
||||
didLeave = 0;
|
||||
|
||||
modal: HTMLElement;
|
||||
|
||||
constructor(
|
||||
private modalCtrl: ModalController,
|
||||
@Optional() public nav: IonNav,
|
||||
navParams: NavParams
|
||||
) {
|
||||
this.valueFromParams = navParams.get('prop');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
NgZone.assertInAngularZone();
|
||||
this.onInit++;
|
||||
}
|
||||
|
||||
ionViewWillEnter() {
|
||||
if (this.onInit !== 1) {
|
||||
throw new Error('ngOnInit was not called');
|
||||
}
|
||||
NgZone.assertInAngularZone();
|
||||
this.willEnter++;
|
||||
}
|
||||
ionViewDidEnter() {
|
||||
NgZone.assertInAngularZone();
|
||||
this.didEnter++;
|
||||
}
|
||||
ionViewWillLeave() {
|
||||
NgZone.assertInAngularZone();
|
||||
this.willLeave++;
|
||||
}
|
||||
ionViewDidLeave() {
|
||||
NgZone.assertInAngularZone();
|
||||
this.didLeave++;
|
||||
}
|
||||
closeModal() {
|
||||
this.modalCtrl.dismiss();
|
||||
}
|
||||
|
||||
push() {
|
||||
this.nav.push(ModalExampleComponent, {
|
||||
'value': 'pushed!'
|
||||
});
|
||||
}
|
||||
pop() {
|
||||
this.nav.pop();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user