Skip to content

Commit

Permalink
merging main with staging
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-bizz committed Aug 18, 2023
2 parents 837155d + f6c2331 commit 29013d1
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 17 deletions.
3 changes: 3 additions & 0 deletions app/scripts/directives/blockEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,12 @@ angular.module('confRegistrationWebApp').directive('blockEditor', function () {
$scope.typeToProfile.addressQuestion = 'ADDRESS';
$scope.typeToProfile.genderQuestion = 'GENDER';
$scope.typeToProfile.yearInSchoolQuestion = 'YEAR_IN_SCHOOL';
$scope.typeToProfile.opportunitiesQuestion = 'OPPORTUNITIES';
$scope.typeToProfile.birthDateQuestion = 'BIRTH_DATE';
$scope.typeToProfile.campusQuestion = 'CAMPUS';
$scope.typeToProfile.dormitoryQuestion = 'DORMITORY';
$scope.typeToProfile.graduationDateQuestion = 'GRADUATION_DATE';
$scope.typeToProfile.ethnicityQuestion = 'ETHNICITY';

$scope.profileCheck = !_.isNull($scope.block.profileType);
$scope.profileOption = _.has($scope.typeToProfile, $scope.block.type);
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/directives/questionToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ angular
{
id: 'campusQuestion',
defaultTitle:
'Campus- Type the full name of your campus and choose from the list that appears',
'Campus - Type the full name of your campus and choose from the list that appears',
defaultProfile: 'CAMPUS',
iconClass: 'fa-university',
name: 'Campus',
Expand Down Expand Up @@ -203,7 +203,7 @@ angular
{
id: 'ethnicityQuestion',
defaultTitle: 'Which race or ethnicity best describes you?',
defaultExportFieldTitle: 'Ethnicity',
defaultExportFieldTitle: 'Race/Ethnicity',
defaultProfile: 'ETHNICITY',
iconClass: 'fa-globe',
name: 'Racial/Ethnic Identity',
Expand Down
5 changes: 3 additions & 2 deletions app/views/blocks/campusQuestion.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
<input
type="text"
ng-model="answer.value"
ng-model-options="{ debounce: 100 }"
placeholder=""
autocomplete="off"
aria-autocomplete="none"
class="form-control"
show-errors
ng-required="block.required"
uib-typeahead="campus for campus in searchCampuses($viewValue)"
typeahead-loading="loadingCampuses"
typeahead-min-length="2"
typeahead-wait-ms="100"
typeahead-wait-ms="200"
typeahead-editable="false"
typeahead-no-results="campusNotFound"
typeahead-show-hint="true"
Expand Down
12 changes: 0 additions & 12 deletions app/views/components/blockEditor.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,6 @@
>
</div>

<div
class="help-block"
ng-if="block.type === 'opportunitiesQuestion' && !eventHasQuestionType('phoneQuestion')"
>
<i
><translate
>*Please remember to add a 'Telephone' question to this
form.</translate
></i
>
</div>

<div class="checkbox" ng-if="requiredOption && !block.adminOnly">
<label
><input type="checkbox" ng-model="block.required" />
Expand Down
13 changes: 12 additions & 1 deletion test/spec/directives/block.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ describe('Directive: blocks', () => {
$scope.block.content.showInternationalCampuses = true;
}));

it('searchCampuses params are formed correctly', () => {
it('forms the searchCampuses params correctly', () => {
$scope.block.content.showInternationalCampuses = true;
$compile('<campus-question></campus-question>')($scope);
$scope.$digest();

Expand All @@ -188,6 +189,16 @@ describe('Directive: blocks', () => {

expect($scope.params.includeInternational).toBeDefined();
});

it("doesn't add includeInternational", () => {
$scope.block.content.showInternationalCampuses = false;
$compile('<campus-question></campus-question>')($scope);
$scope.$digest();

$scope.searchCampuses('San');

expect($scope.params.includeInternational).not.toBeDefined();
});
});

describe('ethnicityQuestion', () => {
Expand Down
11 changes: 11 additions & 0 deletions test/spec/directives/blockEditor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,15 @@ describe('Directive: blockEditor', function () {

expect(scope.pType).toBe('Sex');
});

it('returns whether a question type exists or not using eventHasQuestionType()', function () {
const block = _.find(testData.conference.registrationPages[1].blocks, {
id: '9b83eebd-b064-4edf-92d0-7982a330272a',
});
scope.block = block;

expect(scope.eventHasQuestionType('genderQuestion')).toBe(true);

expect(scope.eventHasQuestionType('ethnicityQuestion')).toBe(false);
});
});

0 comments on commit 29013d1

Please sign in to comment.