René's URL Explorer Experiment


Title: TestBed: rethink interactions with the @Input / @output of the root component · Issue #12313 · angular/angular · GitHub

Open Graph Title: TestBed: rethink interactions with the @Input / @output of the root component · Issue #12313 · angular/angular

X Title: TestBed: rethink interactions with the @Input / @output of the root component · Issue #12313 · angular/angular

Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request here, instead see https://github.com/an...

Open Graph Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request...

X Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not su...

Opengraph URL: https://github.com/angular/angular/issues/12313

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TestBed: rethink interactions with the @Input / @output  of the root component","articleBody":"**I'm submitting a ...**  (check one with \"x\")\n\n```\n[x] bug report => search github for a similar issue or PR before submitting\n[ ] feature request\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\n```\n\nTBH I'm not sure if this is a bug, a feature request, or just a product of my ignorance/incomplete docs.\n\n**Current behavior**\n\nWhen I have a component using `ChangeDetectionStrategy.OnPush`, I can create a test fixture via `const fixture = TestBed.createComponent(TestComponent)` but can't figure out how to force a change detection after altering one of the input properties. Just calling `fixture.detectChanges()` like I would for a `ChangeDetectionStrategy.Default` component doesn't seem to do it. I've also tried in conjunction with `fixture.changeDetectorRef.markForCheck()` but still no luck. However, if I wrap my OnPush component in another component for testing purposes, it works as expected.\n\n**Expected behavior**\n\nShould be some way to force a change detection on a OnPush component when changing its inputs directly via the component fixture (rather than via a wrapper component).\n\n**Minimal reproduction of the problem with instructions**\n\ntest.component:\n\n``` typescript\nimport { Component, Input, ChangeDetectionStrategy } from '@angular/core';\n\n@Component({\n  selector: 'my-test',\n  template: '\u003cp>{{ content }}\u003c/p>',\n  changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class TestComponent {\n  @Input() content: string;\n}\n```\n\ntest.component.spec.ts (this test fails w/ OnPush but passes with Default):\n\n``` typescript\nimport { TestBed } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { TestComponent } from './test.component';\n\ndescribe('Test Component', () => {\n  beforeEach(() => {\n    TestBed.configureTestingModule({declarations: [TestComponent]});\n  });\n  it('should render the bound content within a p element', () => {\n    const fixture = TestBed.createComponent(TestComponent);\n    fixture.detectChanges();\n    const p = fixture.debugElement.query(By.css('p'));\n    expect((p.nativeElement as HTMLParagraphElement).innerText).toBeFalsy();\n    fixture.componentInstance.content = 'Test!';\n    fixture.detectChanges();\n    expect((p.nativeElement as HTMLParagraphElement).innerText).toEqual('Test!');\n  });\n});\n```\n\ntest.component.wrapped.spec.ts (this passes with OnPush or Default):\n\n``` typescript\nimport { Component } from '@angular/core';\nimport { TestBed } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { TestComponent } from './test.component';\n\n@Component({\n  selector: 'my-wrapper',\n  template: '\u003cmy-test [content]=\"content\">\u003c/my-test>'\n})\nclass WrapperComponent {\n  content: string;\n}\ndescribe('Test Component (Wrapped)', () => {\n  beforeEach(() => {\n    TestBed.configureTestingModule({declarations: [TestComponent, WrapperComponent]});\n  });\n\n  it('should render the bound content within a p element', () => {\n    const fixture = TestBed.createComponent(WrapperComponent);\n    fixture.detectChanges();\n    const p = fixture.debugElement.query(By.css('p'));\n    expect((p.nativeElement as HTMLParagraphElement).innerText).toBeFalsy();\n    fixture.componentInstance.content = 'Test!';\n    fixture.detectChanges();\n    expect((p.nativeElement as HTMLParagraphElement).innerText).toEqual('Test!');\n  });\n});\n```\n\n**What is the motivation / use case for changing the behavior?**\n\nWould prefer to use roughly the same testing patterns regardless of which change detection strategy I'm using. \n\n**Please tell us about your environment:**\n- **Angular version:** 2.1.0\n- **Browser:** all\n- **Language:** TS 2.0.3\n","author":{"url":"https://github.com/mattdistefano","@type":"Person","name":"mattdistefano"},"datePublished":"2016-10-14T17:44:02Z","url":"https://github.com/angular/angular/issues/12313"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:412241c3-e4ce-d7e5-b0bd-e81c0bcac9e9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8F2C:14F601:E0363B:11FC955:6B00F3FC
html-safe-nonce6760df87ec0b05aa0f4f1bfcf0cf5712f3ebb0e9322a548413f4e1e3c2a677c3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjJDOjE0RjYwMTpFMDM2M0I6MTFGQzk1NTo2QjAwRjNGQyIsInZpc2l0b3JfaWQiOiI4MTIyOTQ5MzAyMjgxNjMwNzE3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmaca81e9bd2bab002aa328cdccbbde4c5fd886df0a64e1e2c6a846fa15c02551017
hovercard-subject-tagissue:183109642
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/12313/issue_layout
twitter:imagehttps://opengraph.githubassets.com/830e04150774d673e07bda9a88bbb99d1ce7b30a62b20c8e8e13bb96b36a4dcb/angular/angular/issues/12313
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/830e04150774d673e07bda9a88bbb99d1ce7b30a62b20c8e8e13bb96b36a4dcb/angular/angular/issues/12313
og:image:altI'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemattdistefano
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/12313#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F12313
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F12313
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/12313
Reloadhttps://github.com/angular/angular/issues/12313
Reloadhttps://github.com/angular/angular/issues/12313
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)https://github.com/angular/angular/issues
Pull requests141 (141)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/12313
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/12313
TestBed: rethink interactions with the @Input / @output of the root componenthttps://github.com/angular/angular/issues/12313#top
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
area: testingIssues related to Angular testing features, such as TestBedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20testing%22
core: inputs / outputshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20inputs%20%2F%20outputs%22
effort1: hourshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22effort1%3A%20hours%22
freq1: lowhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22freq1%3A%20low%22
state: needs eng inputhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20needs%20eng%20input%22
type: bug/fixhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%2Ffix%22
Fixit H1'2022https://github.com/angular/angular/milestone/113
https://github.com/mattdistefano
mattdistefanohttps://github.com/mattdistefano
on Oct 14, 2016https://github.com/angular/angular/issues/12313#issue-183109642
Nexthttps://github.com/angular/angular/issues/12313?timeline_page=1
vicbhttps://github.com/vicb
area: testingIssues related to Angular testing features, such as TestBedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20testing%22
on Oct 15, 2016https://github.com/angular/angular/issues/12313#event-824937292
https://github.com/mattdistefano
mattdistefanohttps://github.com/mattdistefano
on Oct 20, 2016https://github.com/angular/angular/issues/12313#issuecomment-255133414
https://github.com/mattdistefano
mattdistefanohttps://github.com/mattdistefano
on Oct 20, 2016https://github.com/angular/angular/issues/12313#issuecomment-255205939
https://github.com/mattdistefano
mattdistefanohttps://github.com/mattdistefano
on Oct 20, 2016https://github.com/angular/angular/issues/12313#issuecomment-255211875
juliemrhttps://github.com/juliemr
on Nov 22, 2016https://github.com/angular/angular/issues/12313#event-868965857
https://github.com/alexzuza
alexzuzahttps://github.com/alexzuza
on Nov 30, 2016https://github.com/angular/angular/issues/12313#issuecomment-263978801
Plunkerhttps://plnkr.co/edit/1w04DDKnYQ7kH6tIE0pK?p=preview
Plunker Examplehttps://plnkr.co/edit/zAmjI0AWmHkGXrbfgQDO?p=preview
Plunker Examplehttps://plnkr.co/edit/Lm3B3zgU7h9cCJJFF6Bx?p=preview
https://github.com/jiverson
jiversonhttps://github.com/jiverson
on Dec 1, 2016https://github.com/angular/angular/issues/12313#issuecomment-264284899
https://github.com/dabalyan
dabalyanhttps://github.com/dabalyan
on Jan 7, 2017https://github.com/angular/angular/issues/12313#issuecomment-271065571
@juliemrhttps://github.com/juliemr
@alexzuzahttps://github.com/alexzuza
https://github.com/EddyP23
EddyP23https://github.com/EddyP23
on Jan 18, 2017https://github.com/angular/angular/issues/12313#issuecomment-273525925
https://github.com/sebek64
sebek64https://github.com/sebek64
on Feb 1, 2017https://github.com/angular/angular/issues/12313#issuecomment-276696274
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
core: inputs / outputshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20inputs%20%2F%20outputs%22
on Jun 30, 2022https://github.com/angular/angular/issues/12313#event-6907508831
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
Backloghttps://github.com/angular/angular/milestone/82
Fixit H1'2022https://github.com/angular/angular/milestone/113
on Jul 1, 2022https://github.com/angular/angular/issues/12313#event-6917435874
atscotthttps://github.com/atscott
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
96c6139https://github.com/angular/angular/commit/96c6139c9ab35aa6ab2330a5a79a5906d5c2e8be
on Jul 1, 2022https://github.com/angular/angular/issues/12313#event-6920972979
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Aug 1, 2022https://github.com/angular/angular/issues/12313#issuecomment-1201402754
automatic conversation locking policyhttps://github.com/angular/angular/blob/8f24bc9443b3872fe095d9f7f77b308a361a13b4/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Aug 1, 2022https://github.com/angular/angular/issues/12313#event-7102929565
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/12313
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/12313
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P3%22
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
area: testingIssues related to Angular testing features, such as TestBedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20testing%22
core: inputs / outputshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20inputs%20%2F%20outputs%22
effort1: hourshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22effort1%3A%20hours%22
freq1: lowhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22freq1%3A%20low%22
state: needs eng inputhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20needs%20eng%20input%22
type: bug/fixhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%2Ffix%22
Fixit H1'2022https://github.com/angular/angular/milestone/113
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.