2016-04-19 18:55:10 +03:00
|
|
|
import {
|
2017-09-11 10:56:11 +03:00
|
|
|
describe,
|
|
|
|
it
|
2016-04-19 18:55:10 +03:00
|
|
|
} from 'mocha';
|
2017-05-29 21:50:03 +03:00
|
|
|
import {expect} from 'chai';
|
2016-04-19 18:55:10 +03:00
|
|
|
import {
|
2017-09-11 10:56:11 +03:00
|
|
|
highlightedText
|
2016-05-24 15:06:59 +03:00
|
|
|
} from 'ghost-admin/helpers/highlighted-text';
|
2016-04-19 18:55:10 +03:00
|
|
|
|
2018-01-05 18:38:23 +03:00
|
|
|
describe('Unit: Helper: highlighted-text', function () {
|
|
|
|
it('works', function () {
|
2016-04-19 18:55:10 +03:00
|
|
|
let result = highlightedText(['Test', 'e']);
|
|
|
|
expect(result).to.be.an('object');
|
|
|
|
expect(result.string).to.equal('T<span class="highlight">e</span>st');
|
|
|
|
});
|
2023-05-11 00:53:05 +03:00
|
|
|
|
|
|
|
it('escapes html', function () {
|
|
|
|
let result = highlightedText(['<script>alert("oops")</script>', 'oops']);
|
|
|
|
expect(result).to.be.an('object');
|
|
|
|
expect(result.string).to.equal('<script>alert("<span class="highlight">oops</span>")</script>');
|
|
|
|
});
|
2016-04-19 18:55:10 +03:00
|
|
|
});
|