Preview player automatically if user has only one player (fix #46)
This commit is contained in:
parent
7dc59cf444
commit
72780a6217
|
|
@ -191,8 +191,11 @@ export default {
|
|||
},
|
||||
}
|
||||
},
|
||||
beforeMount() {
|
||||
this.fetchPlayers()
|
||||
async beforeMount() {
|
||||
await this.fetchPlayers()
|
||||
if (this.players.length === 1) {
|
||||
this.preview(this.players[0])
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async fetchPlayers() {
|
||||
|
|
|
|||
|
|
@ -18,10 +18,21 @@ test('display player name constraints', () => {
|
|||
expect(text).toContain('length')
|
||||
})
|
||||
|
||||
test('fetch players data before mount', () => {
|
||||
Vue.prototype.$http.get.mockResolvedValue({ data: [] })
|
||||
test('fetch players data before mount', async () => {
|
||||
Vue.prototype.$http.get
|
||||
.mockResolvedValueOnce({ data: [] })
|
||||
.mockResolvedValueOnce({
|
||||
data: [{
|
||||
pid: 1, tid_skin: 1, tid_cape: 0,
|
||||
}],
|
||||
})
|
||||
.mockResolvedValueOnce({ data: {} })
|
||||
mount(Players)
|
||||
expect(Vue.prototype.$http.get).toBeCalledWith('/user/player/list')
|
||||
|
||||
mount(Players)
|
||||
await flushPromises()
|
||||
expect(Vue.prototype.$http.get).toBeCalledWith('/skinlib/info/1')
|
||||
})
|
||||
|
||||
test('click to preview player', async () => {
|
||||
|
|
@ -158,13 +169,16 @@ test('add player', async () => {
|
|||
|
||||
test('clear texture', async () => {
|
||||
window.$ = jest.fn(() => ({ modal() {} }))
|
||||
Vue.prototype.$http.get.mockResolvedValueOnce({
|
||||
data: [
|
||||
{
|
||||
pid: 1, tid_skin: 1, tid_cape: 0,
|
||||
},
|
||||
],
|
||||
})
|
||||
Vue.prototype.$http.get
|
||||
.mockResolvedValueOnce({
|
||||
data: [
|
||||
{
|
||||
pid: 1, tid_skin: 1, tid_cape: 0,
|
||||
},
|
||||
],
|
||||
})
|
||||
.mockResolvedValueOnce({ data: {} })
|
||||
.mockResolvedValueOnce({ data: {} })
|
||||
Vue.prototype.$http.post
|
||||
.mockResolvedValueOnce({ code: 1 })
|
||||
.mockResolvedValue({ code: 0, message: 'ok' })
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@
|
|||
- Chart at administration panel will show today's data.
|
||||
- New event for plugins: `TextureDeleting`.
|
||||
|
||||
## Tweaked
|
||||
|
||||
- Preview the player automatically if a user has only one player.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fixed resetting options of "Customize" page.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@
|
|||
- 管理面板中的图表可显示当天的数据
|
||||
- 新的插件事件:`TextureDeleting`
|
||||
|
||||
## 调整
|
||||
|
||||
- 当用户只有一个角色时,角色页面会自动预览该角色
|
||||
|
||||
## 修复
|
||||
|
||||
- 修复「个性化」页面不能重置选项的问题
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user