-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtest.js
26 lines (22 loc) · 793 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import Vue from 'vue';
import VueLadda from './src/vue-ladda.vue';
describe('VueLadda', () => {
const Ctor = Vue.extend(VueLadda);
it('require given "loading" prop', () => {
spyOn(console, 'error').andCallFake((msg) => {
expect(msg.startsWith('[Vue warn]: Missing required prop: "loading"')).toBeTruthy();
})
const vm = new Ctor().$mount();
})
it('sets the correct default data', () => {
const vm = new Ctor().$mount();
expect(vm.buttonClass).toBe('ladda-button');
expect(vm.dataStyle).toBe('expand-left');
expect(vm.progress).toBe(0);
});
it('test custom button class', () => {
let bsClasses = 'btn btn-primary'
const vm = new Ctor({propsData: {buttonClass: bsClasses}}).$mount();
expect(vm.buttonClass).toBe(bsClasses)
});
});