HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/magento.bikenow.co/dev/tests/js/jasmine/tests/lib/mage/tabs.test.js
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/* eslint-disable max-nested-callbacks */
define([
    'jquery',
    'jquery/ui',
    'mage/tabs',
    'text!tests/assets/lib/web/mage/tabs.html'
], function ($, ui, tabs, tabsTmpl) {
    'use strict';

    describe('mage/tabs', function () {
        var tabsSelector = '#tabs';

        beforeEach(function () {
            var $tabs = $(tabsTmpl);

            $('body').append($tabs);
        });

        afterEach(function () {
            $(tabsSelector).remove();
            $(tabsSelector).tabs('destroy');
        });

        it('Check tabs inited', function () {
            var $tabs = $(tabsSelector).tabs();

            expect($tabs.is(':mage-tabs')).toBe(true);
        });

        it('Check tabs collapsible inited', function () {
            var $title1 = $('#title1'),
                $title2 = $('#title2');

            $(tabsSelector).tabs();

            expect($title1.is(':mage-collapsible')).toBe(true);
            expect($title2.is(':mage-collapsible')).toBe(true);
        });

        it('Check tabs active', function () {
            var $content1 = $('#content1'),
                $content2 = $('#content2');

            $(tabsSelector).tabs({
                active: 1
            });

            expect($content1.is(':hidden')).toBe(true);
            expect($content2.is(':visible')).toBe(true);
        });

        it('Check tabs closing others tabs when one gets activated', function () {
            var $title2 = $('#title2'),
                $content1 = $('#content1'),
                $content2 = $('#content2');

            $(tabsSelector).tabs();

            expect($content1.is(':visible')).toBe(true);
            expect($content2.is(':hidden')).toBe(true);

            $title2.trigger('click');

            expect($content1.is(':hidden')).toBe(true);
            expect($content2.is(':visible')).toBe(true);
        });

        it('Check tabs enable,disable,activate,deactivate options', function () {
            var $title1 = $('#title1'),
                $content1 = $('#content1'),
                $tabs = $(tabsSelector).tabs();

            expect($content1.is(':visible')).toBe(true);
            $tabs.tabs('deactivate', 0);
            expect($content1.is(':hidden')).toBe(true);
            $tabs.tabs('activate', 0);
            expect($content1.is(':visible')).toBe(true);
            $tabs.tabs('disable', 0);
            expect($content1.is(':hidden')).toBe(true);
            $title1.trigger('click');
            expect($content1.is(':hidden')).toBe(true);
            $tabs.tabs('enable', 0);
            expect($content1.is(':visible')).toBe(true);
            $title1.trigger('click');
            expect($content1.is(':visible')).toBe(true);
        });
    });
});