UNPKG

@ministryofjustice/probation-search-frontend

Version:

A shared UI component to search for probation cases from within your Express/Nunjucks application

24 lines 1.15 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const highlighting_1 = __importDefault(require("./highlighting")); describe('highlightText', () => { it.each([ [undefined, undefined, undefined], [undefined, 'undefined', undefined], ['Hello world', undefined, 'Hello world'], ['Hello world', 'world', 'Hello <span class="govuk-tag--yellow">world</span>'], ['Hello world', 'hello', '<span class="govuk-tag--yellow">Hello</span> world'], [ 'Hello world', 'hello world', '<span class="govuk-tag--yellow">Hello</span> <span class="govuk-tag--yellow">world</span>', ], ['Hello world)', 'world)', 'Hello <span class="govuk-tag--yellow">world)</span>'], ])('should highlight text correctly', (textToHighlight, query, expected) => { expect((0, highlighting_1.default)(query)(textToHighlight, true)).toEqual(expected); }); }); //# sourceMappingURL=highlighting.test.js.map