Skip to content

Commit c1daebf

Browse files
Add more context in computed properties (#179)
* add more context for call in computed properties * Apply suggestions from code review Co-authored-by: Lachlan Miller <[email protected]>
1 parent ad91a8b commit c1daebf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/computed-properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Now `yarn test:unit` passes!
123123

124124
## Testing with `call`
125125

126-
We will now add a test for the case of `even: false`. This time, we will see an alternative way to test a computed property, without actually rendering the component.
126+
The `call` method is vanilla JavaScript used to call a function and pass to it an argument that will set `this` for that function. Seeing as computed is a function we can use that in the tests. In the `props` we set the value of `even` and in turn this becomes available to the component as `this.even`. So by using call we can override this and set `even` to what we want to test. So now using `call` we will add a test for the case of `even: false`. This time, we will see an alternative way to test a computed property, without actually rendering the component.
127127

128128
The test, first:
129129

0 commit comments

Comments
 (0)