-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[Cookbook] Unit Testing components #1369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit
Hold shift + click to select a range
14c56d1
Create new page
lmiller1990 f473583
Update
lmiller1990 11d182c
Improve intro
lmiller1990 7ff1e6e
Update
lmiller1990 6b85742
Add Example
lmiller1990 6503bab
Include real world example and explanation about testing
lmiller1990 739471e
Added "Why vue" en, cn srt files into assets folder (#1367)
Jinjiang f0265ed
fix: Correct sidebar anchor targets (#1366)
3de11ad
Images not found. (#1365)
btrice 7fa317a
[Doc EN]: `event.md` add space to new part (#1363)
MachinisteWeb 9163da0
Retrieve tweeningValue from onUpdate callback in documentation (#1350)
Boydbueno bdce299
Add watch usages (#1356)
wangyi7099 fdc6694
Avoid updating license every year (#1353)
m1guelpf d2cdbfd
Update spelling error and add some details about what we are testing
lmiller1990 2d84bff
Update
lmiller1990 61d0d85
typo for chinese subtitles of "why vue" video (#1371)
Jinjiang 5565e86
Adding Why Vue.js video to Introduction page (#1377)
Gregg 0169caa
Fixed typo in Gulp example in deployment.md (#1376)
stefangrund ef9c590
Update deployment.md with Grunt example (#1375)
stefangrund 5cf5c8b
Decoupled video player from Vimeo (#1374)
Jinjiang 7289185
Update Installation guide to use https://caniuse.com (#1372)
fgo 524a4b5
[HOTFIX] initVideoModal error in common.js (#1378)
Jinjiang a3eff13
Showing all possible params of watch() (#1380)
ffxsam da0c6d0
refactor & update sponsors display
yyx990803 f8928f8
include bronze data
yyx990803 2cf1439
fix link
yyx990803 9a55109
fix link
yyx990803 42c9a22
add build script
yyx990803 36f1a01
update deploy docs
yyx990803 68d4312
Small fixes (#1381)
Jinjiang 8c4310c
update Guillaume's core focus
yyx990803 95885ff
Improve based on Sarah Drasner feedback and fix some grammar
lmiller1990 3696678
Fixed TYPO Automatic Key Modifiers (#1388)
TanyMers f6e4596
update community deployment instructions
yyx990803 e34aacf
Tweak wording of `.passive` modifier explanation
chrisvfritz aafb90c
Add guide link in Vue.filter API (#1394)
william-pan 4ad162d
Update filters, global filters needs to go before Vue instance creati…
brandedoutcast 12e10f0
update tree-view example to add v-for key
chrisvfritz a49c314
add details of object merging to mixins page
chrisvfritz 88c7277
Revise beforeUpdate API entry, fixes vuejs/vue#7481 (#1395)
chrisvfritz 23f59fe
fix vue team distance sorting
chrisvfritz c4b7f9a
Add explicit version to download links (#1398)
rubydesign 54e70b6
demo from ’Object Change Detection‘ doesn't work (#1397)
frankwang0909 e390e4d
Updated description of Weex (#1396)
Jinjiang 27839fc
fix vue component require syntax for modern vue-loader
chrisvfritz 89809ef
The Web Optimization Project has optimized your repository! (#1389)
devedse b14fdbc
Fix wrapperfind(error) typo and add example to test for whitespace
lmiller1990 e205dce
Update
lmiller1990 88a3e1e
Use factory function to save redundant logic
lmiller1990 f69165f
Add factory function explanation and link to vue test utils guides.
lmiller1990 78e1358
Update using codebryo feedback
lmiller1990 e6ac092
Change Github to GitHub (#1399)
lex111 01aed53
Fixed js error when click the page (#1401)
Jinjiang 1c8ef8f
Change cookbook entry number and reformat sentence
lmiller1990 8368113
Change order
lmiller1990 31d3537
fix: typo in v-show description (#1408)
znck 057cce4
Create new page
lmiller1990 dafcc50
Update
lmiller1990 9777049
Improve intro
lmiller1990 8d23472
Update
lmiller1990 457b571
Add Example
lmiller1990 ef9b7f9
Include real world example and explanation about testing
lmiller1990 d2697cd
Update spelling error and add some details about what we are testing
lmiller1990 d967fd4
Update
lmiller1990 fcede9f
Improve based on Sarah Drasner feedback and fix some grammar
lmiller1990 18f3f8e
Fix wrapperfind(error) typo and add example to test for whitespace
lmiller1990 da9d7d6
Update
lmiller1990 624b3bb
Use factory function to save redundant logic
lmiller1990 f3136c9
Add factory function explanation and link to vue test utils guides.
lmiller1990 6cfe317
Update using codebryo feedback
lmiller1990 3905265
Change cookbook entry number and reformat sentence
lmiller1990 e9e1116
Change order
lmiller1990 3018298
Rebase
lmiller1990 86bca90
Resolve conflicts
lmiller1990 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Create new page
- Loading branch information
commit 14c56d1977fa559fc2d33c6d785c91fea9acb53c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: Unit Testing Vue Components | ||
type: cookbook | ||
order: 1.2 | ||
--- | ||
|
||
## Simple Example | ||
|
||
_required_ | ||
|
||
1. Articulate the problem in a sentence or two. | ||
2. Explain the simplest possible solution in a sentence or two. | ||
3. Show a small code sample. | ||
4. Explain what this accomplishes in a sentence. | ||
|
||
## Details about the Value | ||
|
||
_required_ | ||
|
||
1. Address common questions that one might have while looking at the example. (Blockquotes are great for this) | ||
2. Show examples of common missteps and how they can be avoided. | ||
3. Show very simple code samples of good and bad patterns. | ||
4. Discuss why this may be a compelling pattern. Links for reference are not required but encouraged. | ||
|
||
## Real-World Example | ||
|
||
_required_ | ||
|
||
Demonstrate the code that would power a common or interesting use case, either by: | ||
1. Walking through a few terse examples of setup, or | ||
2. Embedding a codepen/jsfiddle example | ||
|
||
If you choose to do the latter, you should still talk through what it is and does. | ||
|
||
## Additional Context | ||
|
||
_optional_ | ||
|
||
It's extremely helpful to write a bit about this pattern, where else it would apply, why it works well, and run through a bit of code as you do so or give people further reading materials here. | ||
|
||
## When To Avoid This Pattern | ||
|
||
_optional_ | ||
|
||
This section is not required, but heavily recommended. It won't make sense to write it for something very simple such as toggling classes based on state change, but for more advanced patterns like mixins it's vital. The answer to most questions about development is ["It depends!"](https://codepen.io/rachsmith/pen/YweZbG), this section embraces that. Here, we'll take an honest look at when the pattern is useful and when it should be avoided, or when something else makes more sense. | ||
|
||
## Alternative Patterns | ||
|
||
_optional, except when the section above is provided_ | ||
|
||
This section is required when you've provided the section above about avoidance. It's important to explore other methods so that people told that something is an antipattern in certain situations are not left wondering. In doing so, consider that the web is a big tent and that many people have different codebase structures and are solving different goals. Is the app large or small? Are they integrating Vue into an existing project, or are they building from scratch? Are their users only trying to achieve one goal or many? Is there a lot of asynchronous data? All of these concerns will impact alternative implementations. A good cookbook recipe gives developers this context. | ||
|
||
## Thank you | ||
|
||
It takes time to contribute to documentation, and if you spend the time to submit a PR this section of our docs, you do so with our gratitude. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from the template, should be removed :)