Skip to content

Commit

Permalink
Added ability to hide the footer on the modal
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-baillie-ortoo committed Dec 14, 2021
1 parent 521a494 commit 9c285b0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ describe('c-modal', () => {
}
});

// TODO: test the cancel event

it( 'Component is set to visible, the title, contents and footer slots are shown', () => {
const element = createElement('c-modal', {
is: Modal
Expand Down Expand Up @@ -64,6 +62,25 @@ describe('c-modal', () => {
expect( footerDiv ).toBe( null );
});

it( 'Component is set to visible, and hideFooter is true, the title, contents are show, but the footer slot is not', () => {
const element = createElement('c-modal', {
is: Modal
});
element.visible = true;
element.hideFooter = true;

document.body.appendChild( element );

const titleDiv = element.shadowRoot.querySelector( 'slot[name="title"]' );
expect( titleDiv ).not.toBe( null );

const contentsDiv = element.shadowRoot.querySelector( 'slot[name="contents"]' );
expect( contentsDiv ).not.toBe( null );

const footerDiv = element.shadowRoot.querySelector( 'slot[name="footer"]' );
expect( footerDiv ).toBe( null );
});

it( 'Will issue a cancel event when "escape" is pressed', () => {

const element = createElement('c-modal', {
Expand Down
2 changes: 1 addition & 1 deletion framework/default/ortoo-core/default/lwc/modal/modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">
<slot name="contents"></slot>
</div>

<footer class="slds-modal__footer">
<footer class="slds-modal__footer" if:false={hideFooter}>
<div class="slds-align_absolute-center">
<slot name="footer"></slot>
</div>
Expand Down
1 change: 1 addition & 0 deletions framework/default/ortoo-core/default/lwc/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import CLOSE_LABEL from '@salesforce/label/c.ortoo_core_close';

export default class Modal extends LightningElement {
@api visible;
@api hideFooter = false;

labels = {
close: CLOSE_LABEL
Expand Down

0 comments on commit 9c285b0

Please sign in to comment.