Skip to content

feat(test): find testabilities across dart js applications#3611

Closed
TedSander wants to merge 1 commit into
angular:masterfrom
TedSander:testability
Closed

feat(test): find testabilities across dart js applications#3611
TedSander wants to merge 1 commit into
angular:masterfrom
TedSander:testability

Conversation

@TedSander
Copy link
Copy Markdown
Contributor

Find angular testability objects across different dart js contexts by
registering each application in a global array and interrogating each
for testabilities.

@TedSander
Copy link
Copy Markdown
Contributor Author

@hankduan can you review this for me?

@TedSander TedSander added the action: review The PR is still awaiting reviews from at least one requested reviewer label Aug 12, 2015
@hankduan
Copy link
Copy Markdown
Contributor

Instead of creating all these wrapper registries (i.e. _createRegistry), isn't it cleaner to do this (pseudo-code):

addToWindow(registry) {
  window['ngTestabilityRegistries'] = window['ngTestabilityRegistries'] || []
  window['ngTestabilityRegistries'].push(registry);

  window['getAngularTestability'] = function(elem) {
    // iterate through all window['ngTestabilityRegistries'] to find elem, and fail if not found
  }
  window['getAllAngularTestabilities'] = function() {
    // iterate through all window['ngTestabilityRegistries'], and aggregate all testabilities
  }
}

This way you don't have an unnecessary wrapping of the original registries.

@tbosch Can you also review this to see if this solution looks good to you? (essentially with multiple ng2 apps, the globals could override each other, and getAngularTestability/getAllAngularTestabilities would only read from the last registered registry).

@TedSander
Copy link
Copy Markdown
Contributor Author

Registry is a dart object which needs to live in the js address space since it needs to be available to all apps. To my knowledge the objects need to be converted to jsFunctions, or jsMaps, or jsObjects. I don't think the registry itself can be converted easily. So I convert the wrappers instead.

Find angular testability objects across different dart js contexts by
registering each application in a global array and interrogating each
for testabilities.
@hankduan
Copy link
Copy Markdown
Contributor

Does _jsify not work?

@hankduan
Copy link
Copy Markdown
Contributor

Anyway if Registry can't be jsified, then LGTM. It would be good if you wait till Tobias takes a look though as he's much more familiar with Testability and Dart than I am.

@tbosch tbosch added pr_state: LGTM and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 13, 2015
@TedSander TedSander closed this in 1d65b38 Aug 13, 2015
@TedSander TedSander deleted the testability branch August 13, 2015 19:58
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants