{"size": 3564, "ext": "js", "max_stars_repo_path": "tests/integration/components/bs-tab/pane-test.js", "max_stars_repo_name": "lougreenwood/ember-bootstrap", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tests/integration/components/bs-tab/pane-test.js", "max_issues_repo_name": "lougreenwood/ember-bootstrap", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/integration/components/bs-tab/pane-test.js", "max_forks_repo_name": "lougreenwood/ember-bootstrap", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 43.4634146341, "max_line_length": 117, "alphanum_fraction": 0.6801346801}
import { module } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, settled } from '@ember/test-helpers';
import {
  test,
  testRequiringTransitions,
  visibilityClass
} from '../../../helpers/bootstrap-test';
import hbs from 'htmlbars-inline-precompile';
import setupNoDeprecations from '../../../helpers/setup-no-deprecations';

module('Integration | Component | bs-tab/pane', function(hooks) {
  setupRenderingTest(hooks);
  setupNoDeprecations(hooks);

  test('it has correct markup', async function(assert) {
    await render(hbs`
      {{#bs-tab/pane fade=true activeId="pane1" elementId="pane1"}}
        template block text
      {{/bs-tab/pane}}
    `);

    assert.dom('*').hasText('template block text', 'Shows block content');
    assert.dom('div.tab-pane').exists({ count: 1 }, 'has tab-pane class');
    assert.dom('div.tab-pane').hasClass('active', 'tab-pane has active class');
    assert.dom('div.tab-pane').hasClass(visibilityClass(), 'tab-pane has visibility class');
  });

  test('it has correct markup when switching active pane and fade=false', async function(assert) {
    this.set('activeId', null);
    await render(hbs`
      {{#bs-tab/pane fade=false activeId=activeId elementId="pane1"}}
        template block text
      {{/bs-tab/pane}}
    `);

    assert.dom('div.tab-pane').hasNoClass('fade', 'tab-pane does not have fade class');

    assert.dom('div.tab-pane').hasNoClass('active', 'tab-pane does not have active class');
    assert.dom('div.tab-pane').hasNoClass(visibilityClass(), 'tab-pane does not have visibility class');

    this.set('activeId', 'pane1');
    assert.dom('div.tab-pane').hasClass('active', 'tab-pane has active class');
    assert.dom('div.tab-pane').hasNoClass(visibilityClass(), 'tab-pane does not have visibility class');

    this.set('activeId', null);
    assert.dom('div.tab-pane').hasNoClass('active', 'tab-pane does not have active class');
    assert.dom('div.tab-pane').hasNoClass(visibilityClass(), 'tab-pane does not have visibility class');
  });

  testRequiringTransitions('it has correct markup when switching active pane and fade=true', async function(assert) {
    this.set('activeId', null);
    await render(hbs`
      {{#bs-tab/pane fade=true activeId=activeId elementId="pane1"}}
        template block text
      {{/bs-tab/pane}}
    `);

    assert.dom('div.tab-pane').hasClass('fade', 'tab-pane has fade class');
    assert.dom('div.tab-pane').hasNoClass('active', 'tab-pane does not have active class');
    assert.dom('div.tab-pane').hasNoClass(visibilityClass(), 'tab-pane does not have visibility class');

    this.set('activeId', 'pane1');
    assert.dom('div.tab-pane').hasNoClass('active', 'tab-pane does not have active class');
    assert.dom('div.tab-pane').hasNoClass(visibilityClass(), 'tab-pane does not have visibility class');

    // wait for fade animation
    await settled();
    assert.dom('div.tab-pane').hasClass('active', 'tab-pane has active class');
    assert.dom('div.tab-pane').hasClass(visibilityClass(), 'tab-pane has visibility class');

    this.set('activeId', null);
    assert.dom('div.tab-pane').hasClass('active', 'tab-pane has active class');
    assert.dom('div.tab-pane').hasNoClass(visibilityClass(), 'tab-pane does not have visibility class');

    // wait for fade animation
    await settled();
    assert.dom('div.tab-pane').hasNoClass('active', 'tab-pane does not have active class');
    assert.dom('div.tab-pane').hasNoClass(visibilityClass(), 'tab-pane does not have visibility class');
  });
});
