Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setPage(tagName, component, props = {}) {
const el = createElement(tagName, {
is: component,
fallback: false,
});
Object.assign(el, props);
// Remove previous components from the container if necessary
const container = this.template.querySelector('.container');
while (container.firstChild) {
container.removeChild(container.firstChild);
}
container.appendChild(el);
}
}
it('registers with dependecy manager', () => {
const element = createElement('lightningtest-mock-record-edit-holder', {
is: MockRecordHolder
});
element.objectApiName = 'Bad_Guy__c';
element.showPicklist = true;
window.PICKLIST_REPRESENTATION = picklistRepresentation;
window.DEPENDENCY_INFO = null;
document.body.appendChild(element);
return new Promise((resolve, reject) => {
element.addEventListener('load', () => {
try {
expect(mockConstructor).toHaveBeenCalledWith(
expect.objectContaining({
dependentFields: undefined,
picklistValues: expect.any(Object)
})
const createFormattedTimeComponent = () => {
const element = createElement('c-formatted-time', {
is: Element
});
document.body.appendChild(element);
return element;
};
const createSectionWithMock = mock => {
const element = createElement('c-accordion-section', {
is: Element
});
const parentDiv = document.createElement('div');
document.body.appendChild(parentDiv);
parentDiv.addEventListener('privateaccordionsectionregister', mock);
parentDiv.appendChild(element);
return element;
};
const createComponent = () => {
const element = createElement('c-formatted-number', {
is: Element
});
document.body.appendChild(element);
return element;
};
const createButtonMenu = () => {
const element = createElement('c-button-menu', { is: Element });
document.body.appendChild(element);
return element;
};
const createComponent = (params = {}) => {
const element = createElement('c-tile', {
is: Element
});
element.label = TILE_TITLE;
Object.assign(element, params);
document.body.appendChild(element);
return element;
};
const createIcon = () => {
const element = createElement('c-icon', { is: Element });
document.body.appendChild(element);
return element;
};
const createComponent = () => {
const element = createElement('c-formatted-text', { is: Element });
document.body.appendChild(element);
return element;
};
const exampleText =
before(() => {
tableElement = createElement('benchmark-table-component', { is: Table });
return insertTableComponent(tableElement);
});