Skip to content

Commit

Permalink
Merge 7a2e387 into 510034d
Browse files Browse the repository at this point in the history
  • Loading branch information
baiyaaaaa committed Oct 19, 2016
2 parents 510034d + 7a2e387 commit cbfa51a
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions test/unit/specs/button.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { createTest } from '../util';
import Button from 'packages/button';

describe('Button', () => {
it('create', () => {
const vm = createTest(Button, {
type: 'primary'
}, true);
let buttonElm = vm.$el;
expect(buttonElm.classList.contains('el-button-primary')).to.be.true;
});
it('icon', () => {
const vm = createTest(Button, {
icon: 'search'
}, true);
let buttonElm = vm.$el;
expect(buttonElm.querySelector('.el-icon-search')).to.be.ok;
});
it('nativeType', () => {
const vm = createTest(Button, {
nativeType: 'submit'
}, true);
let buttonElm = vm.$el;
expect(buttonElm.getAttribute('type')).to.be.equal('submit');
});
it('loading', () => {
const vm = createTest(Button, {
loading: true
}, true);
let buttonElm = vm.$el;
expect(buttonElm.classList.contains('is-loading')).to.be.true;
expect(buttonElm.querySelector('.el-icon-loading')).to.be.ok;
});
it('disabled', () => {
const vm = createTest(Button, {
disabled: true
}, true);
let buttonElm = vm.$el;
expect(buttonElm.classList.contains('is-disabled')).to.be.true;
});
it('size', () => {
const vm = createTest(Button, {
size: 'large'
}, true);
let buttonElm = vm.$el;
expect(buttonElm.classList.contains('el-button-large')).to.be.true;
});
it('plain', () => {
const vm = createTest(Button, {
plain: true
}, true);
let buttonElm = vm.$el;
expect(buttonElm.classList.contains('is-plain')).to.be.true;
});
});

0 comments on commit cbfa51a

Please sign in to comment.