-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create tab launcher and reorder recipes
- Loading branch information
Showing
9 changed files
with
134 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
force-app/main/default/flexipages/Workspace_API_Tab_Launcher.flexipage-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<flexiPageRegions> | ||
<itemInstances> | ||
<componentInstance> | ||
<componentName>workspaceAPI</componentName> | ||
<identifier>c_workspaceAPI</identifier> | ||
</componentInstance> | ||
</itemInstances> | ||
<name>region1</name> | ||
<type>Region</type> | ||
</flexiPageRegions> | ||
<masterLabel>Workspace API</masterLabel> | ||
<template> | ||
<name>flexipage:appHomeTemplateThreeColumns</name> | ||
</template> | ||
<type>AppPage</type> | ||
</FlexiPage> |
45 changes: 45 additions & 0 deletions
45
force-app/main/default/lwc/workspaceAPI/__tests__/workspaceAPI.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { createElement } from 'lwc'; | ||
import WorkspaceAPI from 'c/workspaceAPI'; | ||
import { getNavigateCalledWith } from 'lightning/navigation'; | ||
|
||
describe('c-workspace-api', () => { | ||
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); | ||
} | ||
// Prevent data saved on mocks from leaking between tests | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('navigates to Workspace API page when Take me there! button clicked', async () => { | ||
const API_NAME = 'Workspace_API'; | ||
const INPUT_TYPE = 'standard__navItemPage'; | ||
|
||
// Create component | ||
const element = createElement('c-workspace-api', { | ||
is: WorkspaceAPI | ||
}); | ||
document.body.appendChild(element); | ||
|
||
// Click button | ||
const buttonEl = element.shadowRoot.querySelector('lightning-button'); | ||
buttonEl.click(); | ||
|
||
// Verify the component under test called the correct navigate event | ||
// type and sent the expected recordId defined above | ||
const { pageReference } = getNavigateCalledWith(); | ||
expect(pageReference.type).toBe(INPUT_TYPE); | ||
expect(pageReference.attributes.apiName).toBe(API_NAME); | ||
}); | ||
|
||
it('is accessible', async () => { | ||
const element = createElement('c-workspace-api', { | ||
is: WorkspaceAPI | ||
}); | ||
document.body.appendChild(element); | ||
|
||
// Check accessibility | ||
await expect(element).toBeAccessible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<template> | ||
<lightning-card | ||
title="Workspace API" | ||
icon-name="standard:scheduling_workspace" | ||
> | ||
<div class="slds-text-align_center slds-var-m-around_medium"> | ||
To see the Workspace API examples in action, you'll need to open the | ||
"LWC Recipes Console App". If you are already there, open the | ||
Workspace API examples on a tab by clicking on this button. | ||
<p class="slds-var-m-around_medium"> | ||
<lightning-button | ||
label="Take me there!" | ||
onclick={navigateToWorkspaceAPIExamples} | ||
></lightning-button> | ||
</p> | ||
</div> | ||
</lightning-card> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { LightningElement, wire } from 'lwc'; | ||
import { NavigationMixin } from 'lightning/navigation'; | ||
import getSingleContact from '@salesforce/apex/ContactController.getSingleContact'; | ||
|
||
export default class Lds extends NavigationMixin(LightningElement) { | ||
@wire(getSingleContact) contact; | ||
|
||
navigateToWorkspaceAPIExamples() { | ||
this[NavigationMixin.Navigate]({ | ||
type: 'standard__navItemPage', | ||
attributes: { | ||
apiName: 'Workspace_API' | ||
} | ||
}); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
force-app/main/default/lwc/workspaceAPI/workspaceAPI.js-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>59.0</apiVersion> | ||
<isExposed>true</isExposed> | ||
<targets> | ||
<target>lightning__AppPage</target> | ||
<target>lightning__RecordPage</target> | ||
<target>lightning__HomePage</target> | ||
</targets> | ||
</LightningComponentBundle> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
force-app/main/default/tabs/Workspace_API_Tab_Launcher.tab-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<CustomTab xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<description>Created by Lightning App Builder</description> | ||
<flexiPage>Workspace_API_Tab_Launcher</flexiPage> | ||
<label>Workspace API Tab Launcher</label> | ||
<motif>Custom37: Bridge</motif> | ||
</CustomTab> |