Skip to content

Commit

Permalink
fix(Slider): correct arrow disabled state in some case, close #1065
Browse files Browse the repository at this point in the history
  • Loading branch information
youluna committed Aug 29, 2019
1 parent 00bbfe6 commit a9b319b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/slider/slick/arrow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export default class Arrow extends Component {
}

// 下一个 index 大于总数??
if (slideCount <= slidesToShow) {
return true;
}
// if (slideCount <= slidesToShow) {
// return true;
// }

// 向前箭头:当前是第 0 个
if (type === 'prev') {
Expand Down
17 changes: 17 additions & 0 deletions test/slider/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,23 @@ describe('slider', function () {
});
});

it('should have correct disabled class for next/prev arrow', () => {
return co(function* () {
wrapper = mount(<Slider
infinite={false}
defaultActiveIndex={2}
slidesToShow={5}
>{slides}</Slider>);
yield delay(100);
assert(
wrapper.find('.next-slick-arrow.next-slick-next').at(0).hasClass('disabled')
);
assert(
!wrapper.find('.next-slick-arrow.next-slick-prev').at(0).hasClass('disabled')
);
});
});

it('should hover next/prev arrow', () => {
return co(function* () {
wrapper = mount(<Slider infinite={false}>{slides}</Slider>);
Expand Down

0 comments on commit a9b319b

Please sign in to comment.