Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/magento/magento2-base/dev/tests/js/jasmine/tests/lib/mage/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/magento2-base/dev/tests/js/jasmine/tests/lib/mage/template.test.js
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

define([
    'mage/template',
    'jquery'
], function (mageTemplate, $) {
    'use strict';

    describe('mage/template', function () {
        var templateString  = 'Hello, <%= target %>',
            templateData    = {
                target: 'Magento User'
            },
            expectedString  = 'Hello, Magento User',
            templateNode    = $('<script id="hello" type="text/x-magento-template">' + templateString + '</script>');

        beforeAll(function () {
            templateNode.appendTo(document.body);
        });

        afterAll(function () {
            templateNode.remove();
        });

        it('compiles template function when only selector is passed', function () {
            var template = mageTemplate('#hello');

            expect(typeof template).toBe('function');
            expect(template(templateData)).toEqual(expectedString);
        });

        it('renders template when both selector and data are passed', function () {
            expect(mageTemplate('#hello', templateData)).toEqual(expectedString);
        });

        it('compiles template with string passed only', function () {
            var template = mageTemplate(templateString);

            expect(typeof template).toEqual('function');
            expect(template(templateData)).toEqual(expectedString);
        });

        it('renders template with string and data passed', function () {
            expect(mageTemplate(templateString, templateData)).toEqual(expectedString);
        });
    });
});

Spamworldpro Mini