Working with the fluent API
Understanding the Fluent API
Legacy Approach vs. Fluent API
// Legacy approach - still works
const { appHost, startPromise, stop } = createFixture(
'<my-element></my-element>',
class AppRoot {},
[Dependency1, Dependency2]
);// Fluent API approach
const fixture = createFixture
.component(AppRoot)
.deps(Dependency1, Dependency2)
.html('<my-element></my-element>')
.build(); // build() must be called to create the fixture
const { appHost, startPromise, stop } = fixture;
await startPromise; // Wait for the fixture to be readyAvailable Fluent API Methods
Fluent API in Action: Example Test
Advantages of the Fluent API
Advanced Fluent API Examples
Using Tagged Template Literals
With Custom Element Definition
With Configuration Options
Alternative Entry Points
Last updated
Was this helpful?