test(ivy): ngcc - test compiling the Angular Material library (#26403)

* rename test helper script
* add material to the ngcc integration test
* add MatButton to ngcc integration test checks
* remove platform-server from ngcc integration test
  This package does not yet compile as it contains a package-private
  (internal) decorated class, which the ngcc compiler does not yet
  handle.

PR Close #26403
This commit is contained in:
Pete Bacon Darwin 2018-10-15 11:02:38 +01:00 committed by Kara Erickson
parent 030d43b9f3
commit 603e7935aa
4 changed files with 17 additions and 5 deletions

View File

@ -1,5 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
##### Test Debug Utility #####
##############################
# Use this script to run the ngcc integration test locally
# in isolation from the other integration tests.
# This is useful when debugging the ngcc code-base.
set -u -e -o pipefail set -u -e -o pipefail
cd "$(dirname "$0")" cd "$(dirname "$0")"

View File

@ -4,15 +4,16 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@angular/animations": "file:../../dist/packages-dist/animations", "@angular/animations": "file:../../dist/packages-dist/animations",
"@angular/cdk": "^7.0.0-rc.1",
"@angular/common": "file:../../dist/packages-dist/common", "@angular/common": "file:../../dist/packages-dist/common",
"@angular/compiler": "file:../../dist/packages-dist/compiler", "@angular/compiler": "file:../../dist/packages-dist/compiler",
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli", "@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
"@angular/core": "file:../../dist/packages-dist/core", "@angular/core": "file:../../dist/packages-dist/core",
"@angular/forms": "file:../../dist/packages-dist/forms", "@angular/forms": "file:../../dist/packages-dist/forms",
"@angular/http": "file:../../dist/packages-dist/http", "@angular/http": "file:../../dist/packages-dist/http",
"@angular/material": "7.0.0-rc.1",
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser", "@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic", "@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
"@angular/router": "file:../../dist/packages-dist/router", "@angular/router": "file:../../dist/packages-dist/router",
"@types/node": "^9.4.0", "@types/node": "^9.4.0",
"rxjs": "file:../../node_modules/rxjs", "rxjs": "file:../../node_modules/rxjs",

View File

@ -1,9 +1,11 @@
import {Component, NgModule, ɵrenderComponent as renderComponent} from '@angular/core'; import {Component, NgModule, ɵrenderComponent as renderComponent} from '@angular/core';
import {CommonModule} from '@angular/common'; import {CommonModule} from '@angular/common';
import {MatButtonModule} from '@angular/material/button';
@Component({ @Component({
selector: 'hello-world', selector: 'hello-world',
template: ` template: `
<button (click)="visible = true">See Message</button> <button mat-button (click)="visible = true">See Message</button>
<h2 *ngIf="visible">Hello World</h2> <h2 *ngIf="visible">Hello World</h2>
`, `,
}) })
@ -13,7 +15,7 @@ class HelloWorld {
@NgModule({ @NgModule({
declarations: [HelloWorld], declarations: [HelloWorld],
imports: [CommonModule], imports: [CommonModule, MatButtonModule],
}) })
class Module {} class Module {}

View File

@ -39,6 +39,8 @@ ivy-ngcc
# Now try compiling the app using the ngcc compiled libraries # Now try compiling the app using the ngcc compiled libraries
ngc -p tsconfig-app.json ngc -p tsconfig-app.json
# Did it compile the main.ts correctly? # Did it compile the main.ts correctly (including the ngIf and MatButton directives)?
grep "directives: \[\S*\.NgIf\]" dist/src/main.js grep "directives: \[.*\.NgIf.*\]" dist/src/main.js
if [[ $? != 0 ]]; then exit 1; fi
grep "directives: \[.*\.MatButton.*\]" dist/src/main.js
if [[ $? != 0 ]]; then exit 1; fi if [[ $? != 0 ]]; then exit 1; fi