describe('App.vue', () => { it('matches snapshot', () => { const wrapper = shallowMount(App, { localVue, propsData: {}, store }) expect(wrapper.html()).toMatchSnapshot() }) })
test('Components - Pure Button - Simple', done => { const button = mount(PureButton, { slots: { default: '<div>Click me!</div>' } }) button.setProps({ color: 'red' }) button.vm.$on('click', () => { done() }) expect(button.html()).toContain('Click me!') expect(button.html()).toContain('b--red') button.trigger('click') })
describe('TableComponent.vue', () => { let store; // @TODO testing Vuex beforeEach(() => { store = new Vuex.Store({ modules: { payments: { namespaced: true, actions, getters: { payments: () => 100 } } } }); }); test('should render content correctly', () => { const wrapper = mount(TableComponent); console.log('wrapper: ', wrapper); expect(wrapper.html()).toMatchSnapshot(); }); test('correctly sets date format', () => { const wrapper = mount(TableComponent); expect(wrapper.vm.dateFormat).toBe("YYYY-MM-DD hh:mm:ss"); }); });
describe('App.vue', () => { it('matches snapshot', () => { const wrapper = shallowMount(App, { localVue, propsData: {}, store }) expect(wrapper.html()).toMatchSnapshot() }) })
describe('NotesEditor.vue', () => { it('matches snapshot', () => { const wrapper = shallowMount(NotesEditor, { localVue, propsData: { note: 'this is a note', }, store }) expect(wrapper.html()).toMatchSnapshot() }) })
describe('NotesPicker.vue', () => { it('matches snapshot', () => { const wrapper = shallowMount(NotesPicker, { localVue, propsData: { notes: ['note one', 'note two'] }, store }) expect(wrapper.html()).toMatchSnapshot() }) })
describe('ControlBar.vue', () => { it('matches snapshot', () => { const wrapper = shallowMount(ControlBar, { localVue, propsData: { hasChanges: false, notes: ['note one', 'note two'], }, store }) expect(wrapper.html()).toMatchSnapshot() }) })
describe('NotesEditor.vue', () => { it('matches snapshot', () => { const wrapper = shallowMount(NotesEditor, { localVue, propsData: { note: 'this is a note', }, store }) expect(wrapper.html()).toMatchSnapshot() }) })
describe('NotesPicker.vue', () => { it('matches snapshot', () => { const wrapper = shallowMount(NotesPicker, { localVue, propsData: { notes: ['note one', 'note two'] }, store }) expect(wrapper.html()).toMatchSnapshot() }) })
describe('ControlBar.vue', () => { it('matches snapshot', () => { const wrapper = shallowMount(ControlBar, { localVue, propsData: { hasChanges: false, notes: ['note one', 'note two'], }, store }) expect(wrapper.html()).toMatchSnapshot() }) })