Add spyOnAll function#1581
Conversation
|
I have added proper jsdoc. And it looks like that is all I need to do to update the documentation. For that reason, I am going to check that box in the PR checklist above. |
|
How do I access the spy on the spied property? |
|
It would be something like this: Or maybe I'm misunderstanding your question. |
|
That’s for a function. How about for a property? If ‘a’ is a property, how do we differentiate between getting the property value vs. the spy? |
|
That's a good question. I have never used spies on non-functions before. Perhaps I should restrict And then there could be an equivalent |
|
I haven’t had a chance to review this in any more detail, but let’s either update the name or add the property spying (or both so there is |
|
I'll update this PR so that it provides spyOnAllFunctions and then create
another one for spyOnAllProperties.
…On Fri, Jul 20, 2018 at 7:25 AM, Gregg Van Hove ***@***.***> wrote:
I haven’t had a chance to review this in any more detail, but let’s either
update the name or add the property spying (or both so there is spyOnAll,
spyOnAllFunctions, and spyOnAllProperties or something)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1581 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAWMJ3HNj3jlvWvMgexdlFABtb4tSXWpks5uIehugaJpZM4VVskr>
.
|
This function will spy on all writable and configurable functionss of
an object that is passed in. It can be used like this:
spyOnAllFunctions(obj);
This commit addresses jasmine#1421
|
Updated the commit so that it provides spyOnAllFunctions. Do you want me to update the PR text as well? If and when this goes through, I'll add spyOnAllProperties. |
- Merges #1581 from @aeisenberg - Fixes #1421
|
I don't know a lot about developing in this repo, but I noticed that I cannot use spyOnAllFunctions without first constructing a registry. Was that intended behavior? Currently, throws Adding the following to |
|
You're right, it looks like a bit of the wiring got missed for this. I'm releasing a 3.2.1 which should work properly out of the box. |
|
+1 ! Took me a long time to find this PR, excited for this. Unfortunately, I am not currently on the latest version, but very glad with the addition. |
|
is there a way to use this with classes instead of objects? |
|
For a class named A, I believe that calling spyOnAll(A.prototype) should
work the way you expect.
…On Thu, Nov 15, 2018 at 5:58 AM Francesco Borzì ***@***.***> wrote:
is there a way to use this with classes instead of objects?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1581 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAWMJ5Pt3bTULkIQofdCw94KZ4lqUcoLks5uvXMegaJpZM4VVskr>
.
|
Description
This function will spy on all writable and configurable properties of
an object that is passed in. It can be used like this:
Motivation and Context
This commit addresses #1421
How Has This Been Tested?
I have included specs for spyOnAll. I have run the tests in the browser through
bundle exec rake jasmine. The browsers I tested are chrome, firefox, safari, and vivaldi (latest versions of each).Types of changes
Checklist:
I am not sure how to update the documentation. After I submit this PR, I will figure this out.