Upgrade dependencies

This commit is contained in:
Pig Fang 2018-09-08 13:25:14 +08:00
parent d32d72ee4d
commit 23b360e8d7
11 changed files with 212 additions and 237 deletions

View File

@ -47,7 +47,7 @@
"@types/jest": "^23.3.1",
"@types/jquery": "^3.3.5",
"@types/listr": "^0.13.0",
"@vue/test-utils": "^1.0.0-beta.21",
"@vue/test-utils": "^1.0.0-beta.25",
"archiver": "^2.1.1",
"autoprefixer": "^9.0.1",
"babel-core": "7.0.0-bridge.0",

View File

@ -73,8 +73,7 @@ test('generate players page link', async () => {
] });
const wrapper = mount(Users);
await wrapper.vm.$nextTick();
expect(wrapper.find('[data-toggle="tooltip"]').attributes())
.toHaveProperty('href', '/admin/players?uid=1');
expect(wrapper.find('[data-toggle="tooltip"]').attributes('href')).toBe('/admin/players?uid=1');
});
test('admin option should not be displayed for super admins', async () => {
@ -235,7 +234,7 @@ test('deletion button should not be displayed for super admins', async () => {
] });
const wrapper = mount(Users);
await wrapper.vm.$nextTick();
expect(wrapper.find('.btn-danger').attributes()).toHaveProperty('disabled', 'disabled');
expect(wrapper.find('.btn-danger').attributes('disabled')).toBe('disabled');
});
test('deletion button should be displayed for admins as super admin', async () => {
@ -244,7 +243,7 @@ test('deletion button should be displayed for admins as super admin', async () =
] });
const wrapper = mount(Users);
await wrapper.vm.$nextTick();
expect(wrapper.find('.btn-danger').attributes()).not.toHaveProperty('disabled');
expect(wrapper.find('.btn-danger').attributes('disabled')).toBeNil();
});
test('deletion button should be displayed for normal users as super admin', async () => {
@ -253,7 +252,7 @@ test('deletion button should be displayed for normal users as super admin', asyn
] });
const wrapper = mount(Users);
await wrapper.vm.$nextTick();
expect(wrapper.find('.btn-danger').attributes()).not.toHaveProperty('disabled');
expect(wrapper.find('.btn-danger').attributes('disabled')).toBeNil();
});
test('deletion button should be displayed for banned users as super admin', async () => {
@ -262,7 +261,7 @@ test('deletion button should be displayed for banned users as super admin', asyn
] });
const wrapper = mount(Users);
await wrapper.vm.$nextTick();
expect(wrapper.find('.btn-danger').attributes()).not.toHaveProperty('disabled');
expect(wrapper.find('.btn-danger').attributes('disabled')).toBeNil();
});
test('deletion button should not be displayed for other admins as admin', async () => {
@ -271,7 +270,7 @@ test('deletion button should not be displayed for other admins as admin', async
] });
const wrapper = mount(Users);
await wrapper.vm.$nextTick();
expect(wrapper.find('.btn-danger').attributes()).toHaveProperty('disabled', 'disabled');
expect(wrapper.find('.btn-danger').attributes('disabled')).toBe('disabled');
});
test('deletion button should be displayed for normal users as admin', async () => {
@ -280,7 +279,7 @@ test('deletion button should be displayed for normal users as admin', async () =
] });
const wrapper = mount(Users);
await wrapper.vm.$nextTick();
expect(wrapper.find('.btn-danger').attributes()).not.toHaveProperty('disabled');
expect(wrapper.find('.btn-danger').attributes('disabled')).toBeNil();
});
test('deletion button should be displayed for banned users as admin', async () => {
@ -289,7 +288,7 @@ test('deletion button should be displayed for banned users as admin', async () =
] });
const wrapper = mount(Users);
await wrapper.vm.$nextTick();
expect(wrapper.find('.btn-danger').attributes()).not.toHaveProperty('disabled');
expect(wrapper.find('.btn-danger').attributes('disabled')).toBeNil();
});
test('change email', async () => {

View File

@ -8,7 +8,7 @@ jest.mock('@/js/notify');
test('show captcha if too many login fails', () => {
window.__bs_data__ = { tooManyFails: true };
const wrapper = mount(Login);
expect(wrapper.find('img').attributes().src).toMatch(/\/auth\/captcha\?v=\d+/);
expect(wrapper.find('img').attributes('src')).toMatch(/\/auth\/captcha\?v=\d+/);
});
test('click to refresh captcha', () => {

View File

@ -18,8 +18,7 @@ test('require player name', () => {
window.__bs_data__ = { player: true };
const wrapper = mount(Register);
expect(wrapper.findAll('[type="text"]').at(0).attributes())
.toHaveProperty('placeholder', 'auth.player-name');
expect(wrapper.findAll('[type="text"]').at(0).attributes('placeholder')).toBe('auth.player-name');
window.__bs_data__ = { player: false };
});

View File

@ -30,7 +30,7 @@ test('button for adding to closet should be disabled if not auth', () => {
},
stubs: { previewer }
});
expect(wrapper.find('.btn-primary').attributes()).toHaveProperty('disabled', 'disabled');
expect(wrapper.find('.btn-primary').attributes('disabled')).toBe('disabled');
});
test('button for adding to closet should be disabled if auth', () => {
@ -54,7 +54,7 @@ test('likes count indicator', async () => {
stubs: { previewer }
});
await wrapper.vm.$nextTick();
expect(wrapper.find('.likes').attributes().style).toContain('color: rgb(224, 53, 59)');
expect(wrapper.find('.likes').attributes('style')).toContain('color: rgb(224, 53, 59)');
expect(wrapper.find('.likes').text()).toContain('2');
});

View File

@ -12,14 +12,8 @@ test('urls', () => {
const wrapper = mount(SkinLibItem, {
propsData: { tid: 1 }
});
expect(wrapper.find('a').attributes()).toHaveProperty(
'href',
'/skinlib/show/1'
);
expect(wrapper.find('img').attributes()).toHaveProperty(
'src',
'/preview/1.png'
);
expect(wrapper.find('a').attributes('href')).toBe('/skinlib/show/1');
expect(wrapper.find('img').attributes('src')).toBe('/preview/1.png');
});
test('render basic information', () => {
@ -39,7 +33,7 @@ test('anonymous user', () => {
propsData: { anonymous: true }
});
const button = wrapper.find('.more');
expect(button.attributes().title).toBe('skinlib.anonymous');
expect(button.attributes('title')).toBe('skinlib.anonymous');
button.trigger('click');
expect(Vue.prototype.$http.post).not.toBeCalled();
});
@ -60,12 +54,12 @@ test('liked state', () => {
});
const button = wrapper.find('.like');
expect(button.attributes()).toHaveProperty('title', 'skinlib.removeFromCloset');
expect(button.classes()).toContain('liked');
expect(button.attributes('title')).toBe('skinlib.removeFromCloset');
expect(button.classes('liked')).toBeTrue();
wrapper.setProps({ liked: false });
expect(button.attributes()).toHaveProperty('title', 'skinlib.addToCloset');
expect(button.classes()).not.toContain('liked');
expect(button.attributes('title')).toBe('skinlib.addToCloset');
expect(button.classes('liked')).toBeFalse();
});
test('remove from closet', async () => {

View File

@ -66,12 +66,12 @@ test('different categories', () => {
Vue.prototype.$http.get.mockResolvedValue({});
const wrapper = mount(Closet);
expect(wrapper.findAll('.nav-tabs > li').at(0).classes()).toContain('active');
expect(wrapper.find('#skin-category').classes()).toContain('active');
expect(wrapper.findAll('.nav-tabs > li').at(0).classes('active')).toBeTrue();
expect(wrapper.find('#skin-category').classes('active')).toBeTrue();
wrapper.setData({ category: 'cape' });
expect(wrapper.findAll('.nav-tabs > li').at(1).classes()).toContain('active');
expect(wrapper.find('#cape-category').classes()).toContain('active');
expect(wrapper.findAll('.nav-tabs > li').at(1).classes('active')).toBeTrue();
expect(wrapper.find('#cape-category').classes('active')).toBeTrue();
});
test('search textures', () => {
@ -202,9 +202,8 @@ test('apply texture', async () => {
button.trigger('click');
await wrapper.vm.$nextTick();
expect(wrapper.find('input[type="radio"]').attributes()).toHaveProperty('value', '1');
expect(wrapper.find('.model-label > img').attributes())
.toHaveProperty('src', '/avatar/35/10');
expect(wrapper.find('input[type="radio"]').attributes('value')).toBe('1');
expect(wrapper.find('.model-label > img').attributes('src')).toBe('/avatar/35/10');
expect(wrapper.find('.modal-body').text()).toContain('name');
jest.runAllTimers();
});

View File

@ -17,13 +17,13 @@ function factory(opt = {}) {
test('computed values', () => {
const wrapper = mount(ClosetItem, { propsData: factory() });
expect(wrapper.find('img').attributes().src).toBe('/preview/1.png');
expect(wrapper.find('a.more').attributes().href).toBe('/skinlib/show/1');
expect(wrapper.find('img').attributes('src')).toBe('/preview/1.png');
expect(wrapper.find('a.more').attributes('href')).toBe('/skinlib/show/1');
});
test('selected item', () => {
const wrapper = mount(ClosetItem, { propsData: factory({ selected: true }) });
expect(wrapper.find('.item').classes()).toContain('item-selected');
expect(wrapper.find('.item').classes('item-selected')).toBeTrue();
});
test('click item body', () => {

View File

@ -32,7 +32,7 @@ test('players usage', async () => {
const wrapper = mount(Dashboard);
await wrapper.vm.$nextTick();
expect(wrapper.text()).toContain('3 / 15');
expect(wrapper.find('.progress-bar-aqua').attributes().style).toBe('width: 20%;');
expect(wrapper.find('.progress-bar-aqua').attributes('style')).toBe('width: 20%;');
});
test('storage usage', async () => {
@ -47,12 +47,12 @@ test('storage usage', async () => {
let wrapper = mount(Dashboard);
await wrapper.vm.$nextTick();
expect(wrapper.text()).toContain('5 / 20 KB');
expect(wrapper.find('.progress-bar-yellow').attributes().style).toBe('width: 25%;');
expect(wrapper.find('.progress-bar-yellow').attributes('style')).toBe('width: 25%;');
wrapper = mount(Dashboard);
await wrapper.vm.$nextTick();
expect(wrapper.text()).toContain('2 / 4 MB');
expect(wrapper.find('.progress-bar-yellow').attributes().style).toBe('width: 50%;');
expect(wrapper.find('.progress-bar-yellow').attributes('style')).toBe('width: 50%;');
});
test('display score', async () => {
@ -74,19 +74,19 @@ test('button `sign` state', async () => {
let wrapper = mount(Dashboard);
await wrapper.vm.$nextTick();
expect(wrapper.find('button').attributes()).not.toHaveProperty('disabled');
expect(wrapper.find('button').attributes('disabled')).toBeNil();
wrapper = mount(Dashboard);
await wrapper.vm.$nextTick();
expect(wrapper.find('button').attributes()).toHaveProperty('disabled', 'disabled');
expect(wrapper.find('button').attributes('disabled')).toBe('disabled');
wrapper = mount(Dashboard);
await wrapper.vm.$nextTick();
expect(wrapper.find('button').attributes()).not.toHaveProperty('disabled');
expect(wrapper.find('button').attributes('disabled')).toBeNil();
wrapper = mount(Dashboard);
await wrapper.vm.$nextTick();
expect(wrapper.find('button').attributes()).toHaveProperty('disabled', 'disabled');
expect(wrapper.find('button').attributes('disabled')).toBe('disabled');
});
test('remaining time', async () => {
@ -138,6 +138,6 @@ test('sign', async () => {
button.trigger('click');
await wrapper.vm.$nextTick();
expect(button.attributes()).toHaveProperty('disabled', 'disabled');
expect(button.attributes('disabled')).toBe('disabled');
expect(wrapper.text()).toContain('3 / 4 KB');
});

View File

@ -43,7 +43,7 @@ test('click to preview player', async () => {
await flushPromises();
expect(Vue.prototype.$http.get).toBeCalledWith('/skinlib/info/1');
expect(Vue.prototype.$http.get).toBeCalledWith('/skinlib/info/3');
expect(wrapper.findAll('.player').at(0).classes()).toContain('player-selected');
expect(wrapper.findAll('.player').at(0).classes('player-selected')).toBeTrue();
wrapper.find('tbody > tr:nth-child(2)').trigger('click');
await flushPromises();

364
yarn.lock

File diff suppressed because it is too large Load Diff