0

I would appreciate guidance on how to jest test row action menu items.
Are there any reference docs, clear examples or advice, please? I am unable to find anything directly helpful.

SF general type code example :

import { LightningElement } from 'lwc'; 

const actions = [
    { label: 'Show details', name: 'show_details' },
    { label: 'Delete', name: 'delete' }
];

const columns = [
    // Other column data here
    { type: 'action', typeAttributes: { rowActions: actions, menuAlignment: 'left' } }
];

export default class DatatableExample extends LightningElement {
    data = [];
    columns = columns;

    handleRowAction(event) {
            const action = event.detail.action;
            const row = event.detail.row;
            switch (action.name) {
                case 'show_details':
                    this[NavigationMixin.Navigate]({
                         type: 'standard__recordPage',
                         attributes: {recordId: row.Id,actionName: 'view',},
                        });
                break;
                case 'delete':
                    this.deleteRow(row);
                break;
                default: 
                break;   
     }

    deleteRow(row){ 
          //code to delete row
     };

}

1 Answer 1

0

I believe now that I only need to test my code not SF component functionality. Apologies for the poor question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .