@coveo/quantic 3.16.0 → 3.16.1-pre.9c01cf606f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recent-queries-list/headless-recent-queries-list.d.ts +5 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/recent-queries-list/headless-recent-queries-list.d.ts +5 -0
- package/force-app/main/default/staticresources/coveoheadless/headless.js +10 -10
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -2
- package/package.json +5 -3
- package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -604
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -76
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -167
- package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
- package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
- package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -327
- package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -269
- package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
- package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -321
- package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -199
- package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -341
- package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
- package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
- package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -63
- package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
- package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
- package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -392
- package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
- package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
- package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -814
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -87
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -283
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -199
- package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -151
- package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
- package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
- package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -335
- package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -343
- package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -63
- package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
- package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -101
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
- package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
- package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -501
- package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
- package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
- package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
- package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
- package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
- package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
- package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -261
- package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
- package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
- package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
- package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -171
- package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
- package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -404
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -74
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
- package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -168
- package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -823
- package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -91
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
- package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
- package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -93
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
- package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
- package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -61
- package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -89
- package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -91
- package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -123
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -186
- package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
- package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -287
- package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -62
- package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -67
- package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -77
- package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
- package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -61
- package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
- package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -173
- package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -339
- package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
- package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
- package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
- package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
- package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
- package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -71
- package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -223
- package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {PagerObject} from './pageObject';
|
|
2
|
-
import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
|
|
3
|
-
import {SearchObject} from '../../../../../../playwright/page-object/searchObject';
|
|
4
|
-
import {
|
|
5
|
-
searchRequestRegex,
|
|
6
|
-
insightSearchRequestRegex,
|
|
7
|
-
} from '../../../../../../playwright/utils/requests';
|
|
8
|
-
import {InsightSetupObject} from '../../../../../../playwright/page-object/insightSetupObject';
|
|
9
|
-
import {useCaseEnum} from '../../../../../../playwright/utils/useCase';
|
|
10
|
-
|
|
11
|
-
const pageUrl = 's/quantic-pager';
|
|
12
|
-
|
|
13
|
-
interface PagerOptions {
|
|
14
|
-
numberOfPages: number;
|
|
15
|
-
}
|
|
16
|
-
type QuanticPagerE2EFixtures = {
|
|
17
|
-
pager: PagerObject;
|
|
18
|
-
search: SearchObject;
|
|
19
|
-
options: Partial<PagerOptions>;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
type QuanticPagerE2ESearchFixtures = QuanticPagerE2EFixtures & {
|
|
23
|
-
urlHash: string;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
type QuanticPagerE2EInsightFixtures = QuanticPagerE2ESearchFixtures & {
|
|
27
|
-
insightSetup: InsightSetupObject;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const testSearch = quanticBase.extend<QuanticPagerE2ESearchFixtures>({
|
|
31
|
-
options: {},
|
|
32
|
-
urlHash: '',
|
|
33
|
-
search: async ({page}, use) => {
|
|
34
|
-
await use(new SearchObject(page, searchRequestRegex));
|
|
35
|
-
},
|
|
36
|
-
pager: async ({page, options, configuration, search, urlHash}, use) => {
|
|
37
|
-
await page.goto(urlHash ? `${pageUrl}#${urlHash}` : pageUrl);
|
|
38
|
-
configuration.configure(options);
|
|
39
|
-
await search.waitForSearchResponse();
|
|
40
|
-
|
|
41
|
-
await use(new PagerObject(page));
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export const testInsight = quanticBase.extend<QuanticPagerE2EInsightFixtures>({
|
|
46
|
-
options: {},
|
|
47
|
-
search: async ({page}, use) => {
|
|
48
|
-
await use(new SearchObject(page, insightSearchRequestRegex));
|
|
49
|
-
},
|
|
50
|
-
insightSetup: async ({page}, use) => {
|
|
51
|
-
await use(new InsightSetupObject(page));
|
|
52
|
-
},
|
|
53
|
-
pager: async ({page, options, search, configuration, insightSetup}, use) => {
|
|
54
|
-
await page.goto(pageUrl);
|
|
55
|
-
configuration.configure({...options, useCase: useCaseEnum.insight});
|
|
56
|
-
await insightSetup.waitForInsightInterfaceInitialization();
|
|
57
|
-
await search.performSearch();
|
|
58
|
-
await search.waitForSearchResponse();
|
|
59
|
-
await use(new PagerObject(page));
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export {expect} from '@playwright/test';
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type {Locator, Page, Request} from '@playwright/test';
|
|
2
|
-
import {isUaCustomEvent} from '../../../../../../playwright/utils/requests';
|
|
3
|
-
|
|
4
|
-
export class PagerObject {
|
|
5
|
-
constructor(public page: Page) {
|
|
6
|
-
this.page = page;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
get nextPageButton(): Locator {
|
|
10
|
-
return this.page.getByRole('button', {name: /Next Page/i});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
get previousPageButton(): Locator {
|
|
14
|
-
return this.page.getByRole('button', {name: /Previous Page/i});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
get pageButtons(): Locator {
|
|
18
|
-
return this.page.locator('c-quantic-number-button button');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
pageButton(pageNumber: number): Locator {
|
|
22
|
-
return this.pageButtons.nth(pageNumber - 1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async goToLastPage(): Promise<void> {
|
|
26
|
-
await this.pageButtons.nth(-1).click();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async clickNextPageButton(): Promise<void> {
|
|
30
|
-
await this.nextPageButton.click();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async clickPreviousPageButton(): Promise<void> {
|
|
34
|
-
await this.previousPageButton.click();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async clickPageNumberButton(pageNumber: number): Promise<void> {
|
|
38
|
-
await this.pageButtons.nth(pageNumber - 1).click();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async waitForPagerUaAnalytics(eventValue): Promise<Request> {
|
|
42
|
-
const uaRequest = this.page.waitForRequest((request) => {
|
|
43
|
-
if (isUaCustomEvent(request)) {
|
|
44
|
-
const requestBody = request.postDataJSON?.();
|
|
45
|
-
const expectedFields = {
|
|
46
|
-
eventType: 'getMoreResults',
|
|
47
|
-
eventValue: eventValue,
|
|
48
|
-
};
|
|
49
|
-
return Object.keys(expectedFields).every(
|
|
50
|
-
(key) => requestBody?.[key] === expectedFields[key]
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
});
|
|
55
|
-
return uaRequest;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async waitForPagerNextUaAnalytics(): Promise<Request> {
|
|
59
|
-
return this.waitForPagerUaAnalytics('pagerNext');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async waitForPagerPreviousUaAnalytics(): Promise<Request> {
|
|
63
|
-
return this.waitForPagerUaAnalytics('pagerPrevious');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async waitForPagerNumberUaAnalytics(): Promise<Request> {
|
|
67
|
-
return this.waitForPagerUaAnalytics('pagerNumber');
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import {testSearch, testInsight, expect} from './fixture';
|
|
2
|
-
import {useCaseTestCases} from '../../../../../../playwright/utils/useCase';
|
|
3
|
-
|
|
4
|
-
const numberOfResultsPerPage = 10;
|
|
5
|
-
|
|
6
|
-
const fixtures = {
|
|
7
|
-
search: testSearch,
|
|
8
|
-
insight: testInsight,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
useCaseTestCases.forEach((useCase) => {
|
|
12
|
-
let test = fixtures[useCase.value];
|
|
13
|
-
|
|
14
|
-
test.describe(`quantic pager ${useCase.label}`, () => {
|
|
15
|
-
test.describe('when clicking the next page button', () => {
|
|
16
|
-
test('should trigger a new search and log analytics', async ({
|
|
17
|
-
pager,
|
|
18
|
-
search,
|
|
19
|
-
}) => {
|
|
20
|
-
const searchResponsePromise = search.waitForSearchResponse();
|
|
21
|
-
await pager.clickNextPageButton();
|
|
22
|
-
const searchResponse = await searchResponsePromise;
|
|
23
|
-
const {firstResult} = searchResponse.request().postDataJSON();
|
|
24
|
-
expect(firstResult).toBe(numberOfResultsPerPage);
|
|
25
|
-
await pager.waitForPagerNextUaAnalytics();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test.describe('when clicking the previous page button', () => {
|
|
30
|
-
test('should trigger a new search and log analytics', async ({
|
|
31
|
-
pager,
|
|
32
|
-
search,
|
|
33
|
-
}) => {
|
|
34
|
-
const initialSearchResponsePromise = search.waitForSearchResponse();
|
|
35
|
-
await pager.clickNextPageButton();
|
|
36
|
-
await initialSearchResponsePromise;
|
|
37
|
-
|
|
38
|
-
const searchResponsePromise = search.waitForSearchResponse();
|
|
39
|
-
await pager.clickPreviousPageButton();
|
|
40
|
-
const searchResponse = await searchResponsePromise;
|
|
41
|
-
const {firstResult} = searchResponse.request().postDataJSON();
|
|
42
|
-
expect(firstResult).toBe(0);
|
|
43
|
-
await pager.waitForPagerPreviousUaAnalytics();
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test.describe('when clicking a specific page button', () => {
|
|
48
|
-
test('should trigger a new search and log analytics', async ({
|
|
49
|
-
pager,
|
|
50
|
-
search,
|
|
51
|
-
}) => {
|
|
52
|
-
const examplePage = 3;
|
|
53
|
-
const searchResponsePromise = search.waitForSearchResponse();
|
|
54
|
-
await pager.clickPageNumberButton(examplePage);
|
|
55
|
-
const searchResponse = await searchResponsePromise;
|
|
56
|
-
const {firstResult} = searchResponse.request().postDataJSON();
|
|
57
|
-
expect(firstResult).toBe(numberOfResultsPerPage * (examplePage - 1));
|
|
58
|
-
await pager.waitForPagerNumberUaAnalytics();
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test.describe('when a new search is made', () => {
|
|
63
|
-
test('should select the first page', async ({pager, search}) => {
|
|
64
|
-
const initialSearchResponsePromise = search.waitForSearchResponse();
|
|
65
|
-
await pager.clickNextPageButton();
|
|
66
|
-
await initialSearchResponsePromise;
|
|
67
|
-
|
|
68
|
-
await expect(pager.previousPageButton).not.toBeDisabled();
|
|
69
|
-
const searchResponsePromise = search.waitForSearchResponse();
|
|
70
|
-
await search.performSearch();
|
|
71
|
-
const searchResponse = await searchResponsePromise;
|
|
72
|
-
const {firstResult} = searchResponse.request().postDataJSON();
|
|
73
|
-
|
|
74
|
-
const expectedPage = 0;
|
|
75
|
-
await expect(pager.pageButtons.nth(expectedPage)).toHaveAttribute(
|
|
76
|
-
'aria-pressed',
|
|
77
|
-
'true'
|
|
78
|
-
);
|
|
79
|
-
expect(firstResult).toBe(expectedPage);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
if (useCase.value === 'search') {
|
|
84
|
-
test.describe('when loading options from the url', () => {
|
|
85
|
-
test.use({
|
|
86
|
-
urlHash: 'firstResult=10',
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test('should reflect the options of url in the component', async ({
|
|
90
|
-
pager,
|
|
91
|
-
}) => {
|
|
92
|
-
const expectedPage = 2;
|
|
93
|
-
await expect(pager.pageButton(expectedPage)).toHaveAttribute(
|
|
94
|
-
'aria-pressed',
|
|
95
|
-
'true'
|
|
96
|
-
);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"nameOfTemplate": "quanticQuickviewDefault",
|
|
3
|
-
"contentType": "other than youtube",
|
|
4
|
-
"options": {
|
|
5
|
-
"result": {
|
|
6
|
-
"uniqueId": "42.38148$https://community.fitbit.com/board:charge/thread:5332832/message:5333023"
|
|
7
|
-
},
|
|
8
|
-
"contentUrl": "https://longdogechallenge.com/"
|
|
9
|
-
},
|
|
10
|
-
"selectors": {
|
|
11
|
-
"templateSelector": ".iframe-wrapper__default"
|
|
12
|
-
}
|
|
13
|
-
}
|
package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"nameOfTemplate": "quanticQuickviewYoutube",
|
|
3
|
-
"contentType": "youtube video",
|
|
4
|
-
"options": {
|
|
5
|
-
"result": {
|
|
6
|
-
"uniqueId": "42.54689$https://youtube.com/Channel:UCLD76EfBpKKuBH52RMIdrJw/Video:lZHu8AM5bjY"
|
|
7
|
-
},
|
|
8
|
-
"contentUrl": "https://longdogechallenge.com/"
|
|
9
|
-
},
|
|
10
|
-
"selectors": {
|
|
11
|
-
"templateSelector": ".iframe-wrapper__youtube",
|
|
12
|
-
"iframeSelector": ".quickview__content-iframe"
|
|
13
|
-
}
|
|
14
|
-
}
|
package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import {createElement} from 'lwc';
|
|
3
|
-
import QuanticQuickviewContent from '../quanticQuickviewContent';
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import defaultTestCase from './data/defaultTestCase.json';
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
import youtubeTestCase from './data/youtubeTestCase.json';
|
|
8
|
-
|
|
9
|
-
const functionsMocks = {
|
|
10
|
-
listener: jest.fn(() => {}),
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
function setupSimulation(element, eventName) {
|
|
14
|
-
const handler = () => {
|
|
15
|
-
functionsMocks.listener();
|
|
16
|
-
element.removeEventListener(eventName, handler);
|
|
17
|
-
};
|
|
18
|
-
element.addEventListener(eventName, handler);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function createTestComponent(options) {
|
|
22
|
-
const element = createElement('c-quantic-quickview-content', {
|
|
23
|
-
is: QuanticQuickviewContent,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
for (const [key, value] of Object.entries(options)) {
|
|
27
|
-
element[key] = value;
|
|
28
|
-
}
|
|
29
|
-
document.body.appendChild(element);
|
|
30
|
-
return element;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Helper function to wait until the microtask queue is empty.
|
|
34
|
-
function flushPromises() {
|
|
35
|
-
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
describe('c-quantic-quickview-content', () => {
|
|
39
|
-
function cleanup() {
|
|
40
|
-
// The jsdom instance is shared across test cases in a single file so reset the DOM
|
|
41
|
-
while (document.body.firstChild) {
|
|
42
|
-
document.body.removeChild(document.body.firstChild);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
afterEach(() => {
|
|
47
|
-
cleanup();
|
|
48
|
-
jest.clearAllMocks();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
[youtubeTestCase, defaultTestCase].forEach((testCase) => {
|
|
52
|
-
it(`should display the ${testCase.nameOfTemplate} template when the content is of type ${testCase.contentType}`, async () => {
|
|
53
|
-
const element = createTestComponent(testCase.options);
|
|
54
|
-
await flushPromises();
|
|
55
|
-
|
|
56
|
-
document.body.appendChild(element);
|
|
57
|
-
|
|
58
|
-
const actualTemplate = element.shadowRoot.querySelector(
|
|
59
|
-
testCase.selectors.templateSelector
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
expect(actualTemplate).not.toBeNull();
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe('when the iframe is loaded', () => {
|
|
67
|
-
it('should dispatch the loadingstatechange event properly', async () => {
|
|
68
|
-
const element = createTestComponent(youtubeTestCase.options);
|
|
69
|
-
await flushPromises();
|
|
70
|
-
|
|
71
|
-
setupSimulation(element, 'quantic__loadingstatechange');
|
|
72
|
-
|
|
73
|
-
const iframe = element.shadowRoot.querySelector(
|
|
74
|
-
youtubeTestCase.selectors.iframeSelector
|
|
75
|
-
);
|
|
76
|
-
iframe.dispatchEvent(new CustomEvent('load'));
|
|
77
|
-
|
|
78
|
-
expect(iframe).not.toBeNull();
|
|
79
|
-
expect(functionsMocks.listener).toHaveBeenCalledTimes(1);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import QuanticRadioButtonsGroup from 'c/quanticRadioButtonsGroup';
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import {createElement} from 'lwc';
|
|
4
|
-
|
|
5
|
-
const selectors = {
|
|
6
|
-
legend: 'legend.radio-buttons-group__legend',
|
|
7
|
-
radioInputs: 'input[type="radio"]',
|
|
8
|
-
radioLabels: 'label.radio-buttons-group__label',
|
|
9
|
-
radioIcons: 'lightning-icon',
|
|
10
|
-
radioContainers: '.slds-button.slds-radio_button.radio-button',
|
|
11
|
-
radioTooltips: 'c-quantic-tooltip',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @type {import('c/quanticRadioButtonsGroup').QuanticRadioButtonsGroupOption[]}
|
|
16
|
-
*/
|
|
17
|
-
const defaultOptionsList = [
|
|
18
|
-
{
|
|
19
|
-
value: 'value_option1',
|
|
20
|
-
tooltip: 'tooltip_option1',
|
|
21
|
-
label: 'label_option1',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
value: 'value_option2',
|
|
25
|
-
tooltip: 'tooltip_option2',
|
|
26
|
-
label: 'label_option2',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
value: 'value_option3',
|
|
30
|
-
tooltip: 'tooltip_option3',
|
|
31
|
-
label: 'label_option3',
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
const exampleOptions = {
|
|
36
|
-
legend: 'example-legend',
|
|
37
|
-
options: defaultOptionsList,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
function createTestComponent(options = exampleOptions) {
|
|
41
|
-
const element = createElement('c-quantic-radio-buttons-group', {
|
|
42
|
-
is: QuanticRadioButtonsGroup,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
for (const [key, value] of Object.entries(options)) {
|
|
46
|
-
element[key] = value;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
document.body.appendChild(element);
|
|
50
|
-
return element;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Helper function to wait until the microtask queue is empty.
|
|
54
|
-
function flushPromises() {
|
|
55
|
-
// eslint-disable-next-line @lwc/lwc/no-async-operation
|
|
56
|
-
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
describe('c-quantic-radio-buttons-group', () => {
|
|
60
|
-
function cleanup() {
|
|
61
|
-
// The jsdom instance is shared across test cases in a single file so reset the DOM
|
|
62
|
-
while (document.body.firstChild) {
|
|
63
|
-
document.body.removeChild(document.body.firstChild);
|
|
64
|
-
}
|
|
65
|
-
jest.clearAllMocks();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
afterEach(() => {
|
|
69
|
-
cleanup();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
describe('default rendering options', () => {
|
|
73
|
-
it('should render correctly with default options, without labels, without icons, without tooltips', async () => {
|
|
74
|
-
const minimalOptions = [
|
|
75
|
-
{value: 'value_option1'},
|
|
76
|
-
{value: 'value_option2'},
|
|
77
|
-
{value: 'value_option3'},
|
|
78
|
-
];
|
|
79
|
-
const element = createTestComponent({
|
|
80
|
-
...exampleOptions,
|
|
81
|
-
options: minimalOptions,
|
|
82
|
-
});
|
|
83
|
-
await flushPromises();
|
|
84
|
-
|
|
85
|
-
const legendElement = element.shadowRoot.querySelector(selectors.legend);
|
|
86
|
-
const radioInputs = element.shadowRoot.querySelectorAll(
|
|
87
|
-
selectors.radioInputs
|
|
88
|
-
);
|
|
89
|
-
const radioLabels = element.shadowRoot.querySelectorAll(
|
|
90
|
-
selectors.radioLabels
|
|
91
|
-
);
|
|
92
|
-
const icons = element.shadowRoot.querySelectorAll(selectors.radioIcons);
|
|
93
|
-
|
|
94
|
-
expect(legendElement).not.toBeNull();
|
|
95
|
-
expect(legendElement.textContent).toBe(exampleOptions.legend);
|
|
96
|
-
expect(radioInputs).toHaveLength(minimalOptions.length);
|
|
97
|
-
expect(radioLabels).toHaveLength(0);
|
|
98
|
-
expect(icons).toHaveLength(0);
|
|
99
|
-
minimalOptions.forEach((option, index) => {
|
|
100
|
-
expect(radioInputs[index].value).toBe(option.value);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('should render correctly with default options, without icons', async () => {
|
|
105
|
-
const element = createTestComponent();
|
|
106
|
-
await flushPromises();
|
|
107
|
-
|
|
108
|
-
const legendElement = element.shadowRoot.querySelector(selectors.legend);
|
|
109
|
-
const radioInputs = element.shadowRoot.querySelectorAll(
|
|
110
|
-
selectors.radioInputs
|
|
111
|
-
);
|
|
112
|
-
const radioLabels = element.shadowRoot.querySelectorAll(
|
|
113
|
-
selectors.radioLabels
|
|
114
|
-
);
|
|
115
|
-
const icons = element.shadowRoot.querySelectorAll(selectors.radioIcons);
|
|
116
|
-
const tooltips = element.shadowRoot.querySelectorAll(
|
|
117
|
-
selectors.radioTooltips
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
expect(legendElement).not.toBeNull();
|
|
121
|
-
expect(legendElement.textContent).toBe(exampleOptions.legend);
|
|
122
|
-
expect(radioInputs).toHaveLength(defaultOptionsList.length);
|
|
123
|
-
expect(radioLabels).toHaveLength(defaultOptionsList.length);
|
|
124
|
-
expect(tooltips).toHaveLength(defaultOptionsList.length);
|
|
125
|
-
expect(icons).toHaveLength(0);
|
|
126
|
-
defaultOptionsList.forEach((option, index) => {
|
|
127
|
-
expect(radioInputs[index].value).toBe(option.value);
|
|
128
|
-
expect(radioLabels[index].textContent).toBe(option.label);
|
|
129
|
-
expect(tooltips[index].textContent).toBe(option.tooltip);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('should render correctly with default options', async () => {
|
|
134
|
-
const optionsWithIcons = defaultOptionsList.map((option) => ({
|
|
135
|
-
...option,
|
|
136
|
-
iconName: `utility:rows`,
|
|
137
|
-
}));
|
|
138
|
-
const element = createTestComponent({
|
|
139
|
-
...exampleOptions,
|
|
140
|
-
options: optionsWithIcons,
|
|
141
|
-
});
|
|
142
|
-
await flushPromises();
|
|
143
|
-
|
|
144
|
-
const legendElement = element.shadowRoot.querySelector(selectors.legend);
|
|
145
|
-
const radioInputs = element.shadowRoot.querySelectorAll(
|
|
146
|
-
selectors.radioInputs
|
|
147
|
-
);
|
|
148
|
-
const radioLabels = element.shadowRoot.querySelectorAll(
|
|
149
|
-
selectors.radioLabels
|
|
150
|
-
);
|
|
151
|
-
const icons = element.shadowRoot.querySelectorAll(selectors.radioIcons);
|
|
152
|
-
|
|
153
|
-
expect(legendElement).not.toBeNull();
|
|
154
|
-
expect(legendElement.textContent).toBe(exampleOptions.legend);
|
|
155
|
-
expect(radioInputs).toHaveLength(defaultOptionsList.length);
|
|
156
|
-
expect(radioLabels).toHaveLength(defaultOptionsList.length);
|
|
157
|
-
expect(icons).toHaveLength(defaultOptionsList.length);
|
|
158
|
-
defaultOptionsList.forEach((_, index) => {
|
|
159
|
-
expect(icons[index].iconName).toBe('utility:rows');
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
describe('hideLabels property', () => {
|
|
165
|
-
const labelHiddenClass = 'slds-assistive-text';
|
|
166
|
-
it('should render correctly with hideLabels set to true', async () => {
|
|
167
|
-
const element = createTestComponent({
|
|
168
|
-
...exampleOptions,
|
|
169
|
-
hideLabels: true,
|
|
170
|
-
});
|
|
171
|
-
await flushPromises();
|
|
172
|
-
|
|
173
|
-
const radioLabels = element.shadowRoot.querySelectorAll(
|
|
174
|
-
selectors.radioLabels
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
expect(radioLabels).toHaveLength(defaultOptionsList.length);
|
|
178
|
-
for (const radioLabel of radioLabels) {
|
|
179
|
-
expect(radioLabel.classList.contains(labelHiddenClass)).toBeTruthy();
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it('should render correctly with hideLabels set to false', async () => {
|
|
184
|
-
const element = createTestComponent({
|
|
185
|
-
...exampleOptions,
|
|
186
|
-
hideLabels: false,
|
|
187
|
-
});
|
|
188
|
-
await flushPromises();
|
|
189
|
-
|
|
190
|
-
const radioLabels = element.shadowRoot.querySelectorAll(
|
|
191
|
-
selectors.radioLabels
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
expect(radioLabels).toHaveLength(defaultOptionsList.length);
|
|
195
|
-
for (const radioLabel of radioLabels) {
|
|
196
|
-
expect(radioLabel.classList.contains(labelHiddenClass)).toBeFalsy();
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
describe('User interaction', () => {
|
|
202
|
-
it('should dispatch the "quantic__change" event when a radio button is clicked', async () => {
|
|
203
|
-
const element = createTestComponent();
|
|
204
|
-
await flushPromises();
|
|
205
|
-
|
|
206
|
-
const radioInputs = element.shadowRoot.querySelectorAll(
|
|
207
|
-
selectors.radioInputs
|
|
208
|
-
);
|
|
209
|
-
const radioInput = radioInputs[0];
|
|
210
|
-
const changeHandler = jest.fn();
|
|
211
|
-
element.addEventListener('quantic__change', changeHandler);
|
|
212
|
-
|
|
213
|
-
radioInput.click();
|
|
214
|
-
|
|
215
|
-
expect(changeHandler).toHaveBeenCalledTimes(1);
|
|
216
|
-
expect(changeHandler.mock.calls[0][0].detail).toEqual({
|
|
217
|
-
value: radioInput.value,
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
it('should update the selected radio button when a radio button is clicked', async () => {
|
|
222
|
-
const element = createTestComponent();
|
|
223
|
-
await flushPromises();
|
|
224
|
-
|
|
225
|
-
const radioInputs = element.shadowRoot.querySelectorAll(
|
|
226
|
-
selectors.radioInputs
|
|
227
|
-
);
|
|
228
|
-
const radioButtonContainers = element.shadowRoot.querySelectorAll(
|
|
229
|
-
selectors.radioContainers
|
|
230
|
-
);
|
|
231
|
-
const radioInput = radioInputs[0];
|
|
232
|
-
const radioContainer = radioButtonContainers[0];
|
|
233
|
-
|
|
234
|
-
radioInput.click();
|
|
235
|
-
await flushPromises();
|
|
236
|
-
|
|
237
|
-
expect(radioInput.checked).toBeTruthy();
|
|
238
|
-
expect(
|
|
239
|
-
radioContainer.classList.contains('radio-button--selected')
|
|
240
|
-
).toBeTruthy();
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it("shouldn't be possible to select multiple radio buttons", async () => {
|
|
244
|
-
const element = createTestComponent();
|
|
245
|
-
await flushPromises();
|
|
246
|
-
|
|
247
|
-
const radioInputs = element.shadowRoot.querySelectorAll(
|
|
248
|
-
selectors.radioInputs
|
|
249
|
-
);
|
|
250
|
-
const radioButtonContainers = element.shadowRoot.querySelectorAll(
|
|
251
|
-
selectors.radioContainers
|
|
252
|
-
);
|
|
253
|
-
|
|
254
|
-
radioInputs[0].click();
|
|
255
|
-
radioInputs[1].click();
|
|
256
|
-
await flushPromises();
|
|
257
|
-
|
|
258
|
-
const selectedRadioInputs = element.shadowRoot.querySelectorAll(
|
|
259
|
-
`.radio-button--selected`
|
|
260
|
-
);
|
|
261
|
-
|
|
262
|
-
expect(radioInputs[0].checked).toBeFalsy();
|
|
263
|
-
expect(radioInputs[1].checked).toBeTruthy();
|
|
264
|
-
expect(
|
|
265
|
-
radioButtonContainers[0].classList.contains('radio-button--selected')
|
|
266
|
-
).toBeFalsy();
|
|
267
|
-
expect(
|
|
268
|
-
radioButtonContainers[1].classList.contains('radio-button--selected')
|
|
269
|
-
).toBeTruthy();
|
|
270
|
-
expect(selectedRadioInputs).toHaveLength(1);
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
});
|