From 965cf004a51d0a850bb97db54df4db82a624766d Mon Sep 17 00:00:00 2001 From: Dustin Breese Date: Mon, 6 Nov 2023 10:31:07 -0700 Subject: [PATCH 1/3] @W-14438732 - Creating missing LWCs and QAs --- .gitignore | 1 + .../__tests__/data/getRecord.json | 10 ++ .../__tests__/editContactRecord.test.js | 118 ++++++++++++++++++ .../editContactRecord/editContactRecord.css | 2 + .../editContactRecord/editContactRecord.html | 39 ++++++ .../editContactRecord/editContactRecord.js | 46 +++++++ .../editContactRecord.js-meta.xml | 14 +++ .../__tests__/data/getRecord.json | 10 ++ .../__tests__/editOpportunityRecord.test.js | 116 +++++++++++++++++ .../editOpportunityRecord.css | 2 + .../editOpportunityRecord.html | 39 ++++++ .../editOpportunityRecord.js | 44 +++++++ .../editOpportunityRecord.js-meta.xml | 14 +++ .../Contact.create.quickAction-meta.xml | 8 ++ .../Contact.edit.quickAction-meta.xml | 8 ++ .../Opportunity.create.quickAction-meta.xml | 8 ++ .../Opportunity.edit.quickAction-meta.xml | 8 ++ .../Opportunity.view.quickAction-meta.xml | 8 ++ 18 files changed, 495 insertions(+) create mode 100644 force-app/main/default/lwc/editContactRecord/__tests__/data/getRecord.json create mode 100644 force-app/main/default/lwc/editContactRecord/__tests__/editContactRecord.test.js create mode 100644 force-app/main/default/lwc/editContactRecord/editContactRecord.css create mode 100644 force-app/main/default/lwc/editContactRecord/editContactRecord.html create mode 100644 force-app/main/default/lwc/editContactRecord/editContactRecord.js create mode 100644 force-app/main/default/lwc/editContactRecord/editContactRecord.js-meta.xml create mode 100644 force-app/main/default/lwc/editOpportunityRecord/__tests__/data/getRecord.json create mode 100644 force-app/main/default/lwc/editOpportunityRecord/__tests__/editOpportunityRecord.test.js create mode 100644 force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.css create mode 100644 force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.html create mode 100644 force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.js create mode 100644 force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.js-meta.xml create mode 100644 force-app/main/default/quickActions/Contact.create.quickAction-meta.xml create mode 100644 force-app/main/default/quickActions/Contact.edit.quickAction-meta.xml create mode 100644 force-app/main/default/quickActions/Opportunity.create.quickAction-meta.xml create mode 100644 force-app/main/default/quickActions/Opportunity.edit.quickAction-meta.xml create mode 100644 force-app/main/default/quickActions/Opportunity.view.quickAction-meta.xml diff --git a/.gitignore b/.gitignore index 016e880..eb44849 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .localdevserver .DS_Store node_modules +__lwr_cache__ diff --git a/force-app/main/default/lwc/editContactRecord/__tests__/data/getRecord.json b/force-app/main/default/lwc/editContactRecord/__tests__/data/getRecord.json new file mode 100644 index 0000000..eaa137b --- /dev/null +++ b/force-app/main/default/lwc/editContactRecord/__tests__/data/getRecord.json @@ -0,0 +1,10 @@ +{ + "fields": { + "Name": { + "value": "Name Mock" + }, + "Phone": { + "value": "123-456-7890" + } + } + } \ No newline at end of file diff --git a/force-app/main/default/lwc/editContactRecord/__tests__/editContactRecord.test.js b/force-app/main/default/lwc/editContactRecord/__tests__/editContactRecord.test.js new file mode 100644 index 0000000..4c536c8 --- /dev/null +++ b/force-app/main/default/lwc/editContactRecord/__tests__/editContactRecord.test.js @@ -0,0 +1,118 @@ +import { createElement } from "lwc"; +import EditContactRecord from "c/editContactRecord"; +import { getRecord } from "lightning/uiRecordApi"; + +import CONTACT_NAME_FIELD from "@salesforce/schema/Contact.Name"; +import CONTACT_TITLE_FIELD from "@salesforce/schema/Contact.Title"; +import CONTACT_ACCOUNT_FIELD from "@salesforce/schema/Contact.AccountId"; +import CONTACT_PHONE_FIELD from "@salesforce/schema/Contact.Phone"; +import CONTACT_EMAIL_FIELD from "@salesforce/schema/Contact.Email"; +import CONTACT_MOBILE_FIELD from "@salesforce/schema/Contact.MobilePhone"; + +const mockRecord = require("./data/getRecord.json"); + +describe("c-edit-contact-record", () => { + 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("should correctly populate form and name field", () => { + const RECORD_ID = "003abcdefghijklmno"; + const OBJECT_API_NAME = "Contact"; + + const element = createElement("c-edit-contact-record", { + is: EditContactRecord, + }); + element.recordId = RECORD_ID; + element.objectApiName = OBJECT_API_NAME; + document.body.appendChild(element); + + // Emit mock record into the wired field - we have to do this after inserting into DOM + // for the component to receive updates. We will need to use a promise next to wait for + // DOM to re-render + // eslint-disable-next-line @lwc/lwc/no-unexpected-wire-adapter-usages + getRecord.emit(mockRecord); + + // let's ensure that the form is as expected + const INPUT_FIELDS = [ + CONTACT_NAME_FIELD, + CONTACT_TITLE_FIELD, + CONTACT_ACCOUNT_FIELD, + CONTACT_PHONE_FIELD, + CONTACT_EMAIL_FIELD, + CONTACT_MOBILE_FIELD, + ]; + + const form = element.shadowRoot.querySelector("lightning-record-edit-form"); + expect(form.recordId).toBe(RECORD_ID); + expect(form.objectApiName).toBe(OBJECT_API_NAME); + + const submitButton = element.shadowRoot.querySelector( + 'lightning-button[data-id="submit"]' + ); + expect(submitButton.type).toBe("submit"); + + const cancelButton = element.shadowRoot.querySelector( + 'lightning-button[data-id="cancel"]' + ); + expect(cancelButton.type).toBe("button"); + + const message = element.shadowRoot.querySelector("lightning-messages"); + expect(message).not.toBeNull(); + + // get the input fields and ensure they are in the correct order + const outputFieldNames = Array.from( + element.shadowRoot.querySelectorAll("lightning-input-field") + ).map((outputField) => outputField.fieldName); + expect(outputFieldNames).toEqual(INPUT_FIELDS); + + // Resolve a promise to wait for a re-render of the new content to include the name value + // that is built after the @wire executes. + return Promise.resolve().then(() => { + const displayName = element.shadowRoot.querySelector( + 'lightning-layout-item[data-id="name"]' + ); + + const mockedName = mockRecord.fields.Name.value; + + // eslint-disable-next-line @lwc/lwc/no-inner-html + expect(displayName.innerHTML).toContain(mockedName); + }); + }); + + it("should go back when clicking cancel button", () => { + const element = createElement("c-edit-contact-record", { + is: EditContactRecord, + }); + document.body.appendChild(element); + + // use a spy to ensure we called back() + const backSpy = jest.spyOn(window.history, "back"); + + const cancelButton = element.shadowRoot.querySelector( + 'lightning-button[data-id="cancel"]' + ); + cancelButton.click(); + + expect(backSpy).toHaveBeenCalled(); + }); + + it("should go back after success", () => { + const element = createElement("c-edit-contact-record", { + is: EditContactRecord, + }); + document.body.appendChild(element); + + const backSpy = jest.spyOn(window.history, "back"); + const form = element.shadowRoot.querySelector("lightning-record-edit-form"); + + form.dispatchEvent(new CustomEvent("success")); + + return Promise.resolve().then(() => { + expect(backSpy).toHaveBeenCalled(); + }); + }); +}); diff --git a/force-app/main/default/lwc/editContactRecord/editContactRecord.css b/force-app/main/default/lwc/editContactRecord/editContactRecord.css new file mode 100644 index 0000000..8a4236d --- /dev/null +++ b/force-app/main/default/lwc/editContactRecord/editContactRecord.css @@ -0,0 +1,2 @@ +@import 'c/commonStyles'; + diff --git a/force-app/main/default/lwc/editContactRecord/editContactRecord.html b/force-app/main/default/lwc/editContactRecord/editContactRecord.html new file mode 100644 index 0000000..2c6a736 --- /dev/null +++ b/force-app/main/default/lwc/editContactRecord/editContactRecord.html @@ -0,0 +1,39 @@ + \ No newline at end of file diff --git a/force-app/main/default/lwc/editContactRecord/editContactRecord.js b/force-app/main/default/lwc/editContactRecord/editContactRecord.js new file mode 100644 index 0000000..2fc348d --- /dev/null +++ b/force-app/main/default/lwc/editContactRecord/editContactRecord.js @@ -0,0 +1,46 @@ +import { LightningElement, api, wire } from "lwc"; +import { getRecord } from "lightning/uiRecordApi"; + +import CONTACT_NAME_FIELD from "@salesforce/schema/Contact.Name"; +import CONTACT_TITLE_FIELD from "@salesforce/schema/Contact.Title"; +import CONTACT_ACCOUNT_FIELD from "@salesforce/schema/Contact.AccountId"; +import CONTACT_PHONE_FIELD from "@salesforce/schema/Contact.Phone"; +import CONTACT_EMAIL_FIELD from "@salesforce/schema/Contact.Email"; +import CONTACT_MOBILE_FIELD from "@salesforce/schema/Contact.MobilePhone"; + +export default class EditContactRecord extends LightningElement { + @api recordId; + @api objectApiName; + + nameField = CONTACT_NAME_FIELD; + titleField = CONTACT_TITLE_FIELD; + accountField = CONTACT_ACCOUNT_FIELD; + phoneField = CONTACT_PHONE_FIELD; + emailField = CONTACT_EMAIL_FIELD; + mobileField = CONTACT_MOBILE_FIELD; + + @wire(getRecord, { recordId: "$recordId", fields: [CONTACT_NAME_FIELD] }) + record; + + get name() { + return this.record && + this.record.data && + this.record.data.fields && + this.record.data.fields.Name + ? this.record.data.fields.Name.value + : ""; + } + + onSuccess(event) { + console.log("Updated contact", event.detail); + // Dismiss modal on success + this.dismiss(event); + } + + dismiss(event) { + console.log("Dismissing modal", event.detail); + // TODO: Can we use window.history.back() here? + // eslint-disable-next-line no-restricted-globals + history.back(); + } +} diff --git a/force-app/main/default/lwc/editContactRecord/editContactRecord.js-meta.xml b/force-app/main/default/lwc/editContactRecord/editContactRecord.js-meta.xml new file mode 100644 index 0000000..75905bf --- /dev/null +++ b/force-app/main/default/lwc/editContactRecord/editContactRecord.js-meta.xml @@ -0,0 +1,14 @@ + + + 56.0 + true + + lightning__RecordPage + lightning__RecordAction + + + + ScreenAction + + + \ No newline at end of file diff --git a/force-app/main/default/lwc/editOpportunityRecord/__tests__/data/getRecord.json b/force-app/main/default/lwc/editOpportunityRecord/__tests__/data/getRecord.json new file mode 100644 index 0000000..8e9f42b --- /dev/null +++ b/force-app/main/default/lwc/editOpportunityRecord/__tests__/data/getRecord.json @@ -0,0 +1,10 @@ +{ + "fields": { + "Name": { + "value": "Name Mock" + }, + "Amount": { + "value": 123.45 + } + } + } \ No newline at end of file diff --git a/force-app/main/default/lwc/editOpportunityRecord/__tests__/editOpportunityRecord.test.js b/force-app/main/default/lwc/editOpportunityRecord/__tests__/editOpportunityRecord.test.js new file mode 100644 index 0000000..88e89d6 --- /dev/null +++ b/force-app/main/default/lwc/editOpportunityRecord/__tests__/editOpportunityRecord.test.js @@ -0,0 +1,116 @@ +import { createElement } from "lwc"; +import EditOpportunityRecord from "c/editOpportunityRecord"; +import { getRecord } from "lightning/uiRecordApi"; + +import OPPORTUNITY_NAME_FIELD from "@salesforce/schema/Opportunity.Name"; +import OPPORTUNITY_ACCOUNT_FIELD from "@salesforce/schema/Opportunity.AccountId"; +import OPPORTUNITY_CLOSE_DATE_FIELD from "@salesforce/schema/Opportunity.CloseDate"; +import OPPORTUNITY_AMOUNT_FIELD from "@salesforce/schema/Opportunity.Amount"; +import OPPORTUNITY_STAGENAME_FIELD from "@salesforce/schema/Opportunity.StageName"; + +const mockRecord = require("./data/getRecord.json"); + +describe("c-edit-opportunity-record", () => { + 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("should correctly populate form and name field", () => { + const RECORD_ID = "006abcdefghijklmno"; + const OBJECT_API_NAME = "Opportunity"; + + const element = createElement("c-edit-opportunity-record", { + is: EditOpportunityRecord, + }); + element.recordId = RECORD_ID; + element.objectApiName = OBJECT_API_NAME; + document.body.appendChild(element); + + // Emit mock record into the wired field - we have to do this after inserting into DOM + // for the component to receive updates. We will need to use a promise next to wait for + // DOM to re-render + // eslint-disable-next-line @lwc/lwc/no-unexpected-wire-adapter-usages + getRecord.emit(mockRecord); + + // let's ensure that the form is as expected + const INPUT_FIELDS = [ + OPPORTUNITY_NAME_FIELD, + OPPORTUNITY_ACCOUNT_FIELD, + OPPORTUNITY_CLOSE_DATE_FIELD, + OPPORTUNITY_AMOUNT_FIELD, + OPPORTUNITY_STAGENAME_FIELD, + ]; + + const form = element.shadowRoot.querySelector("lightning-record-edit-form"); + expect(form.recordId).toBe(RECORD_ID); + expect(form.objectApiName).toBe(OBJECT_API_NAME); + + const submitButton = element.shadowRoot.querySelector( + 'lightning-button[data-id="submit"]' + ); + expect(submitButton.type).toBe("submit"); + + const cancelButton = element.shadowRoot.querySelector( + 'lightning-button[data-id="cancel"]' + ); + expect(cancelButton.type).toBe("button"); + + const message = element.shadowRoot.querySelector("lightning-messages"); + expect(message).not.toBeNull(); + + // get the input fields and ensure they are in the correct order + const outputFieldNames = Array.from( + element.shadowRoot.querySelectorAll("lightning-input-field") + ).map((outputField) => outputField.fieldName); + expect(outputFieldNames).toEqual(INPUT_FIELDS); + + // Resolve a promise to wait for a re-render of the new content to include the name value + // that is built after the @wire executes. + return Promise.resolve().then(() => { + const displayName = element.shadowRoot.querySelector( + 'lightning-layout-item[data-id="name"]' + ); + + const mockedName = mockRecord.fields.Name.value; + + // eslint-disable-next-line @lwc/lwc/no-inner-html + expect(displayName.innerHTML).toContain(mockedName); + }); + }); + + it("should go back when clicking cancel button", () => { + const element = createElement("c-edit-opportunity-record", { + is: EditOpportunityRecord, + }); + document.body.appendChild(element); + + // use a spy to ensure we called back() + const backSpy = jest.spyOn(window.history, "back"); + + const cancelButton = element.shadowRoot.querySelector( + 'lightning-button[data-id="cancel"]' + ); + cancelButton.click(); + + expect(backSpy).toHaveBeenCalled(); + }); + + it("should go back after success", () => { + const element = createElement("c-edit-opportunity-record", { + is: EditOpportunityRecord, + }); + document.body.appendChild(element); + + const backSpy = jest.spyOn(window.history, "back"); + const form = element.shadowRoot.querySelector("lightning-record-edit-form"); + + form.dispatchEvent(new CustomEvent("success")); + + return Promise.resolve().then(() => { + expect(backSpy).toHaveBeenCalled(); + }); + }); +}); diff --git a/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.css b/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.css new file mode 100644 index 0000000..8a4236d --- /dev/null +++ b/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.css @@ -0,0 +1,2 @@ +@import 'c/commonStyles'; + diff --git a/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.html b/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.html new file mode 100644 index 0000000..f4e5cd9 --- /dev/null +++ b/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.html @@ -0,0 +1,39 @@ + \ No newline at end of file diff --git a/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.js b/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.js new file mode 100644 index 0000000..cf8e134 --- /dev/null +++ b/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.js @@ -0,0 +1,44 @@ +import { LightningElement, api, wire } from "lwc"; +import { getRecord } from "lightning/uiRecordApi"; + +import OPPORTUNITY_NAME_FIELD from "@salesforce/schema/Opportunity.Name"; +import OPPORTUNITY_ACCOUNT_FIELD from "@salesforce/schema/Opportunity.AccountId"; +import OPPORTUNITY_CLOSE_DATE_FIELD from "@salesforce/schema/Opportunity.CloseDate"; +import OPPORTUNITY_AMOUNT_FIELD from "@salesforce/schema/Opportunity.Amount"; +import OPPORTUNITY_STAGENAME_FIELD from "@salesforce/schema/Opportunity.StageName"; + +export default class EditOpportunityRecord extends LightningElement { + @api recordId; + @api objectApiName; + + nameField = OPPORTUNITY_NAME_FIELD; + accountField = OPPORTUNITY_ACCOUNT_FIELD; + closeDateField = OPPORTUNITY_CLOSE_DATE_FIELD; + amountField = OPPORTUNITY_AMOUNT_FIELD; + stageNameField = OPPORTUNITY_STAGENAME_FIELD; + + @wire(getRecord, { recordId: "$recordId", fields: [OPPORTUNITY_NAME_FIELD] }) + record; + + get name() { + return this.record && + this.record.data && + this.record.data.fields && + this.record.data.fields.Name + ? this.record.data.fields.Name.value + : ""; + } + + onSuccess(event) { + console.log("Updated opportunity", event.detail); + // Dismiss modal on success + this.dismiss(event); + } + + dismiss(event) { + console.log("Dismissing modal", event.detail); + // TODO: Can we use window.history.back() here? + // eslint-disable-next-line no-restricted-globals + history.back(); + } +} diff --git a/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.js-meta.xml b/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.js-meta.xml new file mode 100644 index 0000000..75905bf --- /dev/null +++ b/force-app/main/default/lwc/editOpportunityRecord/editOpportunityRecord.js-meta.xml @@ -0,0 +1,14 @@ + + + 56.0 + true + + lightning__RecordPage + lightning__RecordAction + + + + ScreenAction + + + \ No newline at end of file diff --git a/force-app/main/default/quickActions/Contact.create.quickAction-meta.xml b/force-app/main/default/quickActions/Contact.create.quickAction-meta.xml new file mode 100644 index 0000000..9715661 --- /dev/null +++ b/force-app/main/default/quickActions/Contact.create.quickAction-meta.xml @@ -0,0 +1,8 @@ + + + ScreenAction + + createContactRecord + false + LightningWebComponent + diff --git a/force-app/main/default/quickActions/Contact.edit.quickAction-meta.xml b/force-app/main/default/quickActions/Contact.edit.quickAction-meta.xml new file mode 100644 index 0000000..ea46f13 --- /dev/null +++ b/force-app/main/default/quickActions/Contact.edit.quickAction-meta.xml @@ -0,0 +1,8 @@ + + + ScreenAction + + editContactRecord + false + LightningWebComponent + diff --git a/force-app/main/default/quickActions/Opportunity.create.quickAction-meta.xml b/force-app/main/default/quickActions/Opportunity.create.quickAction-meta.xml new file mode 100644 index 0000000..ebe2eed --- /dev/null +++ b/force-app/main/default/quickActions/Opportunity.create.quickAction-meta.xml @@ -0,0 +1,8 @@ + + + ScreenAction + + createOpportunityRecord + false + LightningWebComponent + diff --git a/force-app/main/default/quickActions/Opportunity.edit.quickAction-meta.xml b/force-app/main/default/quickActions/Opportunity.edit.quickAction-meta.xml new file mode 100644 index 0000000..13316f5 --- /dev/null +++ b/force-app/main/default/quickActions/Opportunity.edit.quickAction-meta.xml @@ -0,0 +1,8 @@ + + + ScreenAction + + editOpportunityRecord + false + LightningWebComponent + diff --git a/force-app/main/default/quickActions/Opportunity.view.quickAction-meta.xml b/force-app/main/default/quickActions/Opportunity.view.quickAction-meta.xml new file mode 100644 index 0000000..88edca3 --- /dev/null +++ b/force-app/main/default/quickActions/Opportunity.view.quickAction-meta.xml @@ -0,0 +1,8 @@ + + + ScreenAction + + viewOpportunityRecord + false + LightningWebComponent + From 7330569fb30022cfa178623928bbac52d14b5da5 Mon Sep 17 00:00:00 2001 From: Dustin Breese Date: Mon, 6 Nov 2023 14:01:37 -0700 Subject: [PATCH 2/3] Didn't save this in IDE so it didn't show as a change and I missed it. --- .../quickActions/Opportunity.create.quickAction-meta.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/force-app/main/default/quickActions/Opportunity.create.quickAction-meta.xml b/force-app/main/default/quickActions/Opportunity.create.quickAction-meta.xml index ebe2eed..fdc60e6 100644 --- a/force-app/main/default/quickActions/Opportunity.create.quickAction-meta.xml +++ b/force-app/main/default/quickActions/Opportunity.create.quickAction-meta.xml @@ -1,7 +1,7 @@ ScreenAction - + createOpportunityRecord false LightningWebComponent From 0f677c38c2cbafec7205f4371615823c390a8c83 Mon Sep 17 00:00:00 2001 From: Dustin Breese Date: Mon, 6 Nov 2023 16:25:35 -0700 Subject: [PATCH 3/3] Fixing prettier issues. --- .../__tests__/editContactRecord.test.js | 10 +++++----- .../__tests__/editOpportunityRecord.test.js | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/force-app/main/default/lwc/editContactRecord/__tests__/editContactRecord.test.js b/force-app/main/default/lwc/editContactRecord/__tests__/editContactRecord.test.js index 4c536c8..622fea9 100644 --- a/force-app/main/default/lwc/editContactRecord/__tests__/editContactRecord.test.js +++ b/force-app/main/default/lwc/editContactRecord/__tests__/editContactRecord.test.js @@ -51,12 +51,12 @@ describe("c-edit-contact-record", () => { expect(form.objectApiName).toBe(OBJECT_API_NAME); const submitButton = element.shadowRoot.querySelector( - 'lightning-button[data-id="submit"]' + 'lightning-button[data-id="submit"]', ); expect(submitButton.type).toBe("submit"); const cancelButton = element.shadowRoot.querySelector( - 'lightning-button[data-id="cancel"]' + 'lightning-button[data-id="cancel"]', ); expect(cancelButton.type).toBe("button"); @@ -65,7 +65,7 @@ describe("c-edit-contact-record", () => { // get the input fields and ensure they are in the correct order const outputFieldNames = Array.from( - element.shadowRoot.querySelectorAll("lightning-input-field") + element.shadowRoot.querySelectorAll("lightning-input-field"), ).map((outputField) => outputField.fieldName); expect(outputFieldNames).toEqual(INPUT_FIELDS); @@ -73,7 +73,7 @@ describe("c-edit-contact-record", () => { // that is built after the @wire executes. return Promise.resolve().then(() => { const displayName = element.shadowRoot.querySelector( - 'lightning-layout-item[data-id="name"]' + 'lightning-layout-item[data-id="name"]', ); const mockedName = mockRecord.fields.Name.value; @@ -93,7 +93,7 @@ describe("c-edit-contact-record", () => { const backSpy = jest.spyOn(window.history, "back"); const cancelButton = element.shadowRoot.querySelector( - 'lightning-button[data-id="cancel"]' + 'lightning-button[data-id="cancel"]', ); cancelButton.click(); diff --git a/force-app/main/default/lwc/editOpportunityRecord/__tests__/editOpportunityRecord.test.js b/force-app/main/default/lwc/editOpportunityRecord/__tests__/editOpportunityRecord.test.js index 88e89d6..faaa1f4 100644 --- a/force-app/main/default/lwc/editOpportunityRecord/__tests__/editOpportunityRecord.test.js +++ b/force-app/main/default/lwc/editOpportunityRecord/__tests__/editOpportunityRecord.test.js @@ -49,12 +49,12 @@ describe("c-edit-opportunity-record", () => { expect(form.objectApiName).toBe(OBJECT_API_NAME); const submitButton = element.shadowRoot.querySelector( - 'lightning-button[data-id="submit"]' + 'lightning-button[data-id="submit"]', ); expect(submitButton.type).toBe("submit"); const cancelButton = element.shadowRoot.querySelector( - 'lightning-button[data-id="cancel"]' + 'lightning-button[data-id="cancel"]', ); expect(cancelButton.type).toBe("button"); @@ -63,7 +63,7 @@ describe("c-edit-opportunity-record", () => { // get the input fields and ensure they are in the correct order const outputFieldNames = Array.from( - element.shadowRoot.querySelectorAll("lightning-input-field") + element.shadowRoot.querySelectorAll("lightning-input-field"), ).map((outputField) => outputField.fieldName); expect(outputFieldNames).toEqual(INPUT_FIELDS); @@ -71,7 +71,7 @@ describe("c-edit-opportunity-record", () => { // that is built after the @wire executes. return Promise.resolve().then(() => { const displayName = element.shadowRoot.querySelector( - 'lightning-layout-item[data-id="name"]' + 'lightning-layout-item[data-id="name"]', ); const mockedName = mockRecord.fields.Name.value; @@ -91,7 +91,7 @@ describe("c-edit-opportunity-record", () => { const backSpy = jest.spyOn(window.history, "back"); const cancelButton = element.shadowRoot.querySelector( - 'lightning-button[data-id="cancel"]' + 'lightning-button[data-id="cancel"]', ); cancelButton.click();