Skip to content

Setting the inlined templates in ng new breaks the tests #8005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
textbook opened this issue Oct 11, 2017 · 2 comments
Closed

Setting the inlined templates in ng new breaks the tests #8005

textbook opened this issue Oct 11, 2017 · 2 comments

Comments

@textbook
Copy link

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.4.5
node: 6.9.1
os: darwin x64
@angular/animations: 4.4.4
@angular/common: 4.4.4
@angular/compiler: 4.4.4
@angular/core: 4.4.4
@angular/forms: 4.4.4
@angular/http: 4.4.4
@angular/platform-browser: 4.4.4
@angular/platform-browser-dynamic: 4.4.4
@angular/router: 4.4.4
@angular/cli: 1.4.5
@angular/compiler-cli: 4.4.4
@angular/language-service: 4.4.4
typescript: 2.3.4

Repro steps.

$ ng new inlined --inline-template true
$ cd inlined/
$ ng test --no-watch

The log given by the failure.

AppComponent should render title in a h1 tag FAILED
	Failed: Cannot read property 'textContent' of null
	TypeError: Cannot read property 'textContent' of null
	    at Object.<anonymous> Users/jonrsharpe/WebstormProjects/inlined/src/app/app.component.spec.ts:25:40)
	    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke Users/jonrsharpe/WebstormProjects/inlined/node_modules/zone.js/dist/zone.js:392:1)
	    at AsyncTestZoneSpec.webpackJsonp.../../../../zone.js/dist/async-test.js.AsyncTestZoneSpec.onInvoke Users/jonrsharpe/WebstormProjects/inlined/node_modules/zone.js/dist/async-test.js:49:1)
	    at ProxyZoneSpec.webpackJsonp.../../../../zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke Users/jonrsharpe/WebstormProjects/inlined/node_modules/zone.js/dist/proxy.js:76:1)
	    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke Users/jonrsharpe/WebstormProjects/inlined/node_modules/zone.js/dist/zone.js:391:1)
	    at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runGuarded Users/jonrsharpe/WebstormProjects/inlined/node_modules/zone.js/dist/zone.js:155:1)
	    at runInTestZone Users/jonrsharpe/WebstormProjects/inlined/node_modules/@angular/core/@angular/core/testing.es5.js:106:1)
	    at Object.<anonymous> Users/jonrsharpe/WebstormProjects/inlined/node_modules/@angular/core/@angular/core/testing.es5.js:45:1)
	    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke Users/jonrsharpe/WebstormProjects/inlined/node_modules/zone.js/dist/zone.js:392:1)
	    at ProxyZoneSpec.webpackJsonp.../../../../zone.js/dist/proxy.js.ProxyZoneSpec.onInvoke Users/jonrsharpe/WebstormProjects/inlined/node_modules/zone.js/dist/proxy.js:79:1)
Executed 3 of 3 (1 FAILED)

Desired functionality.

Executed 3 of 3 SUCCESS

Mention any other details that might be useful.

The default template, when you aren't inlining it, contains:

  <h1>
    Welcome to {{title}}!
  </h1>

The inlined template is completely different, and therefore the tests fail:

@Component({
  selector: 'app-root',
  template: `
    <p>
      app Works!
    </p>
  `,
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'app';
}

Although the app.component.ts still contains the title property when you set --inline-template true, it isn't actually used. Note also that if you use --prefix to change the default prefix from app, the title is changed despite this.

@cyrilletuzi
Copy link
Contributor

Hope that it's not #6537 again...

hansl added a commit to hansl/devkit that referenced this issue Oct 11, 2017
To be the same as the separate HTML file.

Fixes angular/angular-cli#8005
hansl added a commit to angular/devkit that referenced this issue Oct 11, 2017
To be the same as the separate HTML file.

Fixes angular/angular-cli#8005
hansl added a commit that referenced this issue Jun 6, 2018
To be the same as the separate HTML file.

Fixes #8005
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants