Skip to content

Commit

Permalink
Enhancements to the filter and results
Browse files Browse the repository at this point in the history
Added ability to disable the search button
Split slots for the action buttons - not supposed to have 2 slots with the same name
Added ability to specify a search type - for future expansion
  • Loading branch information
rob-baillie-ortoo committed Jan 25, 2022
1 parent 89bffc0 commit 103bfdf
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ describe( 'c-filter-and-results', () => {
.then( () => {
expect( element.shadowRoot.querySelector( 'slot[name="info"]' ) ).not.toBeNull();
expect( element.shadowRoot.querySelector( 'slot[name="form"]' ) ).not.toBeNull();
expect( element.shadowRoot.querySelector( 'slot[name="action-buttons"]' ) ).not.toBeNull();
expect( element.shadowRoot.querySelector( 'slot[name="action-buttons-top"]' ) ).not.toBeNull();
expect( element.shadowRoot.querySelector( 'slot[name="action-buttons-bottom"]' ) ).not.toBeNull();
expect( element.shadowRoot.querySelector( 'slot[name="data"]' ) ).not.toBeNull();
})
});
Expand Down Expand Up @@ -62,6 +63,30 @@ describe( 'c-filter-and-results', () => {
})
});

it( 'when disableSearchButton is set to true, will disable the search button', () => {

const element = document.body.querySelector( 'c-filter-and-result' );

element.disableSearchButton = true;

return Promise.resolve()
.then( () => {
expect( element.shadowRoot.querySelector( SEARCH_BUTTON_SELECTOR ).disabled ).toBe( true );
});
});

it( 'when disableSearchButton is set to false, will enable the search button', () => {

const element = document.body.querySelector( 'c-filter-and-result' );

element.disableSearchButton = false;

return Promise.resolve()
.then( () => {
expect( element.shadowRoot.querySelector( SEARCH_BUTTON_SELECTOR ).disabled ).toBe( false );
});
});

it( 'when showPaginationControls flag is set to true will show pagination controls above and below the data', () => {

const element = document.body.querySelector( 'c-filter-and-result' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
variant="brand"
label={labels.searchButton}
title={labels.searchButtonTitle}
disabled={disableSearchButton}
onclick={handleSearchClicked}
></lightning-button>

Expand All @@ -40,7 +41,7 @@
<lightning-layout class="slds-p-bottom_small">

<lightning-layout-item>
<slot name="action-buttons"></slot>
<slot name="action-buttons-top"></slot>
</lightning-layout-item>

<lightning-layout-item flexibility="grow"></lightning-layout-item>
Expand All @@ -63,7 +64,7 @@
<lightning-layout class="slds-p-top_small">

<lightning-layout-item>
<slot name="action-buttons"></slot>
<slot name="action-buttons-bottom"></slot>
</lightning-layout-item>

<lightning-layout-item flexibility="grow"></lightning-layout-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ export default class FilterAndResults extends LightningElement {

@api title;
@api loading;
@api disableSearchButton;
@api showPaginationControls;
@api numberOfRecords;
@api offset;
@api recordsWindowSize;

@api searchType;


connectedCallback() {
configureElementIdGenerator( this );
}
Expand Down

0 comments on commit 103bfdf

Please sign in to comment.