{"size": 1518, "ext": "js", "max_stars_repo_path": "src/lib/miscellaneous/__tests__/Mouseable.test.js", "max_stars_repo_name": "dzervoudakes/GrindstoneJS", "max_stars_repo_stars_event_min_datetime": "2016-03-09T12:37:41.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-13T06:42:29.000Z", "max_issues_repo_path": "src/lib/miscellaneous/__tests__/Mouseable.test.js", "max_issues_repo_name": "DanZiti/GrindstoneJS", "max_issues_repo_issues_event_min_datetime": "2017-02-19T09:16:23.000Z", "max_issues_repo_issues_event_max_datetime": "2018-11-16T02:05:32.000Z", "max_forks_repo_path": "src/lib/miscellaneous/__tests__/Mouseable.test.js", "max_forks_repo_name": "DanZiti/GrindstoneJS", "max_forks_repo_forks_event_min_datetime": "2017-02-12T00:49:33.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-16T02:03:08.000Z"}
{"max_stars_count": 8, "max_issues_count": 6, "max_forks_count": 3, "avg_line_length": 33.0, "max_line_length": 97, "alphanum_fraction": 0.6146245059}
const { setupTests } = global;
setupTests('mouseable', 'miscellaneous/modules/Mouseable');

describe('mouseable()', () => {
  const classes = {
    hoverClass: 'hover',
    activeClass: 'active'
  };

  it('applies the hover class', () => {
    $('#jest-mouseable').mouseable(classes);
    $('#jest-mouseable').trigger('mouseenter');
    expect($('#jest-mouseable').hasClass('hover')).toBe(true);
  });

  it('removes the hover class', () => {
    $('#jest-mouseable').mouseable(classes);
    $('#jest-mouseable').trigger('mouseleave');
    expect($('#jest-mouseable').hasClass('hover')).toBe(false);
  });

  it('applies the active class', () => {
    $('#jest-mouseable').mouseable(classes);
    $('#jest-mouseable').trigger('mousedown');
    expect($('#jest-mouseable').hasClass('active')).toBe(true);
  });

  it('removes the active class', () => {
    $('#jest-mouseable').mouseable(classes);
    $('#jest-mouseable').trigger('mouseup');
    expect($('#jest-mouseable').hasClass('active')).toBe(false);
  });

  it('applies the default hover and active classes when the properties are not provided', () => {
    $('#jest-mouseable').mouseable({});
    $('#jest-mouseable').trigger('mouseenter');
    expect($('#jest-mouseable').hasClass('over')).toBe(true);
  });

  it('applies the default hover and active classes when no argument is provided', () => {
    $('#jest-mouseable').mouseable();
    $('#jest-mouseable').trigger('mouseenter');
    expect($('#jest-mouseable').hasClass('over')).toBe(true);
  });
});
