Skip to content

Commit

Permalink
update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vgoodric committed Mar 12, 2024
1 parent 1c3e0ae commit e8cd302
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/features/personalization/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function createPreviewPill(manifests) {
const personalizationOn = getMetadata('personalization');
const personalizationOnText = personalizationOn && personalizationOn !== '' ? 'on' : 'off';
const simulateHref = new URL(window.location.href);
simulateHref.searchParams.set('manifest', manifestParameter.join(','));
simulateHref.searchParams.set('manifest', manifestParameter.join('---'));

const config = getConfig();
let mepHighlightChecked = '';
Expand Down
2 changes: 2 additions & 0 deletions test/features/personalization/preview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ describe('preview feature', () => {
expect(document.querySelector('input#mepHighlightCheckbox').getAttribute('checked')).to.equal('checked');
});
it('updates preview button', () => {
expect(document.querySelector('a[title="Preview above choices"]').getAttribute('href')).to.contain('---');
document.querySelector('#new-manifest').value = 'https://main--homepage--adobecom.hlx.live/homepage/fragments/mep/new-manifest.json';
document.querySelector('input[name="/homepage/fragments/mep/selected-example.json"][value="default"]').click();
expect(document.querySelector('a[title="Preview above choices"]').getAttribute('href')).to.contain('new-manifest.json');
Expand All @@ -193,6 +194,7 @@ describe('preview feature', () => {
expect(document.querySelector('a[title="Preview above choices"]').getAttribute('href')).to.not.contain('mepHighlight');
document.querySelector('input#mepPreviewButtonCheckbox').click();
expect(document.querySelector('a[title="Preview above choices"]').getAttribute('href')).to.contain('mepButton=off');
expect(document.querySelector('a[title="Preview above choices"]').getAttribute('href')).to.contain('---');
});
it('opens manifest', () => {
document.querySelector('a.mep-edit-manifest').click();
Expand Down

0 comments on commit e8cd302

Please sign in to comment.