New answers tagged


You can use the HTMLSelectElement.options property of the select element to determine which item you want to select dynamically: const genderfield = this.template.querySelector('[name="genderfield"]'); genderfield.selectedIndex = [...genderfield.options].findIndex(option => option.value === 'Female');


The default HTMLSelectElement doesn't use "value" to set a value, it uses selectedIndex. Also, during connectedCallback, the template hasn't yet been rendered. Add an asynchronous callback, and you should be fine: setTimeout(() => this.template.querySelector(someCssSelector).selectedIndex = 1 ); In addition, you cannot reliably use Id values ...


I was able to get this to work by updating the jest.config.js with the following. This allows the module Name mapper to map any lighting components that are not exposed in the lightning-base-components package to be resolved by jest. I'm not well versed with Jest so this may not be the final answer. const { jestConfig } = require('lwc-services/lib/config/...

Top 50 recent answers are included