-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2c797f
commit 6eee6bf
Showing
3 changed files
with
54 additions
and
17 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
27 changes: 27 additions & 0 deletions
27
packages/angular-table/tests/flex-render-component.test-d.ts
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,27 @@ | ||
import { input } from '@angular/core' | ||
import { test } from 'vitest' | ||
import { flexRenderComponent } from '../src' | ||
|
||
test('Infer component inputs', () => { | ||
class Test { | ||
readonly input1 = input<string>() | ||
} | ||
|
||
// @ts-expect-error Must pass right type as a value | ||
flexRenderComponent(Test, { inputs: { input1: 1 } }) | ||
|
||
// Input is optional so we can skip passing the property | ||
flexRenderComponent(Test, { inputs: {} }) | ||
}) | ||
|
||
test('Options are mandatory when given component has required inputs', () => { | ||
class Test { | ||
readonly input1 = input<string>() | ||
readonly requiredInput1 = input.required<string>() | ||
} | ||
|
||
// @ts-expect-error Required input | ||
flexRenderComponent(Test) | ||
|
||
flexRenderComponent(Test, { inputs: { requiredInput1: 'My value' } }) | ||
}) |