Skip to content

Commit

Permalink
add test payload
Browse files Browse the repository at this point in the history
  • Loading branch information
3ch023 committed Sep 11, 2024
1 parent 7bddefd commit 7b92531
Show file tree
Hide file tree
Showing 9 changed files with 582 additions and 35 deletions.
2 changes: 1 addition & 1 deletion libs/deps/mas/mas.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libs/deps/mas/merch-datasource.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions libs/features/mas/docs/plans2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!doctype html>
<html>
<head>
<title>MAS Demo for community.adobe.com</title>
<meta name="robots" content="noindex, nofollow" />
<meta name="nofollow-links" content="on" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="/libs/features/spectrum-web-components/dist/theme.js" type="module"></script>
<script src="/libs/features/spectrum-web-components/dist/button.js" type="module"></script>

<script src="/libs/deps/mas/mas.js" type="module"></script>
<!--
For Canadian French locale
<script src="/libs/deps/mas/mas.js?locale=CA_fr type="module"></script>
-->
</head>
<body>
<main>
<sp-theme color="light" scale="medium">
<div class="four-merch-cards catalog">
<merch-card><merch-datasource path="/content/dam/sandbox/mas/catalog/creative-cloud-all-apps"></merch-datasource></merch-card>
<merch-card><merch-datasource path="/content/dam/sandbox/mas/catalog/photoshop"></merch-datasource></merch-card>
<merch-card><merch-datasource path="/content/dam/sandbox/mas/catalog/illustrator"></merch-datasource></merch-card>
<merch-card><merch-datasource path="/content/dam/sandbox/mas/catalog/premiere-pro"></merch-datasource></merch-card>
<merch-card><merch-datasource path="/content/dam/sandbox/mas/catalog/adobe-express"></merch-datasource></merch-card>
</div>
</sp-theme>
</main>
</body>
</html>
8 changes: 4 additions & 4 deletions libs/features/mas/mocks/aem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ export async function withAem(originalFetch) {
if (/cf\/fragments\/search/.test(pathname)) {
// TODO add conditional use case.
return originalFetch(
'/test/mocks/sites/cf/fragments/search/default.json',
'/test/mocks/sites/cf/fragments/search/authorPayload.json',
);
} else if (/cf\/fragments/.test(pathname) && searchParams.has('path')) {
const path = searchParams.get('path');
const fragmentId = searchParams.get('fragmentId');
const item = await originalFetch(
'/test/mocks/sites/cf/fragments/search/default.json',
'/test/mocks/sites/cf/fragments/search/authorPayload.json',
)
.then((res) => res.json())
.then(({ items }) => items.find((item) => item.path === path));
.then(({ items }) => items.find((item) => item.id === id));
if (item) {
return Promise.resolve({
ok: true,
Expand Down
Loading

0 comments on commit 7b92531

Please sign in to comment.