Skip to content

Instantly share code, notes, and snippets.

View svierk's full-sized avatar
🏠
Working from home

Sebastiano Schwarz svierk

🏠
Working from home
View GitHub Profile
@svierk
svierk / jsdoc.config.json
Created April 9, 2022 13:13
Configuration file for generating LWC code documentation using JSDoc
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc", "closure"]
},
"source": {
"include": ["force-app/main/default/lwc"],
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
@svierk
svierk / helloWorld.js
Created April 9, 2022 14:40
An example LWC that adds a classic greeting to any page
import { api, LightningElement } from 'lwc';
/**
* An example LWC that adds a classic greeting to any page.
* @alias HelloWorld
* @extends LightningElement
* @hideconstructor
*
* @example
* <c-hello-world name="World"></c-hello-world>
@svierk
svierk / jest.config.js
Created May 26, 2022 17:31
Default LWC Jest Configuration in SFDX Projects
const { jestConfig } = require('@salesforce/sfdx-lwc-jest/config');
module.exports = {
...jestConfig,
modulePathIgnorePatterns: ['<rootDir>/.localdevserver']
};
@svierk
svierk / jest.config.js
Created May 27, 2022 08:22
Extended LWC Jest Configuration for SFDX Projects
const { jestConfig } = require('@salesforce/sfdx-lwc-jest/config');
module.exports = {
...jestConfig,
coverageReporters: ['clover', 'json', 'text', 'lcov', 'cobertura'],
modulePathIgnorePatterns: ['/.localdevserver'],
reporters: [
'default',
[
'jest-junit',
@svierk
svierk / azure-pipelines.yaml
Last active May 27, 2022 23:30
Azure Pipeline Task to publish Cobertura Code Coverage Results
- task: PublishCodeCoverageResults@1
displayName: 'Publish Coverage Results'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Build.SourcesDirectory)/coverage/cobertura-coverage.xml
@svierk
svierk / azure-pipelines.yaml
Created May 27, 2022 23:32
Azure Pipeline Task to publish JUnit Test Results
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/test-results-*.xml'
failTaskOnFailedTests: true
@svierk
svierk / azure-pipelines.yaml
Created May 29, 2022 08:40
Azure Pipeline Task to execute all LWC Unit Tests
- bash: npm run test:unit:coverage
displayName: 'Execute LWC Unit Tests'
workingDirectory: $(Build.SourcesDirectory)
continueOnError: true
@svierk
svierk / parentComponent.html
Created June 8, 2022 20:34
Using the LWC Multi Select Combobox in a Parent Component
<template>
<c-multi-select-combobox
label="Options"
name="options"
options={options}
onchange={handleChange}
></c-multi-select-combobox>
</template>
@svierk
svierk / parentComponent.js
Created June 8, 2022 20:42
Example of how to specify and access selectable as well currently selected option in LWC Combobox
export default class ParentComponent extends LightningElement {
options = [
{
label: 'Option 1',
value: 'option1'
},
{
label: 'Option 2',
value: 'option2'
},
@svierk
svierk / iFrame.html
Last active November 18, 2023 14:03
HTML template for iFrame LWC
<template>
<iframe
src={url}
height={height}
width={width}
title="iFrame"
></iframe>
</template>