<commit_before>import Vue from 'vue';
import '../../utils/polyfills';
import NavBarItemPlugin, { MNavBarItem } from './nav-bar-item';

const SELECTED_CSS: string = 'm--is-selected';

let navbaritem: MNavBarItem;

describe('navbar-item', () => {
    beforeEach(() => {
        Vue.use(NavBarItemPlugin);
        navbaritem = new MNavBarItem().$mount();
    });

    it('skin prop', () => {
        expect(navbaritem.$el.classList.contains(SELECTED_CSS)).toBeFalsy();

        navbaritem.selected = true;
        Vue.nextTick(() => {
            expect(navbaritem.$el.classList.contains(SELECTED_CSS)).toBeTruthy();

            navbaritem.selected = false;
            Vue.nextTick(() => {
                expect(navbaritem.$el.classList.contains(SELECTED_CSS)).toBeFalsy();
            });
        });
    });

    it('click event', () => {
        let clickSpy = jasmine.createSpy('clickSpy');
        let vm = new Vue({
            template: `
                <m-nav-bar-item @click="onClick($event)"></m-nav-bar-item><commit_msg>Change test name in nav-bar-item<commit_after>import Vue from 'vue';
import '../../utils/polyfills';
import NavBarItemPlugin, { MNavBarItem } from './nav-bar-item';

const SELECTED_CSS: string = 'm--is-selected';

let navbaritem: MNavBarItem;

describe('navbar-item', () => {
    beforeEach(() => {
        Vue.use(NavBarItemPlugin);
        navbaritem = new MNavBarItem().$mount();
    });

    it('selected prop', () => {
        expect(navbaritem.$el.classList.contains(SELECTED_CSS)).toBeFalsy();

        navbaritem.selected = true;
        Vue.nextTick(() => {
            expect(navbaritem.$el.classList.contains(SELECTED_CSS)).toBeTruthy();

            navbaritem.selected = false;
            Vue.nextTick(() => {
                expect(navbaritem.$el.classList.contains(SELECTED_CSS)).toBeFalsy();
            });
        });
    });

    it('click event', () => {
        let clickSpy = jasmine.createSpy('clickSpy');
        let vm = new Vue({
            template: `
                <m-nav-bar-item @click="onClick($event)"></m-nav-bar-item>
{'fraction_non_alphanumeric': 0.17345471969333973, 'fraction_numerical': 0.0, 'mean_word_length': 2.462686567164179, 'pattern_counts': {'":': 0, '<': 7, '<?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': '122929', 'n_tokens_mistral': 672, 'n_tokens_neox': 637, 'n_words': 97}