Budget Download
Budget Download
Budget Download
????????????????????
@api recordId;
@track excelSetupObject;
@track isInitialized = false;
@track isLogFile = false;
@track isLoading = false;
label = {
DOWNLOAD_BUDGET_ERROR_MSG,
FINANCIAL_ERROR
}
@api
invoke() {
this.showSpinner();
getBudgetExcelFieldSetsData({recordId : this.recordId}).then(response => {
if (response.isFinancialAccessible) {
if (response.hasErrorInSetup) {
this.showErrorToast(response.errorMessage, '', 'dismissible');
this.hideSpinner();
}
else {
this.excelSetupObject = response;
this.isInitialized = true;
}
}
else {
this.showErrorToast(this.label.FINANCIAL_ERROR, '', 'dismissible');
this.hideSpinner();
}
})
.catch(error => {
this.showErrorToast(this.label.DOWNLOAD_BUDGET_ERROR_MSG,
getErrorMesage(error), 'dismissible');
this.hideSpinner();
});
}
/**
* Spinner
*/
showSpinner() {
this.isLoading = true;
}
hideSpinner() {
this.isLoading = false;
}
onDownloadProcessingCompleted() {
this.resetDownload();
this.hideSpinner();
}
resetDownload() {
this.isInitialized = false;
this.isLogFile = false;
}
}
???????????????????????????????????
budgetDownload
????????????????????????????
describe('c-budget-download', () => {
afterEach(() => {
// The jsdom instance is shared across test cases in a single file so reset
the DOM
while (document.body.firstChild) {
document.body.removeChild(document.body.firstChild);
}
});
it('TODO: test case generated by CLI command, please fill in test logic', () =>
{
// Arrange
const element = createElement('c-budget-download', {
is: BudgetDownload
});
// Act
document.body.appendChild(element);
// Assert
// const div = element.shadowRoot.querySelector('div');
expect(1).toBe(1);
});
});