forcedotcom / LightningTestingService

Apache License 2.0
122 stars 35 forks source link

Unable to handle lightning:tab components #44

Closed Vanathi21 closed 6 years ago

Vanathi21 commented 6 years ago

We have referred the workaround suggested for lightning buttons and tried up with aura:method to expose the controller actions. Now we have a case where we dont have logic defined in controller actions. Necessary items where defined in the lightning:tab itself.need to switch between the tabs. sample snippet :

<lightning:tabset>
            <lightning:tab label="label1">
             </lightning:tab>
 <lightning:tab label="label2">
             </lightning:tab>
 </lightning:tabset>

Can you please suggest some workaround to handle the lightning:tab ?

esalman-sfdc commented 6 years ago

As the interface of tab and tabset is very restrictive (no programmatic access to the content they host), I think the best option would be to test components which get hosted in the tabs in isolation, and keep the amount of logic which composes the UI into tabs etc. to bare minimum.

For example,

<lightning:tab label="detail">
<c:myRecordDetails>
</lightning:tab>

Now as most the custom javascript logic would be inside c:myRecordDetails that could be tested in isolation.