Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Conversation

@sjelin
Copy link
Contributor

@sjelin sjelin commented Dec 20, 2016

Closes #1742

@sjelin
Copy link
Contributor Author

sjelin commented Dec 20, 2016

I might have a much better idea than this, pending talking with @juliemr later today, so don't both reviewing right now

@sjelin
Copy link
Contributor Author

sjelin commented Dec 21, 2016

As per talking to @juliemr, this will will not be part of a larger change after all. Please review! 😄

@sjelin sjelin force-pushed the findTheRootCause branch 6 times, most recently from 731c26e to 5b40ed2 Compare December 22, 2016 00:24
*
* @param {string} ngRepeat The ngRepeat to test
* @param {string} repeater The repeater to test against
* @param {boolean} exact If the ngRepeat needs to be more or less exactly the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "more or less"? Just 'exactly'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it removes track by and as and everything after | or =. Is it still exactly the repeater? I don't actually understand ng1 well enough to know which parts of the ng-repeat count.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about If the ngRepeat expression should exactly match.... it's not 100% precise because of track by but I think it gets the idea across more clearly than "more or less"

Copy link
Member

@juliemr juliemr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a message to the commit description that users no longer need to specify 'useAllAngular2AppRoots' in the config.

Please add a breaking change section to the commit description explaining the way that this could potentially break stuff (I don't think this will affect very many people at all, but we should have at least some sort of guidance for them on how to debug if it does)

* falsy, tries a variety of methods to find an injector
* @param {boolean=} injectorPlease Prioritize finding an injector
* @return {$$testability?: Testability, $injector?: Injector} Returns what
* the app hooks it finds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description seems to have gotten a bit mangled.

} else {
var $injector = angular.element(el).injector();
if ($injector) {
return {$injector: angular.element(el).injector()};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just return {$injector: $injector} should work here, yeah?

if (!ng12Hybrid && window.getAngularTestability) {
if (window.angular && !(window.angular.version &&
window.angular.version.major > 1)) {
// ng1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use /** */ for comments in here.

}
if (angular.getTestability) {
angular.getTestability(el).whenStable(callback);
} else if (window.angular.version == 2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in other PR, let's change this to be future proof for angular versions > 2

lib/config.ts Outdated
* CSS Selector for the element housing the angular app - this defaults to
* 'body', but is necessary if ng-app is on a descendant of <body>.
* A CSS selector for the DOM element you want Protractor to hook into your
* app at.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe

"A CSS Selector for a DOM element within your Angular application. Protractor will attempt to automatically find your application, but It is necessary to set rootElement in certain cases.

In Angular 1, Protractor will use bootstrapping and then search for body or ng-app elements (details here: https://git.io/v1b2r).

In later versions, Protractor will try to hook into all angular apps on the page. Use rootElement to limit the scope of which apps Protractor waits for and searches within.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Protractor will use bootstrapping" is a little unclear but that's definitely an improvement

return {$injector: $injector, $$testability: $$testability};
} else {
return tryEl(document.body) ||
trySelector('[ng-app]') || trySelector('[ng:app]') ||
Copy link
Contributor Author

@sjelin sjelin Dec 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juliemr should this include ng_app too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think anyone uses that... I'd leave it out. We can always add it later if there's a clamor.

@sjelin
Copy link
Contributor Author

sjelin commented Dec 27, 2016

@juliemr all comments addressed

@juliemr
Copy link
Member

juliemr commented Dec 29, 2016

LGTM

This is a breaking change because it changes the default root element behavior
and removes the `config.useAllAngular2AppRoots` flag.  Modern angular apps now
default to using all app hooks, and ng1 apps now check several places, notably
the element the app bootstraps to.

Closes angular#1742
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants