-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Angular: Component creation with TestBed API #31311
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
christoph-rogalla
wants to merge
70
commits into
storybookjs:next
from
christoph-rogalla:angular-dependencies
Closed
Changes from all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
bdc2876
feat: add TestBedComponentBuilder.ts for component creation
christoph-rogalla 7dfc0d5
feat: add dependency at component level fix WIP
christoph-rogalla df1923d
feat: add dependency at component level fix WIP
christoph-rogalla 2dc32db
fix: error on reset/init testbed module
christoph-rogalla 5e90152
refactor: testbed builder pattern and prop assignment
christoph-rogalla 87466cf
fix: not standalone angular schematics
christoph-rogalla 6937f05
fix: multiple component declaration by wrapper module
christoph-rogalla 2f920fb
WIP: multiple import of some components causes error
christoph-rogalla c15a3fb
refactor: testbed creation to constructor
christoph-rogalla a217ee2
refactor: override meta data generation to file
christoph-rogalla c952ddd
remove: console.log
christoph-rogalla 6809141
Merge branch 'next' into angular-dependencies
christoph-rogalla 98bcd54
refactor: @angular/animations dependency back to dev-dependencies
christoph-rogalla 2feab65
refactor: split throw on null required values into specific functions
christoph-rogalla e736144
refactor: angular sandbox dependencies and yarn.lock
christoph-rogalla 93cd136
fix: yarn lock diff on install
christoph-rogalla df4753f
feat: add feature switch useTestBedRenderer in parameters
christoph-rogalla a4d719f
fix: preview didnt visualized correctly
christoph-rogalla 7c48733
refactor: render function to move duplicate code into own function
christoph-rogalla df05233
fix: RendererFactory.test.ts due new parameter
christoph-rogalla 3922240
Update code/frameworks/angular/src/client/angular-beta/utils/TestBedO…
valentinpalkovic c3b955f
Merge branch 'next' into angular-dependencies
valentinpalkovic c06bce6
Introduce experimental_afterEach wrapper for testing purposes
valentinpalkovic 1c67e3a
Use beforeEach hook instead of afterEach
valentinpalkovic 529255a
feat: add new testcases for error with testbed rendering
christoph-rogalla 9e3dc8b
Merge remote-tracking branch 'origin/angular-dependencies' into angul…
christoph-rogalla f4c7209
refactor: testbed renderer error tests
christoph-rogalla 1f7f262
fix: multiple declaration in modules
christoph-rogalla ab11710
fix: prop assignment did not trigger angular lifecycle hooks
christoph-rogalla a084f95
[Angular] feat: add rendering bug as test story
christoph-rogalla d07394b
[Angular] feat: add routes as parameter attributes for story for spec…
christoph-rogalla f4f82f2
[Angular] refactor: routing attributes to moduleMedatada and Applicat…
christoph-rogalla e645640
[Angular] feat: add routing functionalities for testbed rendering
christoph-rogalla 07862e5
Merge branch 'next' into angular-dependencies
christoph-rogalla 360d73c
Merge remote-tracking branch 'origin/angular-dependencies' into angul…
christoph-rogalla fc1824d
Merge branch 'next' into angular-dependencies
christoph-rogalla d3ac778
Merge remote-tracking branch 'origin/angular-dependencies' into angul…
christoph-rogalla 68853bc
[Angular] fix: router dependency
christoph-rogalla b6fb228
[Angular] fix: changed lockfile
christoph-rogalla 686f5dc
[Angular] fix: dependency for pipeline
christoph-rogalla c67765c
[Angular] fix: circular dependency and tests
christoph-rogalla 595db12
[Angular] fix: angular versions
christoph-rogalla 5e39790
[Angular] fix: angular versions
christoph-rogalla ced20e3
[Angular] fix: angular versions
christoph-rogalla 88ad304
[Angular] fix: angular versions
christoph-rogalla 3d64710
[Angular] fix: angular versions
christoph-rogalla 3b2808d
[Angular] fix: angular router versions
christoph-rogalla 6080907
[Angular] remove: provideExperimentalZonelessChangeDetection in Abstr…
christoph-rogalla 155a2a2
[Angular] fix: versioning
christoph-rogalla d350fd2
[Angular] fix: modfing lock file
christoph-rogalla 933fd0c
[Angular] feat: add destroy platform on before-each
christoph-rogalla 6aa3c90
Merge remote-tracking branch 'origin/next' into pr/christoph-rogalla/…
valentinpalkovic f4ae462
Make @angular/router optional
valentinpalkovic 2a51649
[Angular] fix: add missing await statements
christoph-rogalla 2d6b193
Introduce previewTestBedRenderer feature for enhanced component rende…
valentinpalkovic 49c603c
Remove previewTestBedRenderer feature from Angular templates
valentinpalkovic 04efc4f
Refactor TestBedDocsRenderer to remove forced rendering option
valentinpalkovic fc7e574
Angular: Disable prod mode if new TestBed renderer is used
valentinpalkovic 63a06a3
Update sandbox-templates to enable previewTestBedRenderer feature for…
valentinpalkovic 927762c
Fix linting
valentinpalkovic 2506aed
[Angular] fix: story html width
christoph-rogalla 4840d2c
Merge remote-tracking branch 'origin/angular-dependencies' into angul…
christoph-rogalla 2c58729
[Angular] fix: chip module story
christoph-rogalla 37604c9
[Angular] fix: getting provider from ModuleWithProviders
christoph-rogalla 3b5df69
[Angular] fix: getting provider from ModuleWithProviders
christoph-rogalla 474b9ee
[Angular] fix: input signals error due invalid value set
christoph-rogalla 7dbd6a3
[Angular] fix: circular dependency wrapper module
christoph-rogalla e418f78
[Angular] fix: declarations
christoph-rogalla 1ed7890
[Angular] feat: add reactive stories for debugging
christoph-rogalla 2286ce1
remove: debug stories
christoph-rogalla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,12 +40,12 @@ describe('RendererFactory', () => { | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| describe('CanvasRenderer', () => { | ||||||||||||||||||||||||||||
| it('should get CanvasRenderer instance', async () => { | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode); | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode, false); | ||||||||||||||||||||||||||||
| expect(render).toBeInstanceOf(CanvasRenderer); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| it('should render my-story for story template', async () => { | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode); | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode, false); | ||||||||||||||||||||||||||||
| await render?.render({ | ||||||||||||||||||||||||||||
| storyFnAngular: { | ||||||||||||||||||||||||||||
| template: '🦊', | ||||||||||||||||||||||||||||
|
|
@@ -62,7 +62,7 @@ describe('RendererFactory', () => { | |||||||||||||||||||||||||||
| @Component({ selector: 'foo', template: '🦊' }) | ||||||||||||||||||||||||||||
| class FooComponent {} | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode); | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode, false); | ||||||||||||||||||||||||||||
| await render?.render({ | ||||||||||||||||||||||||||||
| storyFnAngular: { | ||||||||||||||||||||||||||||
| props: {}, | ||||||||||||||||||||||||||||
|
|
@@ -87,7 +87,7 @@ describe('RendererFactory', () => { | |||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| const token = new Thing(); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode); | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode, false); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| await render?.render({ | ||||||||||||||||||||||||||||
| storyFnAngular: { | ||||||||||||||||||||||||||||
|
|
@@ -105,7 +105,7 @@ describe('RendererFactory', () => { | |||||||||||||||||||||||||||
| describe('when forced=true', () => { | ||||||||||||||||||||||||||||
| beforeEach(async () => { | ||||||||||||||||||||||||||||
| // Init first render | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode); | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode, false); | ||||||||||||||||||||||||||||
| await render?.render({ | ||||||||||||||||||||||||||||
| storyFnAngular: { | ||||||||||||||||||||||||||||
| template: '{{ logo }}: {{ name }}', | ||||||||||||||||||||||||||||
|
|
@@ -125,7 +125,7 @@ describe('RendererFactory', () => { | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| it('should not be re-rendered when only props change', async () => { | ||||||||||||||||||||||||||||
| // only props change | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode); | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode, false); | ||||||||||||||||||||||||||||
| await render?.render({ | ||||||||||||||||||||||||||||
| storyFnAngular: { | ||||||||||||||||||||||||||||
| props: { | ||||||||||||||||||||||||||||
|
|
@@ -140,7 +140,7 @@ describe('RendererFactory', () => { | |||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| it('should be re-rendered when template change', async () => { | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode); | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode, false); | ||||||||||||||||||||||||||||
| await render?.render({ | ||||||||||||||||||||||||||||
| storyFnAngular: { | ||||||||||||||||||||||||||||
| template: '{{ beer }}', | ||||||||||||||||||||||||||||
|
|
@@ -161,7 +161,7 @@ describe('RendererFactory', () => { | |||||||||||||||||||||||||||
| describe('when canvas render is done before', () => { | ||||||||||||||||||||||||||||
| beforeEach(async () => { | ||||||||||||||||||||||||||||
| // Init first Canvas render | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode); | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootTargetDOMNode, false); | ||||||||||||||||||||||||||||
| await render?.render({ | ||||||||||||||||||||||||||||
| storyFnAngular: { | ||||||||||||||||||||||||||||
| template: 'Canvas 🖼', | ||||||||||||||||||||||||||||
|
|
@@ -177,13 +177,13 @@ describe('RendererFactory', () => { | |||||||||||||||||||||||||||
| .appendChild(global.document.createElement('👾')); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| expect(global.document.getElementById('storybook-root').innerHTML).toContain('Canvas 🖼'); | ||||||||||||||||||||||||||||
| await rendererFactory.getRendererInstance(rootDocstargetDOMNode); | ||||||||||||||||||||||||||||
| await rendererFactory.getRendererInstance(rootDocstargetDOMNode, false); | ||||||||||||||||||||||||||||
| expect(global.document.getElementById('storybook-root').innerHTML).toBe(''); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| it('should get DocsRenderer instance', async () => { | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootDocstargetDOMNode); | ||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance(rootDocstargetDOMNode, false); | ||||||||||||||||||||||||||||
| expect(render).toBeInstanceOf(DocsRenderer); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
@@ -193,7 +193,8 @@ describe('RendererFactory', () => { | |||||||||||||||||||||||||||
| class FooComponent {} | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance( | ||||||||||||||||||||||||||||
| global.document.getElementById('storybook-docs') | ||||||||||||||||||||||||||||
| global.document.getElementById('storybook-docs'), | ||||||||||||||||||||||||||||
| false | ||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const targetDOMNode1 = global.document.createElement('div'); | ||||||||||||||||||||||||||||
|
|
@@ -223,7 +224,7 @@ describe('RendererFactory', () => { | |||||||||||||||||||||||||||
| expect(global.document.querySelectorAll('#story-1 > story-1')[0].innerHTML).toBe( | ||||||||||||||||||||||||||||
| '<foo>🦊</foo><!--container-->' | ||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||
| expect(global.document.querySelectorAll('#story-1 > story-1')[1].innerHTML).toBe( | ||||||||||||||||||||||||||||
| expect(global.document.querySelectorAll('#story-1 > story-1')[0].innerHTML).toBe( | ||||||||||||||||||||||||||||
| '<foo>🦊</foo><!--container-->' | ||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||
|
Comment on lines
224
to
229
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: Duplicate assertion using same selector '[0]' - second assertion is testing the exact same element as the first
Suggested change
|
||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
@@ -235,7 +236,8 @@ describe('RendererFactory', () => { | |||||||||||||||||||||||||||
| class FooComponent {} | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const render = await rendererFactory.getRendererInstance( | ||||||||||||||||||||||||||||
| global.document.getElementById('storybook-docs') | ||||||||||||||||||||||||||||
| global.document.getElementById('storybook-docs'), | ||||||||||||||||||||||||||||
| false | ||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const targetDOMNode1 = global.document.createElement('div'); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.