Open ChristophWalter opened 4 years ago
Hi, I'm the maintainer of Angular Testing Library. Those are all valid points, feel free to create a PR and ping me for a review.
What do you think about aligning the API behavior to React's API? I stumbled over rerender and first created a bug here as I was sure about my unchecked React-based assumptions:
In the React-world, rerender
on a (legacy) class component, results in a call to render
and a call to componentDidUpdate
with previous props as parameters, but not to a call to constructor or componentDidMount
.
On the other hand, in the Angular-world rerender
does re-create the component from scratch. Meaning constructor is called again and ngOnChanges
with initial simpleChange object without previous values / firstChange
is set to true for each input property.
So my thoughts:
rerender
should do, what change does. But I am not sure if it is worth a breaking change?rerender
, as we can utilize render
for creating a component from scratch, can we not?rerender
's description. Something along the lines of:
Re-create the same component from scratch.
ngOnChanges
will be called with initial simple change object.
What do you think? Should I create an own issue for this discussion?
@shaman-apprentice you can open a PR to update the docs. We can discuss this if we have more breaking changes, maybe soon because testing library dom is going to have some breaking changes
@shaman-apprentice you can open a PR to update the docs. We can discuss this if we have more breaking changes, maybe soon because testing library dom is going to have some breaking changes
Thx! I created a PR with a suggestion for current behavior. Is there some process / guidelines how the api section of the docs should be aligned with the js docs from models.ts?
After some thoughts I still like the idea of the breaking change to remove change
and let rerender
do what change
currently does. If you are open to this change, how should we proceed with this idea? Should I create a docs PR for it or maybe an own issue?
@shaman-apprentice I try to keep it up-to-date, and I usually copy paste the content from the docs to the models (or the other way around). When the PR is merged, we can also update the models file.
For the breaking change, let's open an issue in ATL and discuss it there.
I am new to Angular Testing and stumbled across some misunderstandings while writing my first tests. I would like to help you improve it, so let's start collecting the issues. 🙂
TestBed.get(TargetService).init();