Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(quantic): POC of testing with slots in LWCs #4782

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mmitiche
Copy link
Contributor

Description

This is a POC applied to the Quantic Sort component showing how we can add unit tests that includes passing slots to our Lightning Web Components,

This PR for examples addresses as an example how we can unit test the scenarios where custom sort options and invalid sort options are passed to the Quantic Sort component as slots.

This method mainly relies on mocking the return value of the method assignedNodes with the following function:

/**
 * Mocks the return value of the assignedNodes method.
 * @param {Array<Element>} assignedElements
 */
function mockSlotAssignedNodes(assignedElements) {
  HTMLSlotElement.prototype.assignedNodes = function () {
    return assignedElements;
  };
}

Copy link

Pull Request Report

PR Title

❌ Title should follow the conventional commit spec:
<type>(optional scope): <description>

Example: feat(headless): add result-list controller

Live demo links

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 242.9 242.9 0
commerce 347.8 347.8 0
search 414 414 0
insight 405.2 405.2 0
recommendation 255.1 255.1 0
ssr 407.5 407.5 0
ssr-commerce 363 363 0

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
case-assist 0 6 0
insight 0 27 0
commerce 0 15 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
case-assist : missing SSR support
insight : missing SSR support
commerce : missing SSR support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant