MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/.trash/dist.1/jquery-typeahead/test/integration/anyValueType-test.js
var expect = require('chai').expect,
    jQuery = $ = require("jquery"),
    Typeahead = require('../../src/jquery.typeahead')(jQuery, window);

describe('Typeahead can display any value type Tests', function () {
    'use strict';

    let myTypeahead;

    before(function () {

        document.write('<input class="js-typeahead-any-value-type">');

        myTypeahead = $.typeahead({
            input: '.js-typeahead-any-value-type',
            minLength: 0,
            generateOnLoad: true,
            display: ['string','numeric', 'booleanT', 'booleanF', 'undefined', 'deeper.key.level'],
            source: {
                data: [{
                    string: 'string',
                    numeric: 12345,
                    booleanT: true,
                    booleanF: false,
                    deeper: {
                        key: {
                            level: 42
                        }
                    }
                }]
            }
        });
    });

    it('Should display any value types', function () {
        myTypeahead.node.trigger('input.typeahead');

        expect(myTypeahead.resultHtml.find('span').text()).to.equal('string 12345 true false 42');
    });

    it('Should display a boolean "false" search', function () {
        myTypeahead.node.val('false');
        myTypeahead.node.trigger('input.typeahead');

        expect(myTypeahead.result.length).to.equal(1);
    });

    it('Should display a numeric value', function () {
        myTypeahead.node.val('345');
        myTypeahead.node.trigger('input.typeahead');

        expect(myTypeahead.result.length).to.equal(1);
    });
});