-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1071 from seraphinandrieux/add-router-into-vue-ap…
…p-generated Add router into vue app generated
- Loading branch information
Showing
12 changed files
with
164 additions
and
17 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
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
30 changes: 30 additions & 0 deletions
30
src/main/resources/generator/client/vue/test/spec/router/Router.spec.ts.mustache
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,30 @@ | ||
import { shallowMount, VueWrapper } from '@vue/test-utils'; | ||
import { AppVue } from '@/common/primary/app'; | ||
|
||
import router from '@/router/router'; | ||
|
||
let wrapper: VueWrapper; | ||
|
||
const wrap = () => { | ||
wrapper = shallowMount(AppVue,{ | ||
router | ||
}); | ||
}; | ||
|
||
describe('Router', () => { | ||
it('Should redirect to App by default', async () => { | ||
wrap(); | ||
await router.push('/') | ||
await wrapper.vm.$nextTick() | ||
expect(wrapper.findComponent(AppVue)).toBeTruthy() | ||
}) | ||
|
||
it('Should go to AppVue', async () => { | ||
wrap(); | ||
await router.push('/app') | ||
await wrapper.vm.$nextTick() | ||
expect(wrapper.findComponent(AppVue)).toBeTruthy() | ||
}) | ||
}) |
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
5 changes: 4 additions & 1 deletion
5
src/main/resources/generator/client/vue/webapp/app/main.ts.mustache
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,4 +1,7 @@ | ||
import { createApp } from 'vue'; | ||
import App from './common/primary/app/App.vue'; | ||
// jhipster-needle-main-ts-import | ||
|
||
createApp(App).mount('#app'); | ||
const app = createApp(App); | ||
// jhipster-needle-main-ts-provider | ||
app.mount('#app'); |
21 changes: 21 additions & 0 deletions
21
src/main/resources/generator/client/vue/webapp/app/router/router.ts.mustache
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,21 @@ | ||
import { AppVue } from '@/common/primary/app'; | ||
import { createRouter, createWebHistory } from 'vue-router'; | ||
|
||
const routes = [ | ||
{ | ||
path: '/', | ||
redirect: { name: 'App' }, | ||
}, | ||
{ | ||
path: '/app', | ||
name: 'App', | ||
component: AppVue, | ||
}, | ||
]; | ||
|
||
const router = createRouter({ | ||
history: createWebHistory(), | ||
routes, | ||
}); | ||
|
||
export default router; |
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