forked from help-me-mom/ng-mocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support signal input from angular 17.1
Adds a custom transformer to transform Angular Code, specifically, signals (input, query and models) to behave better in jit-environment. Solves help-me-mom#7976 Signed-off-by: André Andersson <[email protected]>
- Loading branch information
1 parent
940dc1a
commit 3418f12
Showing
10 changed files
with
510 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -19,6 +19,7 @@ node_modules/ | |
test-reports/ | ||
tests-e2e/.angular | ||
tmp/ | ||
transformers/ | ||
|
||
**/*.sh | ||
**/*.snap | ||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Component, input } from '@angular/core'; | ||
import { MockBuilder, MockRender, ngMocks } from 'ng-mocks'; | ||
|
||
@Component({ | ||
selector: 'test-component', | ||
template: '<h1>{{ header() }}</h1>', | ||
standalone: true, | ||
}) | ||
class TestComponent { | ||
public readonly header = input.required<string>(); | ||
} | ||
|
||
// See https://github.com/help-me-mom/ng-mocks/issues/7976 | ||
describe('issue-7976', () => { | ||
beforeEach(() => MockBuilder(TestComponent)); | ||
|
||
it('should print header', () => { | ||
const fixture = MockRender(TestComponent, { | ||
header: 'Hello world!', | ||
}); | ||
|
||
expect(ngMocks.formatText(fixture)).toBe('Hello world!'); | ||
}); | ||
}); |
This file contains 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
Oops, something went wrong.