-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bump node dependencies * Bump api version to v48.0 * Increased code coverage * Sortable search results * Updated prettier settings * Fixed selection public property reassignment
- Loading branch information
Showing
23 changed files
with
1,737 additions
and
2,345 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
src-sample/main/default/aura/SampleLookupApp/SampleLookupApp.app-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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<AuraDefinitionBundle xmlns="urn:metadata.tooling.soap.sforce.com" fqn="SampleLookupApp"> | ||
<apiVersion>47.0</apiVersion> | ||
<apiVersion>48.0</apiVersion> | ||
<description>A Lightning Application Bundle</description> | ||
</AuraDefinitionBundle> |
7 changes: 1 addition & 6 deletions
7
src-sample/main/default/aura/SampleLookupAppTemplate/SampleLookupAppTemplate.cmp
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 |
---|---|---|
@@ -1,11 +1,6 @@ | ||
<aura:component isTemplate="true" extends="aura:template"> | ||
<aura:set attribute="auraResetStyle" value="" /> | ||
<aura:set attribute="auraPreInitBlock"> | ||
<auraStorage:init | ||
name="actions" | ||
persistent="false" | ||
secure="false" | ||
maxSize="1024" | ||
/> | ||
<auraStorage:init name="actions" persistent="false" secure="false" maxSize="1024" /> | ||
</aura:set> | ||
</aura:component> |
2 changes: 1 addition & 1 deletion
2
src-sample/main/default/aura/SampleLookupAppTemplate/SampleLookupAppTemplate.cmp-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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<AuraDefinitionBundle xmlns="urn:metadata.tooling.soap.sforce.com" fqn="SampleLookupAppTemplate"> | ||
<apiVersion>47.0</apiVersion> | ||
<apiVersion>48.0</apiVersion> | ||
<description>A Lightning Component Bundle</description> | ||
</AuraDefinitionBundle> |
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
2 changes: 1 addition & 1 deletion
2
src-sample/main/default/classes/SampleLookupController.cls-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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="urn:metadata.tooling.soap.sforce.com" fqn="SampleLookupController"> | ||
<apiVersion>47.0</apiVersion> | ||
<apiVersion>48.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
41 changes: 23 additions & 18 deletions
41
src-sample/main/default/classes/SampleLookupControllerTest.cls
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 |
---|---|---|
@@ -1,43 +1,48 @@ | ||
@isTest | ||
@isTest(isParallel=true) | ||
public class SampleLookupControllerTest { | ||
static testMethod void search_should_return_Account() { | ||
Id[] fixedResults = new List<Id>(1); | ||
Account account = createTestAccount('Account'); | ||
@isTest | ||
static void search_should_return_Account_and_Opportunity() { | ||
List<Id> fixedResults = new List<Id>(2); | ||
Account account = createAccount('Account'); | ||
fixedResults.add(account.Id); | ||
Opportunity oppty = createOpportunity('Oppty'); | ||
fixedResults.add(oppty.Id); | ||
Test.setFixedSearchResults(fixedResults); | ||
List<String> selectedIds = new List<String>(); | ||
|
||
List<LookupSearchResult> results = SampleLookupController.search( | ||
'Acc', | ||
selectedIds | ||
); | ||
List<LookupSearchResult> results = SampleLookupController.search('Acc', selectedIds); | ||
|
||
System.assertEquals(1, results.size()); | ||
System.assertEquals(2, results.size()); | ||
System.assertEquals(account.Id, results.get(0).getId()); | ||
System.assertEquals(oppty.Id, results.get(1).getId()); | ||
} | ||
|
||
static testMethod void search_should_not_return_selected_item() { | ||
Id[] fixedResults = new List<Id>(1); | ||
Account account1 = createTestAccount('Account1'); | ||
@isTest | ||
static void search_should_not_return_selected_item() { | ||
List<Id> fixedResults = new List<Id>(2); | ||
Account account1 = createAccount('Account1'); | ||
fixedResults.add(account1.Id); | ||
Account account2 = createTestAccount('Account2'); | ||
Account account2 = createAccount('Account2'); | ||
fixedResults.add(account2.Id); | ||
Test.setFixedSearchResults(fixedResults); | ||
List<String> selectedIds = new List<String>(); | ||
selectedIds.add(account2.Id); | ||
|
||
List<LookupSearchResult> results = SampleLookupController.search( | ||
'Acc', | ||
selectedIds | ||
); | ||
List<LookupSearchResult> results = SampleLookupController.search('Acc', selectedIds); | ||
|
||
System.assertEquals(1, results.size()); | ||
System.assertEquals(account1.Id, results.get(0).getId()); | ||
} | ||
|
||
private static Account createTestAccount(String name) { | ||
private static Account createAccount(String name) { | ||
Account account = new Account(Name = name); | ||
insert account; | ||
return account; | ||
} | ||
|
||
private static Opportunity createOpportunity(String name) { | ||
Opportunity oppty = new Opportunity(Name = name, StageName = 'open', CloseDate = Date.today()); | ||
insert oppty; | ||
return oppty; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src-sample/main/default/classes/SampleLookupControllerTest.cls-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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="urn:metadata.tooling.soap.sforce.com" fqn="SampleLookupControllerTest"> | ||
<apiVersion>47.0</apiVersion> | ||
<apiVersion>48.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
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
2 changes: 1 addition & 1 deletion
2
src-sample/main/default/lwc/sampleLookupContainer/sampleLookupContainer.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="urn:metadata.tooling.soap.sforce.com" fqn="LookupSearchResult"> | ||
<apiVersion>47.0</apiVersion> | ||
<apiVersion>48.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
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,58 @@ | ||
@isTest(isParallel=true) | ||
public class LookupSearchResultTests { | ||
@isTest | ||
static void compareTo_should_work_with_two_null_titles() { | ||
LookupSearchResult r1 = getSearchResult(null); | ||
LookupSearchResult r2 = getSearchResult(null); | ||
|
||
Integer compareResult = r1.compareTo(r2); | ||
|
||
System.assertEquals(0, compareResult); | ||
} | ||
|
||
@isTest | ||
static void compareTo_should_work_with_this_null_title() { | ||
LookupSearchResult r1 = getSearchResult(null); | ||
LookupSearchResult r2 = getSearchResult('a'); | ||
|
||
Integer compareResult = r1.compareTo(r2); | ||
|
||
System.assertEquals(1, compareResult); | ||
} | ||
|
||
@isTest | ||
static void compareTo_should_work_with_other_null_title() { | ||
LookupSearchResult r1 = getSearchResult('a'); | ||
LookupSearchResult r2 = getSearchResult(null); | ||
|
||
Integer compareResult = r1.compareTo(r2); | ||
|
||
System.assertEquals(-1, compareResult); | ||
} | ||
|
||
@isTest | ||
static void compareTo_should_work_with_non_null_titles() { | ||
LookupSearchResult r1 = getSearchResult('a'); | ||
LookupSearchResult r2 = getSearchResult('b'); | ||
|
||
Integer compareResult = r1.compareTo(r2); | ||
|
||
System.assertEquals(-1, compareResult); | ||
} | ||
|
||
@isTest | ||
static void getters_should_work() { | ||
// For the sake of code coverage | ||
LookupSearchResult r = new LookupSearchResult('0010R00000yvEyRQAU', 'type', 'icon', 'title', 'subtitle'); | ||
|
||
System.assertEquals('0010R00000yvEyRQAU', r.getId()); | ||
System.assertEquals('type', r.getSObjectType()); | ||
System.assertEquals('icon', r.getIcon()); | ||
System.assertEquals('title', r.getTitle()); | ||
System.assertEquals('subtitle', r.getSubtitle()); | ||
} | ||
|
||
private static LookupSearchResult getSearchResult(String title) { | ||
return new LookupSearchResult(null, null, null, title, null); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/default/classes/LookupSearchResultTests.cls-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,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>48.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
Oops, something went wrong.