Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX - updates to arrow key navigation handler to work in IE/Edge. … #201

Merged
merged 2 commits into from
Dec 1, 2017

Conversation

jzeltman
Copy link
Contributor

@jzeltman jzeltman commented Dec 1, 2017

Changed match from e.key => e.keyCode. Updated Carousel tests to account for new methods.

There are two tests that fail, but they were failing in the existing repo as well.

…Changed match from e.key => e.keyCode. Updated Carousel tests to account for new methods. There are two tests that fail, but they were failing in the existing repo as well.
@leandrowd
Copy link
Owner

Hey @jzeltman, which 2 tests are failing for you? I just tried and everything passes here.

Test Suites: 1 passed, 1 total
Tests:       92 passed, 92 total
Snapshots:   10 passed, 10 total
Time:        5.633s

@@ -225,12 +225,12 @@ class Carousel extends Component {
const { axis } = this.props;
const isHorizontal = axis === 'horizontal';

const nextKey = isHorizontal ? 'ArrowRight' : 'ArrowDown';
const prevKey = isHorizontal ? 'ArrowLeft' : 'ArrowUp';
const nextKey = isHorizontal ? 39 : 40;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create a map to identify these numbers with a readable name?

example:

const keyNames = {
    ArrowRight: 39,
    ArrowDown: 40 
};

const nextKey = isHorizontal ? keyNames.ArrowRight : keyNames.ArrowDown;


expect(componentInstance.increment.mock.calls.length).toBe(1);
expect(componentInstance.decrement.mock.calls.length).toBe(0);
});

it('should call only decrement on ArrowUp', () => {
componentInstance.navigateWithKeyboard({key: 'ArrowUp'});
it('should call only decrement on 38', () => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, keep the tests descriptions as "should call only decrement on ArrowUp (38)"... Much easier to understand.

@leandrowd leandrowd merged commit 5100752 into leandrowd:master Dec 1, 2017
@leandrowd
Copy link
Owner

Thanks @jzeltman, it was published to npm as 3.1.30

@leandrowd
Copy link
Owner

This fixes #200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants