Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yesil committed May 31, 2024
1 parent e6afe56 commit f0891c4
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 17 deletions.
10 changes: 6 additions & 4 deletions libs/features/spectrum-web-components/dist/theme.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions libs/features/spectrum-web-components/src/theme.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import '@spectrum-web-components/theme/sp-theme.js';
import '@spectrum-web-components/theme/theme-light.js';
import '@spectrum-web-components/theme/scale-medium.js';
import '@spectrum-web-components/theme/scale-large.js';

export * from '@spectrum-web-components/theme';
34 changes: 34 additions & 0 deletions test/blocks/merch-twp/assets/premiere-pro.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 12 additions & 6 deletions test/blocks/merch-twp/merch-twp.2cards.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import { initService } from "../../../libs/blocks/merch/merch.js";
import { mockFetch, unmockFetch } from '../merch/mocks/fetch.js';
import { mockIms, unmockIms } from '../merch/mocks/ims.js';
import { setConfig } from '../../../../libs/utils/utils.js';
import { createTag, setConfig } from '../../../../libs/utils/utils.js';
import merchTwp from "../../../libs/blocks/merch-twp/merch-twp.js";
import { getModal } from '../../../libs/blocks/modal/modal.js';

Expand Down Expand Up @@ -54,7 +54,13 @@
});
it('renders merch-twp with 3 tabs and 4 cards', async () => {
const twp = await merchTwp(document.querySelector('.merch-twp'));
await getModal(null, { id: 'twp-modal', content: twp, class: 'twp' });
const spTheme = createTag('sp-theme',
{
theme: "spectrum",
color: "light",
scale: "large"
}, twp);
return await getModal(null, { id: 'twp-modal', content: spTheme, class: 'twp' });
});
});

Expand All @@ -71,7 +77,7 @@ <h4 id="try-the-full-version-of-adobe-apps-with-a-7-day-free-trial">Try the full
<div class="section" style="display: contents;">
<merch-card class="merch-card twp add-stock" data-block="" variant="twp"
filters="all" types="">
<merch-icon slot="icons" src="https://main--milo--adobecom.hlx.page/assets/img/illustrator.svg" alt="Illustrator"></merch-icon>
<merch-icon slot="icons" src="/test/blocks/merch-twp/assets/illustrator.svg" alt="Illustrator"></merch-icon>
<p slot="heading-xs" class="heading-xs"><strong>Illustrator</strong></p>
<p slot="body-xs-top" class="body-xs-top">Create beautiful designs, icons, and more — then use them
anyplace at any size.</p>
Expand Down Expand Up @@ -129,7 +135,7 @@ <h4 id="try-the-full-version-of-adobe-apps-with-a-7-day-free-trial">Try the full
<merch-card class="merch-card twp add-stock" data-block="" variant="twp"
badge-background-color="#2D9D78" badge-color="#FFFFFF" badge-text="Best value"
filters="all" types="">
<merch-icon slot="icons" src="https://main--milo--adobecom.hlx.page/assets/img/creative-cloud.svg" alt="Creative Cloud All Apps"></merch-icon>
<merch-icon slot="icons" src="/test/blocks/merch-twp/assets/creative-cloud.svg" alt="Creative Cloud All Apps"></merch-icon>
<p slot="heading-xs" class="heading-xs"><strong>Creative Cloud All Apps</strong></p>
<p slot="body-xs-top" class="body-xs-top">The ultimate toolkit for unlimited creativity.</p>
<div slot="body-xs">
Expand Down Expand Up @@ -190,7 +196,7 @@ <h4 id="try-the-full-version-of-adobe-apps-with-a-7-day-free-trial">Try the full
<merch-card class="merch-card twp" data-block="" variant="twp" badge-background-color="#2D9D78"
badge-color="#FFFFFF" badge-text="Includes business features"
filters="all" types="">
<merch-icon slot="icons" src="https://main--milo--adobecom.hlx.page/assets/img/creative-cloud.svg" alt="Creative Cloud All Apps"></merch-icon>
<merch-icon slot="icons" src="/test/blocks/merch-twp/assets/creative-cloud.svg" alt="Creative Cloud All Apps"></merch-icon>
<merch-quantity-select title="Select a quantity:" min="1" max="10" step="1"
default-value="undefined" max-input="undefined"></merch-quantity-select>
<p slot="heading-xs" class="heading-xs"><strong>Creative Cloud All Apps</strong></p>
Expand Down Expand Up @@ -241,7 +247,7 @@ <h4 id="try-the-full-version-of-adobe-apps-with-a-7-day-free-trial">Try the full
<merch-card class="merch-card twp add-stock" data-block="" variant="twp"
badge-background-color="#2D9D78" badge-color="#FFFFFF" badge-text="Save over 60%"
filters="all" types="">
<merch-icon slot="icons" src="https://main--milo--adobecom.hlx.page/assets/img/creative-cloud.svg" alt="Creative Cloud All Apps"></merch-icon>
<merch-icon slot="icons" src="/test/blocks/merch-twp/assets/creative-cloud.svg" alt="Creative Cloud All Apps"></merch-icon>
<p slot="heading-xs" class="heading-xs"><strong>Creative Cloud All Apps</strong></p>
<p slot="body-xs-top" class="body-xs-top">The ultimate toolkit for unlimited creativity. Students and
teachers save over 60% on Creative Cloud All Apps for the first year. <a
Expand Down
14 changes: 8 additions & 6 deletions test/blocks/merch-twp/merch-twp.3cards.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
it('renders merch-twp with 3 tabs and 4 cards', async () => {
const twp = await merchTwp(document.querySelector('.merch-twp'));
await getModal(null, { id: 'twp-modal', content: twp, class: 'twp' });
expect(twp).to.exist;
});
});

Expand All @@ -70,8 +71,8 @@ <h4 id="try-the-full-version-of-adobe-apps-with-a-7-day-free-trial">Try the full
<div class="fragment" data-path="/fragments/twp/cards/premiere" style="display: contents;">
<div class="section" style="display: contents;">
<merch-card class="merch-card twp add-stock" variant="twp"
icons="[{&quot;src&quot;:&quot;https://main--milo--adobecom.hlx.page/assets/img/premiere.svg&quot;,&quot;alt&quot;:&quot;Premiere&quot;}]"
filters="all" types="" tabindex="0" daa-lh="b1|merch-card">
<merch-icon slot="icons" src="/test/blocks/merch-twp/assets/premiere-pro.svg" alt="Premiere Pro"></merch-icon>
<p slot="heading-xs" class="heading-xs">
<strong>Premiere</strong>
</p>
Expand Down Expand Up @@ -157,8 +158,8 @@ <h4 id="try-the-full-version-of-adobe-apps-with-a-7-day-free-trial">Try the full
<div class="fragment" data-path="/fragments/twp/cards/illustrator" style="display: contents;">
<div class="section" style="display: contents;">
<merch-card class="merch-card twp add-stock" data-block="" variant="twp"
icons="[{&quot;src&quot;:&quot;https://main--milo--adobecom.hlx.page/assets/img/illustrator.svg&quot;,&quot;alt&quot;:&quot;Illustrator&quot;}]"
filters="all" types="">
<merch-icon slot="icons" src="/test/blocks/merch-twp/assets/illustrator.svg" alt="Illustrator"></merch-icon>
<p slot="heading-xs" class="heading-xs"><strong>Illustrator</strong></p>
<p slot="body-xs-top" class="body-xs-top">Create beautiful designs, icons, and more — then use them
anyplace at any size.</p>
Expand Down Expand Up @@ -215,8 +216,8 @@ <h4 id="try-the-full-version-of-adobe-apps-with-a-7-day-free-trial">Try the full
<div class="section" style="display: contents;">
<merch-card class="merch-card twp add-stock" data-block="" variant="twp"
badge-background-color="#2D9D78" badge-color="#FFFFFF" badge-text="Best value"
icons="[{&quot;src&quot;:&quot;https://main--milo--adobecom.hlx.page/assets/img/creative-cloud.svg&quot;,&quot;alt&quot;:&quot;Creative Cloud All Apps&quot;}]"
filters="all" types="">
<merch-icon slot="icons" src="/test/blocks/merch-twp/assets/creative-cloud.svg" alt="Creative Cloud All Apps"></merch-icon>
<p slot="heading-xs" class="heading-xs"><strong>Creative Cloud All Apps</strong></p>
<p slot="body-xs-top" class="body-xs-top">The ultimate toolkit for unlimited creativity.</p>
<div slot="body-xs">
Expand Down Expand Up @@ -276,8 +277,9 @@ <h4 id="try-the-full-version-of-adobe-apps-with-a-7-day-free-trial">Try the full
<div class="section" style="display: contents;">
<merch-card class="merch-card twp" data-block="" variant="twp" badge-background-color="#2D9D78"
badge-color="#FFFFFF" badge-text="Includes business features"
icons="[{&quot;src&quot;:&quot;https://main--milo--adobecom.hlx.page/assets/img/creative-cloud.svg&quot;,&quot;alt&quot;:&quot;Creative Cloud All Apps&quot;}]"
filters="all" types=""><merch-quantity-select title="Select a quantity:" min="1" max="10" step="1"
filters="all" types="">
<merch-icon slot="icons" src="/test/blocks/merch-twp/assets/creative-cloud.svg" alt="Creative Cloud All Apps"></merch-icon>
<merch-quantity-select title="Select a quantity:" min="1" max="10" step="1"
default-value="undefined" max-input="undefined"></merch-quantity-select>
<p slot="heading-xs" class="heading-xs"><strong>Creative Cloud All Apps</strong></p>
<p slot="body-xs-top" class="body-xs-top">The ultimate toolkit for unlimited creativity plus business
Expand Down Expand Up @@ -326,8 +328,8 @@ <h4 id="try-the-full-version-of-adobe-apps-with-a-7-day-free-trial">Try the full
<div class="section" style="display: contents;">
<merch-card class="merch-card twp add-stock" data-block="" variant="twp"
badge-background-color="#2D9D78" badge-color="#FFFFFF" badge-text="Save over 60%"
icons="[{&quot;src&quot;:&quot;https://main--milo--adobecom.hlx.page/assets/img/creative-cloud.svg&quot;,&quot;alt&quot;:&quot;Creative Cloud All Apps&quot;}]"
filters="all" types="">
<merch-icon slot="icons" src="/test/blocks/merch-twp/assets/creative-cloud.svg" alt="Creative Cloud All Apps"></merch-icon>
<p slot="heading-xs" class="heading-xs"><strong>Creative Cloud All Apps</strong></p>
<p slot="body-xs-top" class="body-xs-top">The ultimate toolkit for unlimited creativity. Students and
teachers save over 60% on Creative Cloud All Apps for the first year. <a
Expand Down
118 changes: 117 additions & 1 deletion test/blocks/merch/mocks/named-offers.json
Original file line number Diff line number Diff line change
Expand Up @@ -969,5 +969,121 @@
"merchant": "ADOBE"
}
]
}
},
{"resolvedOffers":[{"offerSelectorIds":["6jAp4YpZosSe5N5bCVbDcomwBmDLgN3RqZwXmn5ZR1s"],"offerId":"13F9169A5EA8997CDB23379393AC0649","startDate":"2020-09-26T14:46:00.000Z","priceDetails":{"price":239.88,"priceWithoutTax":0.0,"priceWithoutDiscountAndTax":239.88,"usePrecision":true,"formatString":"'US$'#,##0.00","taxDisplay":"TAX_EXCLUSIVE","taxTerm":"TAX"},"analytics":"{\"offerId\":\"13F9169A5EA8997CDB23379393AC0649\",\"label\":\"ccsn_direct_individual\",\"price\":\"239.88\",\"amountWithoutTax\":\"0.0\",\"commitmentType\":\"YEAR\",\"billingFrequency\":\"ANNUAL\",\"currencyCode\":\"USD\"}","productArrangementCode":"ccsn_direct_individual","productArrangement":{"productFamily":"CC_ALL_APPS"},"buyingProgram":"RETAIL","commitment":"YEAR","term":"ANNUAL","customerSegment":"INDIVIDUAL","marketSegments":["EDU"],"salesChannel":"DIRECT","offerType":"TRIAL","pricePoint":"TRIAL_TRIAL_STE_FIRST_YEAR_ABM_US_ONLY","language":"MULT","merchant":"ADOBE"}]},
{
"resolvedOffers": [
{
"offerSelectorIds": [
"mDRZh8l0NL1Eh0loB2nfURJ9Cy031JbEHo3GloTOZLY"
],
"offerId": "977D4D822396D2F19CF2C9C1F9E2398F",
"startDate": "2021-12-08T08:01:00.000Z",
"endDate": "2050-01-31T19:59:00.000Z",
"priceDetails": {
"price": 263.88,
"priceWithoutTax": 0.0,
"priceWithoutDiscountAndTax": 263.88,
"usePrecision": true,
"formatString": "'US$'#,##0.00",
"taxDisplay": "TAX_EXCLUSIVE",
"taxTerm": "TAX"
},
"analytics": "{\"offerId\":\"977D4D822396D2F19CF2C9C1F9E2398F\",\"label\":\"ppro_direct_individual\",\"price\":\"263.88\",\"amountWithoutTax\":\"0.0\",\"commitmentType\":\"YEAR\",\"billingFrequency\":\"ANNUAL\",\"currencyCode\":\"USD\"}",
"productArrangementCode": "ppro_direct_individual",
"productArrangement": {
"productFamily": "PREMIERE"
},
"buyingProgram": "RETAIL",
"commitment": "YEAR",
"term": "ANNUAL",
"customerSegment": "INDIVIDUAL",
"marketSegments": [
"COM"
],
"salesChannel": "DIRECT",
"offerType": "TRIAL",
"pricePoint": "TRIAL_BASE_OFFER_TWP_CCI_ALL_APPS_AND_SINGLE_APP_NON_CCX",
"language": "MULT",
"merchant": "ADOBE"
}
]
},
{
"resolvedOffers": [
{
"offerSelectorIds": [
"nxoCqokhUYskPBG6p9_U4nfRhpMBdLmAidNSUWKHG_c"
],
"offerId": "0D55F09EEA2E00977BCC3171A5B86333",
"startDate": "2021-12-08T08:01:00.000Z",
"endDate": "2050-01-31T19:59:00.000Z",
"priceDetails": {
"price": 22.99,
"priceWithoutTax": 0.0,
"priceWithoutDiscountAndTax": 22.99,
"usePrecision": true,
"formatString": "'US$'#,##0.00",
"taxDisplay": "TAX_EXCLUSIVE",
"taxTerm": "TAX"
},
"analytics": "{\"offerId\":\"0D55F09EEA2E00977BCC3171A5B86333\",\"label\":\"ppro_direct_individual\",\"price\":\"22.99\",\"amountWithoutTax\":\"0.0\",\"commitmentType\":\"YEAR\",\"billingFrequency\":\"MONTHLY\",\"currencyCode\":\"USD\"}",
"productArrangementCode": "ppro_direct_individual",
"productArrangement": {
"productFamily": "PREMIERE"
},
"buyingProgram": "RETAIL",
"commitment": "YEAR",
"term": "MONTHLY",
"customerSegment": "INDIVIDUAL",
"marketSegments": [
"COM"
],
"salesChannel": "DIRECT",
"offerType": "TRIAL",
"pricePoint": "TRIAL_BASE_OFFER_TWP_CCI_ALL_APPS_AND_SINGLE_APP_NON_CCX",
"language": "MULT",
"merchant": "ADOBE"
}
]
},
{
"resolvedOffers": [
{
"offerSelectorIds": [
"y98h276r1i7FXamJzbTF2PnMUHZ8fuLxYPAe49Jj2sg"
],
"offerId": "6542F986418521B61724E9E6E8FF9F77",
"startDate": "2021-12-08T08:01:00.000Z",
"endDate": "2050-01-31T19:59:00.000Z",
"priceDetails": {
"price": 34.49,
"priceWithoutTax": 0.0,
"priceWithoutDiscountAndTax": 34.49,
"usePrecision": true,
"formatString": "'US$'#,##0.00",
"taxDisplay": "TAX_EXCLUSIVE",
"taxTerm": "TAX"
},
"analytics": "{\"offerId\":\"6542F986418521B61724E9E6E8FF9F77\",\"label\":\"ppro_direct_individual\",\"price\":\"34.49\",\"amountWithoutTax\":\"0.0\",\"commitmentType\":\"MONTH\",\"billingFrequency\":\"MONTHLY\",\"currencyCode\":\"USD\"}",
"productArrangementCode": "ppro_direct_individual",
"productArrangement": {
"productFamily": "PREMIERE"
},
"buyingProgram": "RETAIL",
"commitment": "MONTH",
"term": "MONTHLY",
"customerSegment": "INDIVIDUAL",
"marketSegments": [
"COM"
],
"salesChannel": "DIRECT",
"offerType": "TRIAL",
"pricePoint": "TRIAL_BASE_OFFER_TWP_CCI_ALL_APPS_AND_SINGLE_APP_NON_CCX",
"language": "MULT",
"merchant": "ADOBE"
}
]
}

]

0 comments on commit f0891c4

Please sign in to comment.