Renamed sodo search identification attribute

refs https://github.com/TryGhost/Team/issues/1665

- The search script should be uniquiely identifiable in DOM. Previously element for portal scipt element and search element both had `data-ghost` attributes` for identification. Having `data-sodo-search` makes naming unique
This commit is contained in:
Naz 2022-07-04 16:09:09 +02:00
parent f6b2a83761
commit b996eadbd4
2 changed files with 3 additions and 3 deletions

View File

@ -62,7 +62,7 @@ function getSearchHelper(frontendKey) {
return '';
}
let helper = `<script defer src="${config.get('sodoSearch:url')}" data-ghost="${urlUtils.getSiteUrl()}" data-key="${frontendKey}" data-api="${urlUtils.urlFor('api', {type: 'content'}, true)}" crossorigin="anonymous"></script>`;
let helper = `<script defer src="${config.get('sodoSearch:url')}" data-sodo-search="${urlUtils.getSiteUrl()}" data-key="${frontendKey}" data-api="${urlUtils.urlFor('api', {type: 'content'}, true)}" crossorigin="anonymous"></script>`;
return helper;
}

View File

@ -1739,7 +1739,7 @@ describe('{{ghost_head}} helper', function () {
describe('search scripts', function () {
it('includes search when labs flag enabled', function (done) {
labsStub = sinon.stub(labs, 'isSet').returns(true);
sinon.stub(labs, 'isSet').returns(true);
ghost_head(testUtils.createHbsResponse({
locals: {
@ -1750,7 +1750,7 @@ describe('{{ghost_head}} helper', function () {
})).then(function (rendered) {
should.exist(rendered);
rendered.string.should.containEql('<script defer src="https://unpkg.com/@tryghost/sodo-search');
rendered.string.should.containEql('data-ghost="http://127.0.0.1:2369/" data-key="xyz" data-api="http://127.0.0.1:2369/ghost/api/content/"');
rendered.string.should.containEql('data-sodo-search="http://127.0.0.1:2369/" data-key="xyz" data-api="http://127.0.0.1:2369/ghost/api/content/"');
done();
}).catch(done);