forked from adobecom/milo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MWPW-152270 - Performance updates and small changes to marketingtech. (…
…adobecom#2563) * MWPW-152270 - Performance updates and small changes to marketingtech. * Conditionally load assets from domain proxies to allow for better performance. * Change default launch url for dev. Resolves: [MWPW-152270](https://jira.corp.adobe.com/browse/MWPW-152270) **Test URLs:** - Before: https://stage--milo--adobecom.hlx.page/?martech=off - After: https://marketingtech-updates--milo--adobecom.hlx.page/?martech=off * trivial * MWPW-152270 - Performance updates and small changes to marketingtech. * Update libs/martech/martech.js This is shorter and I like how simple this is. committing this change. Co-authored-by: Narcis Radu <[email protected]> * trivial: oopsie fix... * Fixed test that was failing with chrischrischris's help by moving to new file. * lint fixes --------- Co-authored-by: Narcis Radu <[email protected]>
- Loading branch information
1 parent
9d49e78
commit b197e90
Showing
6 changed files
with
93 additions
and
45 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { readFile } from '@web/test-runner-commands'; | ||
import { expect } from '@esm-bundle/chai'; | ||
import sinon from 'sinon'; | ||
|
||
const utils = {}; | ||
|
||
const config = { | ||
codeRoot: '/libs', | ||
locales: { '': { ietf: 'en-US', tk: 'hah7vzn.css' } }, | ||
}; | ||
|
||
describe('Utils - MEP GNav', () => { | ||
before(async () => { | ||
const module = await import('../../libs/utils/utils.js'); | ||
module.setConfig(config); | ||
Object.keys(module).forEach((func) => { | ||
utils[func] = module[func]; | ||
}); | ||
window.hlx = { rum: { isSelected: false } }; | ||
}); | ||
|
||
after(() => { | ||
delete window.hlx; | ||
}); | ||
|
||
describe('target set to gnav', async () => { | ||
const MANIFEST_JSON = { | ||
info: { total: 2, offset: 0, limit: 2, data: [{ key: 'manifest-type', value: 'Personalization' }, { key: 'manifest-override-name', value: '' }, { key: 'name', value: '1' }] }, placeholders: { total: 0, offset: 0, limit: 0, data: [] }, experiences: { total: 1, offset: 0, limit: 1, data: [{ action: 'insertContentAfter', selector: '.marquee', 'page filter (optional)': '/products/special-offers', chrome: 'https://main--milo--adobecom.hlx.page/drafts/mariia/fragments/personalizationtext' }] }, ':version': 3, ':names': ['info', 'placeholders', 'experiences'], ':type': 'multi-sheet', | ||
}; | ||
function htmlResponse() { | ||
return new Promise((resolve) => { | ||
resolve({ | ||
ok: true, | ||
json: () => MANIFEST_JSON, | ||
}); | ||
}); | ||
} | ||
|
||
it('have target be set to gnav and save in config', async () => { | ||
window.fetch = sinon.stub().returns(htmlResponse()); | ||
document.head.innerHTML = await readFile({ path: './mocks/mep/head-target-gnav.html' }); | ||
await utils.loadArea(); | ||
const resultConfig = utils.getConfig(); | ||
expect(resultConfig.mep.targetEnabled).to.equal('gnav'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters