Loading tutorials
@api properties, event handlers). It also assumes you have Node.js and npm installed and can work in a Salesforce DX project. You will install the test tooling, add a configuration file and npm scripts, and run one passing te2 min readasync/await, and have a Salesforce DX project with @salesforce/sfdx-lwc-jest installed as described in the previous chapter. Here you learn how a Jest test file is organized. Later chapters apply3 min read@api properties, events), modern JavaScript, and that sfdx-lwc-jest is already installed and running in your project. Here you will learn how a test turns a component class into a live element.2 min readcreateElement and attach it to document.body. It also assumes you know basic Jest matchers such as toBe and toContain. Here you will learn how to find elements inside a component's rendered output and assert on them.2 min readcreateElement, and that you know promises and async/await. You should also know how to query the shadow root, which earlier chapters covered.3 min readcreateElement, and that you know describe, it, and afterEach. It covers why tests must not share state and how to enforce that.3 min readcreateElement, query the shadow root, and use await Promise.resolve() to wait for rendering. The examples use the c-counter component from earlier chapters.2 min readcreateElement, query its shadow root, and wait for re-rendering with await Promise.resolve(). It also assumes you know how a component dispatches a CustomEvent. Here you will simulate user actions and check the events a component sends to it2 min readcreateElement, querying the shadow root, and waiting for re-rendering. It also assumes you are comfortable with promises and async/await.2 min readcreateElement, shadow DOM queries, and how to wait for re-rendering. You should also know what @wire does. Earlier chapters covered those topics.2 min readcreateElement, query its shadow root, and wait one microtask for re-rendering. It also assumes you know how @api properties and custom events connect a parent to its children.2 min readcreateElement, wait for re-rendering, and mock imperative Apex calls. Here you handle the other @salesforce/* and lightning/* imports a component pulls in.2 min read@salesforce/sfdx-lwc-jest installed, and that you can write a basic Jest test for a Lightning web component. Here you will measure which lines your tests run, and you will learn how to track down a failing test.3 min read