8000 feat(useLens): new function by YomoABH · Pull Request #4657 · vueuse/vueuse · GitHub
[go: up one dir, main page]

Skip to content

feat(useLens): new function #4657

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(useLens): Fix unit-tests
  • Loading branch information
YomoABH committed Mar 11, 2025
commit e0f575febd31537aa2abbffce554d974725a6d25
8 changes: 0 additions & 8 deletions packages/core/useLens/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ describe('useLens', () => {
expect(source.value.profile.name).toBe('Dave')
})

it('uses fallback for undefined property', () => {
const source = deepRef({ profile: {} })
const name = useLens(source, s => s.profile.name, { fallback: 'Guest' })
expect(name.value).toBe('Guest')
name.value = 'Eve'
expect(source.value.profile.name).toBe('Eve')
})

it('transforms value on get and set', () => {
const source = deepRef({ count: '42' })
const count = useLens(source, s => s.count, {
Expand Down
Loading
0