-
-
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.
- Loading branch information
1 parent
953a03b
commit d8be43b
Showing
22 changed files
with
18,661 additions
and
20 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
48 changes: 48 additions & 0 deletions
48
src/main/java/tech/jhipster/lite/generator/client/vue/core/domain/Vue.java
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
30 changes: 30 additions & 0 deletions
30
...in/resources/generator/client/vue/test/spec/common/primary/button/Button.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 {ButtonVue} from "@/common/primary/button"; | ||
import {createTestingPinia} from "@pinia/testing"; | ||
import {useCounterStore} from "@/common/primary/store/CounterStore"; | ||
|
||
let wrapper: VueWrapper; | ||
const wrap = () => { | ||
wrapper = shallowMount(ButtonVue,{ | ||
global:{ | ||
plugins:[createTestingPinia()] | ||
} | ||
}); | ||
}; | ||
|
||
describe('Button',()=>{ | ||
it('should exist', () => { | ||
wrap(); | ||
expect(wrapper.exists()).toBeTruthy(); | ||
}); | ||
|
||
it('should get counter value from store', async () => { | ||
await wrap(); | ||
const store = useCounterStore(); | ||
expect(wrapper.text()).toEqual("Store Button 0"); | ||
const button = wrapper.find('button'); | ||
await button.trigger('click'); | ||
expect(store.increment).toHaveBeenCalledTimes(1); | ||
}); | ||
}) |
19 changes: 19 additions & 0 deletions
19
...sources/generator/client/vue/test/spec/common/primary/store/CounterStore.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,19 @@ | ||
import {createPinia, setActivePinia} from "pinia"; | ||
import {useCounterStore} from "@/common/primary/store/CounterStore"; | ||
|
||
describe("Counter store",()=>{ | ||
beforeEach(() => { | ||
setActivePinia(createPinia()) | ||
}) | ||
|
||
it('Should initialize counter store to 0', () => { | ||
const counter = useCounterStore() | ||
expect(counter.count).toBe(0) | ||
}) | ||
|
||
it('Should increment counter', () => { | ||
const counter = useCounterStore() | ||
counter.increment(); | ||
expect(counter.count).toBe(1) | ||
}) | ||
}) |
21 changes: 21 additions & 0 deletions
21
...ources/generator/client/vue/webapp/app/common/primary/button/Button.component.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 {useCounterStore} from "@/common/primary/store/CounterStore"; | ||
|
||
export default { | ||
name: 'Button', | ||
setup: () => { | ||
const counter = useCounterStore(); | ||
const increment = (): void => { | ||
counter.increment(); | ||
} | ||
|
||
const counterValue = (): number =>{ | ||
return counter.count; | ||
} | ||
|
||
return { | ||
increment, | ||
counterValue | ||
}; | ||
}, | ||
}; |
5 changes: 5 additions & 0 deletions
5
...main/resources/generator/client/vue/webapp/app/common/primary/button/Button.html.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,5 @@ | ||
<div> | ||
<button id="counter" @click.prevent="increment"> | ||
Store Button {{=<% %>=}}{{ counterValue() }}<%={{ }}=%> | ||
</button> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
src/main/resources/generator/client/vue/webapp/app/common/primary/button/Button.vue.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,3 @@ | ||
<template src="./Button.html"></template> | ||
|
||
<script lang="ts" src="./Button.component.ts"></script> |
4 changes: 4 additions & 0 deletions
4
src/main/resources/generator/client/vue/webapp/app/common/primary/button/index.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,4 @@ | ||
import ButtonComponent from './Button.component'; | ||
import ButtonVue from './Button.vue'; | ||
|
||
export { ButtonComponent, ButtonVue }; |
15 changes: 15 additions & 0 deletions
15
...n/resources/generator/client/vue/webapp/app/common/primary/store/CounterStore.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,15 @@ | ||
import {defineStore} from "pinia"; | ||
|
||
export const useCounterStore = defineStore('counter', { | ||
state: () => ({ | ||
count: 0, | ||
}), | ||
actions: { | ||
increment() { | ||
this.count++ | ||
}, | ||
}, | ||
persist: { | ||
enabled: true | ||
} | ||
}) |
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
Oops, something went wrong.