<commit_before>import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

const template = hbs`
    {{#sl-tab-panel}}
        {{#sl-tab-pane label="A" name="a"}}A content{{/sl-tab-pane}}
        {{#sl-tab-pane label="B" name="b"}}B content{{/sl-tab-pane}}
        {{#sl-tab-pane label="C" name="c"}}C content{{/sl-tab-pane}}
    {{/sl-tab-panel}}
`;

moduleForComponent( 'sl-tab-panel', 'Integration | Component | sl tab panel', {
    integration: true
});

test( 'Default rendered state', function( assert ) {
    this.render( template );

    const wrapper = this.$( '>:first-child' );

    assert.ok(
        wrapper.hasClass( 'sl-ember-components-tab-panel' ),
        'Has class "sl-ember-components-tab-panel"'
    );

    assert.ok(
        wrapper.hasClass( 'sl-align-tabs-left' ),
        'Has class "sl-align-tabs-left"'
    );

    assert.strictEqual(
        wrapper.find( '.nav-tabs[role="tablist"]' ).length,
        1,
        'Rendered component has "tablist" ARIA role'
    );

    assert.ok(
        wrapper.find( ' > ul > li:first-of-type' ).hasClass( 'active' ),
        'First tab has class "active"'
    );

    assert.strictEqual(
        wrapper.find( '> ul > li a[role="tab"]' ).length,
        3,
        'Rendered component has three <a> with "tab" ARIA role'
    );

    const labels = [];

    wrapper.find( '> ul > li[data-tab-name]' ).each( function() {
        labels.push( Ember.$( this ).attr( 'data-tab-name' ) );
    });

    assert.deepEqual(
        labels,
        [ 'a', 'b', 'c' ],
        'Tabs display in expected order'
    );
});

test( 'setupTabs() sets up tabs correctly', function( assert ) {<commit_msg>added assertion for first active tab pane<commit_after>import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

const template = hbs`
    {{#sl-tab-panel}}
        {{#sl-tab-pane label="A" name="a"}}A content{{/sl-tab-pane}}
        {{#sl-tab-pane label="B" name="b"}}B content{{/sl-tab-pane}}
        {{#sl-tab-pane label="C" name="c"}}C content{{/sl-tab-pane}}
    {{/sl-tab-panel}}
`;

moduleForComponent( 'sl-tab-panel', 'Integration | Component | sl tab panel', {
    integration: true
});

test( 'Default rendered state', function( assert ) {
    this.render( template );

    const wrapper = this.$( '>:first-child' );

    assert.ok(
        wrapper.hasClass( 'sl-ember-components-tab-panel' ),
        'Has class "sl-ember-components-tab-panel"'
    );

    assert.ok(
        wrapper.hasClass( 'sl-align-tabs-left' ),
        'Has class "sl-align-tabs-left"'
    );

    assert.strictEqual(
        wrapper.find( '.nav-tabs[role="tablist"]' ).length,
        1,
        'Rendered component has "tablist" ARIA role'
    );

    assert.ok(
        wrapper.find( ' > ul > li:first-of-type' ).hasClass( 'active' ),
        'First tab has class "active"'
    );

    assert.ok(
        wrapper.find( '.tab-pane[data-tab-name="a"]' ),
        'First tab pane has class "active"'
    );

    assert.strictEqual(
        wrapper.find( '> ul > li a[role="tab"]' ).length,
        3,
        'Rendered component has three <a> with "tab" ARIA role'
    );

    const labels = [];

    wrapper.find( '> ul > li[data-tab-name]' ).each( function() {
        labels.push( Ember.$( this ).attr( 'data-tab-name' ) );
    });

    assert.deepEqual(
        labels,
        [ 'a', 'b', 'c' ],
        'Tabs display in expected order'
    );
});

test( 'setupTabs() sets up tabs correctly', function( assert ) {
{'fraction_non_alphanumeric': 0.1820961912705032, 'fraction_numerical': 0.0011120378092855157, 'mean_word_length': 2.537856440511308, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3012017', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1212, 'n_words': 277}