2019-08-09 12:38:23 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2019-08-19 12:20:38 +01:00
|
|
|
import sinon from 'sinon';
|
2019-08-09 12:38:23 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
import TestList from '@/components/common/test/TestList.vue';
|
|
|
|
|
|
|
|
import { mount } from '@vue/test-utils';
|
|
|
|
|
2019-08-09 12:38:23 +01:00
|
|
|
describe('TestList.vue', () => {
|
|
|
|
it('should render list of primitive types', function () {
|
|
|
|
const wrapper = mount(TestList, {
|
|
|
|
propsData: {
|
2019-09-13 15:58:18 +01:00
|
|
|
onItemClick: sinon.stub(),
|
|
|
|
},
|
2019-08-09 12:38:23 +01:00
|
|
|
});
|
2019-08-19 12:20:38 +01:00
|
|
|
expect(wrapper).toMatchSnapshot();
|
2019-08-09 12:38:23 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should retrieve callback', function () {
|
2019-09-09 11:33:39 +01:00
|
|
|
const onPressSpy = sinon.spy();
|
2019-08-09 12:38:23 +01:00
|
|
|
|
|
|
|
const wrapper = mount(TestList, {
|
|
|
|
propsData: {
|
|
|
|
onItemClick: onPressSpy,
|
2019-09-13 15:58:18 +01:00
|
|
|
},
|
2019-08-09 12:38:23 +01:00
|
|
|
});
|
|
|
|
wrapper.find('.item-component__item').trigger('click');
|
|
|
|
expect(onPressSpy.callCount).toBe(1);
|
|
|
|
});
|
|
|
|
});
|