Skip to content
This repository has been archived by the owner on Aug 1, 2019. It is now read-only.

Aura Factory

Yuriy Sannikov edited this page Jul 23, 2017 · 1 revision

Aura factory creates global $A object. You can specify global labels, application events and components during creation of aura global object. A good practice is to create aura object before each test. In this example global aura object is populated with label values (actual value does not matter, you can put any short name) so any call for $A.get('$Label.c.Reg_Process_Agenda') will return Reg_Process_Agenda. Also there are 3 events. You don't need to add all events at once. Add it while you need it.

beforeEach(function() {
    const registrationToolbarUpdateEvent = eventFactory();
    const registrationProcessChangeEvent = eventFactory();
    const showComponentEvent = eventFactory();
    global.$A = auraFactory({
        '$Label.c.Attendee_Selection_Title': 'Attendee_Selection_Title',
        'e.Framework:ShowComponentEvent' : showComponentEvent,
        '$Label.c.All_Attendees_Required': 'All_Attendees_Required',
        'e.c:RegistrationToolbarUpdateEvent': registrationToolbarUpdateEvent,
        'e.c:RegistrationProcessChangeEvent': registrationProcessChangeEvent,
        '$Label.c.Reg_Process_Select_Tickets':'Reg_Process_Select_Tickets',
        '$Label.c.Reg_Process_Payment': 'Reg_Process_Payment',
        '$Label.c.Registration_Summary': 'Registration_Summary',
        '$Label.c.Registration_Forms': 'Registration_Forms',
        '$Label.c.Reg_Process_Agenda': 'Reg_Process_Agenda'
  });
});
Clone this wiki locally