-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Remove Router/Vuex for Vue 3 (#206)
* Remove handling of router/vuex * Fix existing tests * Mark types as deprecated * Add simple vuex example * Improve messaging * Mark store as optional
- Loading branch information
Showing
9 changed files
with
168 additions
and
131 deletions.
There are no files selected for viewing
This file contains 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,24 +1,20 @@ | ||
<template> | ||
<div> | ||
<h2>Counter</h2> | ||
<div> | ||
<button data-testid="decrementer" @click="decrement">-</button> | ||
<span data-testid="count-value">{{ count }}</span> | ||
<button data-testid="incrementer" @click="increment">+</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { mapActions, mapState } from 'vuex' | ||
export default { | ||
computed: { | ||
...mapState(['count']) | ||
}, | ||
methods: { | ||
...mapActions(['decrement', 'increment']) | ||
} | ||
} | ||
</script> | ||
<template> | ||
<h2>Counter</h2> | ||
<button data-testid="decrementer" @click="decrement">-</button> | ||
<span data-testid="count-value">{{ count }}</span> | ||
<button data-testid="incrementer" @click="increment">+</button> | ||
</template> | ||
|
||
<script> | ||
import {mapActions, mapState} from 'vuex' | ||
export default { | ||
computed: { | ||
...mapState(['count']), | ||
}, | ||
methods: { | ||
...mapActions(['decrement', 'increment']), | ||
}, | ||
} | ||
</script> |
This file contains 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,39 @@ | ||
import {render} from '..' | ||
|
||
beforeEach(() => { | ||
jest.spyOn(console, 'warn').mockImplementation(() => {}) | ||
}) | ||
|
||
afterEach(() => { | ||
console.warn.mockRestore() | ||
}) | ||
|
||
test('warns on deprecated store option', () => { | ||
const Component = {template: `<div></div>`} | ||
|
||
render(Component, { | ||
store: 'anything', | ||
}) | ||
|
||
expect(console.warn).toHaveBeenCalledTimes(1) | ||
expect(console.warn).toHaveBeenCalledWith( | ||
expect.stringContaining( | ||
`Providing 'store' or 'routes' options is no longer available`, | ||
), | ||
) | ||
}) | ||
|
||
test('warns on deprecated routes option', () => { | ||
const Component = {template: `<div></div>`} | ||
|
||
render(Component, { | ||
routes: 'anything', | ||
}) | ||
|
||
expect(console.warn).toHaveBeenCalledTimes(1) | ||
expect(console.warn).toHaveBeenCalledWith( | ||
expect.stringContaining( | ||
`Providing 'store' or 'routes' options is no longer available`, | ||
), | ||
) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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