Skip to content

Commit

Permalink
Rate: Fix decimal display support in disabled mode (ElemeFE#15089)
Browse files Browse the repository at this point in the history
  • Loading branch information
haoranyu authored and ziyoung committed Apr 17, 2019
1 parent f02a849 commit f19b9f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions packages/rate/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@
decimalStyle() {
let width = '';
if (this.rateDisabled) {
width = `${ this.valueDecimal < 50 ? 0 : 50 }%`;
}
if (this.allowHalf) {
width = `${ this.valueDecimal }%`;
} else if (this.allowHalf) {
width = '50%';
}
return {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/rate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('Rate', () => {

const fourthStar = vm2.$el.querySelectorAll('.el-rate__item')[3];
const halfStar = fourthStar.querySelector('.el-rate__decimal');
expect(halfStar.style.width).to.equal('0%');
expect(halfStar.style.width).to.equal('40%');
});

it('allow half', () => {
Expand Down

0 comments on commit f19b9f1

Please sign in to comment.