aurelia / aurelia/testing

Feature request: Mocking/stubbing sub-views

Open
#20 24 comments 4 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
TypeScript
Stars
38
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Hi,

I know this is heavily a work-in-progress library, but I also know you want feedback :)

Having used the ComponentTester for a few components we find the need for mocking/stubbing out sub-views which are imported through the html-require tag.

Prehaps a bit of background is helpful:
We have a separate suit of tests we call binding-tests. They are a form of regression-tests to avoid the problem of renaming view model properies and forgetting to rename the bindings in the HTML.
We want these as unit-tests so that we can get feedback asap.

This creates a problem where we have a component foo:

``` javascript
export class Foo {
fooData;
get processedFoo() {
return processFoo();
}
}
```

With html:

``` HTML


```

We want to check the binding for bar's 'some-data', but we do not want to parse the possibly complex output of bar in order to check that. Bar's output should not be a part of the test for Foo.

Is there a way to do this currently? Have you considered a use-case like this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.