Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/microsoft/fluentui into u…
Browse files Browse the repository at this point in the history
…sers/khamu/switch-label-indicator-hc
  • Loading branch information
khamudom committed Dec 2, 2020
2 parents 3e7be46 + f4a9623 commit 92500e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/fluentui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Fix `Dropdown` to not break new lines for button trigger after listbox was introduced wrapping selected items @assuncaocharles ([#15898](https://github.com/microsoft/fluentui/pull/15898))
- Fix `Input` content overlaping with `Icon` @assuncaocharles ([#16083](https://github.com/microsoft/fluentui/pull/16083))
- Fix `variables` not being propagated in `Carousel` @assuncaocharles ([#16084](https://github.com/microsoft/fluentui/pull/16084))
- Fix `Carousel` `onActiveIndexChange` to contain `activeIndex` @assuncaocharles ([#16118](https://github.com/microsoft/fluentui/pull/16118))

### Features
- `Tree`: added `useTree` hook @yuanboxue-amber ([#15831](https://github.com/microsoft/fluentui/pull/15831))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export const Carousel: ComponentWithAs<'div', CarouselProps> &

actions.setIndexes(nextActiveIndex, lastActiveIndex);

_.invoke(props, 'onActiveIndexChange', e, props);
_.invoke(props, 'onActiveIndexChange', e, { ...props, activeIndex: index });

if (focusItem) {
focusItemAtIndex(nextActiveIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ describe('Carousel', () => {
expect(pagination.getDOMNode().textContent).toBe(`2 of ${items.length}`);
});

it('should pass activeIndex onActiveIndexChange', () => {
const onActiveIndexChange = jest.fn();
const wrapper = renderCarousel({ onActiveIndexChange });
const paddleNext = getPaddleNextWrapper(wrapper);

paddleNext.simulate('click');

expect(onActiveIndexChange).toHaveBeenCalledWith(
expect.objectContaining({ type: 'click' }),
expect.objectContaining({ activeIndex: 1 }),
);
});

it('should decrese at paddle previous press', () => {
const wrapper = renderCarousel({ defaultActiveIndex: 3 });
const paddlePrevious = getPaddlePreviousWrapper(wrapper);
Expand Down

0 comments on commit 92500e8

Please sign in to comment.