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
##### 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
cd "$(dirname "$0")"

View File

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

View File

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

View File

@ -39,6 +39,8 @@ ivy-ngcc
# Now try compiling the app using the ngcc compiled libraries
ngc -p tsconfig-app.json
# Did it compile the main.ts correctly?
grep "directives: \[\S*\.NgIf\]" dist/src/main.js
# Did it compile the main.ts correctly (including the ngIf and MatButton directives)?
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