-
Notifications
You must be signed in to change notification settings - Fork 668
fix: function names #580
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
fix: function names #580
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
10490d7
Revert "refactor: refactor stub-components.js (#544)"
38elements 9b08032
Revert "refactor: refactor add-slots.js (#556)"
38elements e17937a
delete packages/test-utils/src/shallow.js
38elements 425d01d
add functions
38elements 135fd28
add type SlotValue
38elements b36e092
add test
38elements b26b81d
fix slotValue
38elements 82624d3
fix validateEnvironment
38elements 5a4fa7a
add test
38elements 6d78850
fix lint
38elements 6288aff
Update slots.spec.js
38elements 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
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
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
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 |
---|---|---|
@@ -1,26 +1,23 @@ | ||
// @flow | ||
|
||
import { throwError, toArray, isObject } from 'shared/util' | ||
import { compileToFunctions } from 'vue-template-compiler' | ||
import { throwError } from 'shared/util' | ||
|
||
function isValidSlot (slot: any): boolean { | ||
return Array.isArray(slot) || (slot !== null && typeof slot === 'object') || typeof slot === 'string' | ||
} | ||
|
||
export function validateSlots (slots: Object): void { | ||
Object.keys(slots).forEach(key => { | ||
toArray(slots[key]).forEach(slotValue => { | ||
if (!isObject(slotValue) && typeof slotValue !== 'string') { | ||
throwError('slots[key] must be a Component, string or an array of Components') | ||
} | ||
slots && Object.keys(slots).forEach((key) => { | ||
if (!isValidSlot(slots[key])) { | ||
throwError('slots[key] must be a Component, string or an array of Components') | ||
} | ||
|
||
if (typeof slotValue === 'string') { | ||
if (!compileToFunctions) { | ||
throwError('vueTemplateCompiler is undefined, you must pass components explicitly if vue-template-compiler is undefined') | ||
} | ||
if (typeof window === 'undefined') { | ||
throwError('the slots string option does not support strings in server-test-uitls.') | ||
} | ||
if (window.navigator.userAgent.match(/PhantomJS/i)) { | ||
throwError('the slots option does not support strings in PhantomJS. Please use Puppeteer, or pass a component.') | ||
if (Array.isArray(slots[key])) { | ||
slots[key].forEach((slotValue) => { | ||
if (!isValidSlot(slotValue)) { | ||
throwError('slots[key] must be a Component, string or an array of Components') | ||
} | ||
} | ||
}) | ||
}) | ||
} | ||
}) | ||
} |
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
When
slotValue
is' foo '
, this line make a bug.This process introduced at #556 .
I added a test for spaces.