feat(debug): replace DebugElement with new Debug DOM#6555
feat(debug): replace DebugElement with new Debug DOM#6555juliemr wants to merge 1 commit intoangular:masterfrom
Conversation
|
@tbosch this is a work in progress, as some tests are not yet upgraded. However, the API changes are complete and the unit tests for the new cc @jelbourn @wardbell , this is a heads up of some breaking changes to the unit test API. Feedback appreciated. |
There was a problem hiding this comment.
This name is deeply mysterious. No doc comments. What does it do?
There was a problem hiding this comment.
It adds info from the AppElement and AppView (injectable tokens, the injector itself, and the current component) that we'll need for debugging.
It's a renderer function, so it should be internal and a user should never have to bother with it. In any case, it's probably a good idea to add a comment, I'll do that.
There was a problem hiding this comment.
See my comment at the implementation
|
Remaining tasks
|
|
I've added a commit which fixes Angular's tests, adds a couple necessary features to DebugElement, and removes the ViewListener. Please take a look! |
0d3d3d4 to
66251bc
Compare
2e8a600 to
4b150f9
Compare
|
I've created a doc to track the changes that will be necessary for the merge to g3: https://docs.google.com/document/d/1wdODXGw8k_bCCYvPzxFxRX7jfAxHn7SXwTCpfsCL07c/ |
There was a problem hiding this comment.
Can we change this to be a directiveTypes: Type[]?
There was a problem hiding this comment.
Better: providerTokens: any[]
|
@juliemr this looks already pretty good. Left some comments... |
|
Btw, don't worry about the circle CI failure, @IgorMinar said we can ignore it for now... |
4b150f9 to
36419f0
Compare
|
Thanks for the review - all done except for platform location question above. I squashed the commits and added before/after examples to the breaking changes in the commit message. |
b7e006e to
50b11b2
Compare
|
Dear merge-master - this is not quite ready for merge yet. There are some pending g3 issues that I am working on addressing - the doc has been updated. |
8a55baf to
8d57a18
Compare
|
Now ready for merge! I have prepared fixes for all g3 issues, they are linked in the doc. |
|
Missing LGTM - @tbosch ? |
8d57a18 to
f668ab2
Compare
Now, using `ng.probe(element)` in the browser console returns
a DebugElement when in dev mode.
`ComponentFixture#debugElement` also returns a new DebugElement.
Breaking Change:
This is a breaking change for unit tests. The API for the DebugElement
has changed. Now, there is a DebugElement or DebugNode for every node
in the DOM, not only nodes with an ElementRef. `componentViewChildren` is
removed, and `childNodes` is a list of ElementNodes corresponding to every
child in the DOM. `query` no longer takes a scope parameter, since
the entire rendered DOM is included in the `childNodes`.
Before:
```
componentFixture.debugElement.componentViewChildren[0];
```
After
```
// Depending on the DOM structure of your component, the
// index may have changed or the first component child
// may be a sub-child.
componentFixture.debugElement.children[0];
```
Before:
```
debugElement.query(By.css('div'), Scope.all());
```
After:
```
debugElement.query(By.css('div'));
```
Before:
```
componentFixture.debugElement.elementRef;
```
After:
```
componentFixture.elementRef;
```
f668ab2 to
1584941
Compare
|
merged as e1bf3d3 |
…port Fixes two small issues introduced with pr angular#6555
|
I have created a sample application with angular2.beta13. Also i have used the test framework by taking guidelines from angular2-seed project by mgechev. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Now, using
ng.probe(element)in the browser console returnsa DebugElement when in dev mode.
ComponentFixture#debugElementalso returns a new DebugElement.Breaking Change:
This is a breaking change for unit tests. The API for the DebugElement
has changed. Now, there is a DebugElement or DebugNode for every node
in the DOM, not only nodes with an ElementRef.
componentViewChildrenisremoved, and
childNodesis a list of ElementNodes corresponding to everychild in the DOM.
queryno longer takes a scope parameter, sincethe entire rendered DOM is included in the
childNodes.Before:
After
Before:
After:
Before:
After: