|
@@ -76,28 +76,52 @@ describe('Radio', () => {
|
|
|
});
|
|
|
}, 50);
|
|
|
});
|
|
|
- it('radio button', done => {
|
|
|
- vm = createVue({
|
|
|
- template: `
|
|
|
- <el-radio-group v-model="radio">
|
|
|
- <el-radio-button :label="3" ref="radio1">备选项</el-radio-button>
|
|
|
- <el-radio-button :label="6" ref="radio2">备选项</el-radio-button>
|
|
|
- <el-radio-button :label="9">备选项</el-radio-button>
|
|
|
- </el-radio-group>
|
|
|
- `,
|
|
|
- data() {
|
|
|
- return {
|
|
|
- radio: 3
|
|
|
- };
|
|
|
- }
|
|
|
- }, true);
|
|
|
- expect(vm.$refs.radio1.$el.classList.contains('is-active')).to.be.true;
|
|
|
- let radio = vm.$refs.radio2;
|
|
|
- radio.$el.click();
|
|
|
- vm.$nextTick(_ => {
|
|
|
- expect(radio.$el.classList.contains('is-active')).to.be.true;
|
|
|
- expect(vm.radio === 6).to.be.true;
|
|
|
- done();
|
|
|
+ describe('Radio', () => {
|
|
|
+ it('create', done => {
|
|
|
+ vm = createVue({
|
|
|
+ template: `
|
|
|
+ <el-radio-group v-model="radio">
|
|
|
+ <el-radio-button :label="3" ref="radio1">备选项</el-radio-button>
|
|
|
+ <el-radio-button :label="6" ref="radio2">备选项</el-radio-button>
|
|
|
+ <el-radio-button :label="9">备选项</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ `,
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ radio: 3
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }, true);
|
|
|
+ expect(vm.$refs.radio1.$el.classList.contains('is-active')).to.be.true;
|
|
|
+ let radio = vm.$refs.radio2;
|
|
|
+ radio.$el.click();
|
|
|
+ vm.$nextTick(_ => {
|
|
|
+ expect(radio.$el.classList.contains('is-active')).to.be.true;
|
|
|
+ expect(vm.radio === 6).to.be.true;
|
|
|
+ done();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ it('custom color', done => {
|
|
|
+ vm = createVue({
|
|
|
+ template: `
|
|
|
+ <el-radio-group v-model="radio" fill="#000" text-color="#ff0">
|
|
|
+ <el-radio-button :label="3" ref="radio1">备选项</el-radio-button>
|
|
|
+ <el-radio-button :label="6" ref="radio2">备选项</el-radio-button>
|
|
|
+ <el-radio-button :label="9">备选项</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ `,
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ radio: 3
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }, true);
|
|
|
+ vm.$nextTick(_ => {
|
|
|
+ expect(vm.$refs.radio1.activeStyle.backgroundColor).to.equal('#000');
|
|
|
+ expect(vm.$refs.radio1.activeStyle.borderColor).to.equal('#000');
|
|
|
+ expect(vm.$refs.radio1.activeStyle.color).to.equal('#ff0');
|
|
|
+ done();
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
});
|