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",
131 "name_a_b": "Benefits Specialist is",
132 "label_a_b": "Benefits Specialist is",
133 "name_b_a": "Benefits Specialist",
134 "label_b_a": "Benefits Specialist",
135 "description": "Benefits Specialist",
136 "contact_type_a": "Individual",
137 "contact_type_b": "Individual",
143 "name_a_b": "Case Coordinator is",
144 "label_a_b": "Case Coordinator is",
145 "name_b_a": "Case Coordinator",
146 "label_b_a": "Case Coordinator",
147 "description": "Case Coordinator",
148 "contact_type_a": "Individual",
149 "contact_type_b": "Individual",
157 "name": "housing_support",
158 "title": "Housing Support",
159 "description": "Help homeless individuals obtain temporary and long-term housing",
167 {"name": "Open Case", "max_instances": "1"}
171 "name": "standard_timeline",
172 "label": "Standard Timeline",
177 "status": "Completed"
180 "name": "Medical evaluation",
181 "reference_activity": "Open Case",
182 "reference_offset": "1",
183 "reference_select": "newest"
190 "name": "Homeless Services Coordinator",
198 ctrl
= $controller('CaseTypeCtrl', {$scope
: scope
, apiCalls
: apiCalls
});
201 it('should load activity statuses', function() {
202 expect(scope
.activityStatuses
).toEqualData(apiCalls
.actStatuses
.values
);
205 it('should load activity types', function() {
206 expect(scope
.activityTypes
['ADC referral']).toEqualData(apiCalls
.actTypes
.values
[0]);
209 it('addActivitySet should add an activitySet to the case type', function() {
210 scope
.addActivitySet('timeline');
211 var activitySets
= scope
.caseType
.definition
.activitySets
;
212 var newSet
= activitySets
[activitySets
.length
- 1];
213 expect(newSet
.name
).toBe('timeline_1');
214 expect(newSet
.timeline
).toBe('1');
215 expect(newSet
.label
).toBe('Timeline');
218 it('addActivitySet handles second timeline correctly', function() {
219 scope
.addActivitySet('timeline');
220 scope
.addActivitySet('timeline');
221 var activitySets
= scope
.caseType
.definition
.activitySets
;
222 var newSet
= activitySets
[activitySets
.length
- 1];
223 expect(newSet
.name
).toBe('timeline_2');
224 expect(newSet
.timeline
).toBe('1');
225 expect(newSet
.label
).toBe('Timeline #2');