3 describe('crmCaseType', function() {
5 beforeEach(function() {
9 // CRM_Case_XMLProcessor::REL_TYPE_CNAME
11 'REL_TYPE_CNAME': 'label_b_a'
13 module('crmCaseType');
14 module('crmJsonComparator');
15 inject(function(crmJsonComparator
) {
16 crmJsonComparator
.register(jasmine
);
20 describe('CaseTypeCtrl', function() {
28 beforeEach(inject(function(_
$httpBackend_
, $rootScope
, $controller
, $compile
, $timeout
) {
29 $httpBackend
= _
$httpBackend_
;
30 scope
= $rootScope
.$new();
38 "option_group_id": "25",
51 "option_group_id": "25",
67 "option_group_id": "28",
81 "option_group_id": "28",
98 "option_group_id": "2",
99 "label": "ADC referral",
101 "name": "ADC referral",
112 "option_group_id": "2",
113 "label": "Add Client To Case",
115 "name": "Add Client To Case",
127 "option_group_id": "2",
128 "label": "Open Case",
138 "icon": "fa-folder-open-o"
142 "option_group_id": "2",
143 "label": "Medical evaluation",
145 "name": "Medical evaluation",
160 "name_a_b": "Benefits Specialist is",
161 "label_a_b": "Benefits Specialist is",
162 "name_b_a": "Benefits Specialist",
163 "label_b_a": "Benefits Specialist",
164 "description": "Benefits Specialist",
165 "contact_type_a": "Individual",
166 "contact_type_b": "Individual",
172 "name_a_b": "Case Coordinator is",
173 "label_a_b": "Case Coordinator is",
174 "name_b_a": "Case Coordinator",
175 "label_b_a": "Case Coordinator",
176 "description": "Case Coordinator",
177 "contact_type_a": "Individual",
178 "contact_type_b": "Individual",
186 "name": "housing_support",
187 "title": "Housing Support",
188 "description": "Help homeless individuals obtain temporary and long-term housing",
196 {"name": "Open Case", "max_instances": "1"}
200 "name": "standard_timeline",
201 "label": "Standard Timeline",
206 "status": "Completed"
209 "name": "Medical evaluation",
210 "reference_activity": "Open Case",
211 "reference_offset": "1",
212 "reference_select": "newest"
219 "name": "Homeless Services Coordinator",
227 ctrl
= $controller('CaseTypeCtrl', {$scope
: scope
, apiCalls
: apiCalls
});
230 it('should load activity statuses', function() {
231 expect(scope
.activityStatuses
).toEqualData(apiCalls
.actStatuses
.values
);
234 it('should load activity types', function() {
235 expect(scope
.activityTypes
['ADC referral']).toEqualData(apiCalls
.actTypes
.values
[0]);
238 it('addActivitySet should add an activitySet to the case type', function() {
239 scope
.addActivitySet('timeline');
240 var activitySets
= scope
.caseType
.definition
.activitySets
;
241 var newSet
= activitySets
[activitySets
.length
- 1];
242 expect(newSet
.name
).toBe('timeline_1');
243 expect(newSet
.timeline
).toBe('1');
244 expect(newSet
.label
).toBe('Timeline');
247 it('addActivitySet handles second timeline correctly', function() {
248 scope
.addActivitySet('timeline');
249 scope
.addActivitySet('timeline');
250 var activitySets
= scope
.caseType
.definition
.activitySets
;
251 var newSet
= activitySets
[activitySets
.length
- 1];
252 expect(newSet
.name
).toBe('timeline_2');
253 expect(newSet
.timeline
).toBe('1');
254 expect(newSet
.label
).toBe('Timeline #2');