diff --git a/app/tests/libs/send-email-notifications.test.js b/app/tests/libs/send-email-notifications.test.js index cdf0cca7..c0002da3 100644 --- a/app/tests/libs/send-email-notifications.test.js +++ b/app/tests/libs/send-email-notifications.test.js @@ -10,9 +10,9 @@ var emailNotifications = require('../../libs/send-email-notifications'), * Globals */ var validFormFields = [ - {fieldType:'textfield', title:'First Name', fieldValue: 'John Smith', deletePreserved: false, _id:'56340745f59a6fc9e22028e9'}, - {fieldType:'link', title:'Your Website', fieldValue: 'https://johnsmith.me', deletePreserved: false, _id:'5c9e22028e907634f45f59a6'}, - {fieldType:'number', title:'Your Age', fieldValue: 45, deletePreserved: false, _id:'56e90745f5934fc9e22028a6'} + {fieldType:'textfield', title:'First Name', fieldValue: 'John Smith', deletePreserved: false, globalId:'56340745f59a6fc9e22028e9'}, + {fieldType:'link', title:'Your Website', fieldValue: 'https://johnsmith.me', deletePreserved: false, globalId:'5c9e22028e907634f45f59a6'}, + {fieldType:'number', title:'Your Age', fieldValue: 45, deletePreserved: false, globalId:'56e90745f5934fc9e22028a6'} ]; var validFieldDict = { diff --git a/app/views/form.server.view.pug b/app/views/form.server.view.pug index e9332158..4e246ac6 100644 --- a/app/views/form.server.view.pug +++ b/app/views/form.server.view.pug @@ -78,13 +78,14 @@ html(lang='en', xmlns='http://www.w3.org/1999/xhtml') //Socket.io Client Dependency script(src='/static/lib/socket.io-client/dist/socket.io.min.js') - script(src='/static/lib/jquery-ui/jquery-ui.js', type='text/javascript') - script(src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js', integrity='sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa', crossorigin='anonymous') //Minified Bower Dependencies script(src='/static/dist/vendor.min.js') script(src='/static/lib/angular-ui-date/src/date.js', type='text/javascript') + script(src='/static/lib/jquery-ui/jquery-ui.js', type='text/javascript') + script(src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js', integrity='sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa', crossorigin='anonymous') + //Application JavaScript Files each jsFile in formJSFiles script(type='text/javascript', src=jsFile) diff --git a/app/views/index.server.view.pug b/app/views/index.server.view.pug index 56f6d3e6..0d0c17fc 100644 --- a/app/views/index.server.view.pug +++ b/app/views/index.server.view.pug @@ -3,7 +3,7 @@ extends layout.server.view.pug block content section.content(ui-view='', ng-cloak='') - link(rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.8.5/css/selectize.default.css') + link(rel='stylesheet', href='/static/lib/jquery-ui/themes/flick/jquery-ui.min.css') script(src='/static/lib/jquery/jquery.min.js') diff --git a/app/views/layout.server.view.pug b/app/views/layout.server.view.pug index 65bb2172..7509f3a2 100644 --- a/app/views/layout.server.view.pug +++ b/app/views/layout.server.view.pug @@ -40,7 +40,6 @@ html(lang='en', xmlns='http://www.w3.org/1999/xhtml') link(rel='stylesheet', href=bowerCssFile) link(rel='stylesheet', href='/static/lib/angular-input-stars/angular-input-stars.css') link(rel='stylesheet', href='/static/lib/jquery-ui/themes/flick/jquery-ui.css') - link(rel='stylesheet', href='/static/modules/core/css/github-fork-ribbon.css') // end Bower CSS dependencies //Application CSS Files diff --git a/bower.json b/bower.json index b36dd8df..4336c3ac 100755 --- a/bower.json +++ b/bower.json @@ -43,7 +43,8 @@ "angular-strap": "^2.3.12", "textAngular": "^1.5.16", "angular-ui-select": "^0.19.8", - "angular-bootstrap-switch": "^0.5.2" + "angular-bootstrap-switch": "^0.5.2", + "jquery": "^3.2.1" }, "resolutions": { "angular-bootstrap": "^0.14.0", @@ -53,7 +54,8 @@ "angular-ui-sortable": "^0.17.1", "angular-ui-date": "~0.0.11", "angular-input-stars-directive": "master", - "angular-ui-select": "^0.19.8" + "angular-ui-select": "^0.19.8", + "jquery": "^3.2.1" }, "overrides": { "BOWER-PACKAGE": { diff --git a/public/dist/form_populate_template_cache.js b/public/dist/form_populate_template_cache.js index 3e094dc7..e9c798fb 100644 --- a/public/dist/form_populate_template_cache.js +++ b/public/dist/form_populate_template_cache.js @@ -12,7 +12,7 @@ angular.module('TellForm-Form.form_templates', []).run(['$templateCache', functi $templateCache.put("form_modules/forms/base/views/directiveViews/field/date.html", "

{{index+1}} {{field.title}} {{ 'OPTIONAL' | translate }}

{{field.description}}

"); $templateCache.put("form_modules/forms/base/views/directiveViews/field/dropdown.html", - "
0\">

{{index+1}} {{field.title}} {{ 'OPTIONAL' | translate }}

{{field.description}}


"); + "
0\">

{{index+1}} {{field.title}} {{ 'OPTIONAL' | translate }}

{{field.description}}


"); $templateCache.put("form_modules/forms/base/views/directiveViews/field/hidden.html", ""); $templateCache.put("form_modules/forms/base/views/directiveViews/field/legal.html", diff --git a/public/form_modules/forms/base/css/form.css b/public/form_modules/forms/base/css/form.css index 2a9665bd..f8dbfdf6 100644 --- a/public/form_modules/forms/base/css/form.css +++ b/public/form_modules/forms/base/css/form.css @@ -372,7 +372,6 @@ div.config-form .row.field { background-color:#efefef; } - /*Styles for add fields tab*/ .admin-form .add-field { background-color: #ddd; @@ -389,10 +388,6 @@ div.config-form .row.field { border-radius: 4px; } - .admin-form .oscar-field-select { - margin: 10px 0 10px; - } - .view-form-btn.span { padding-right:0.6em; } diff --git a/public/form_modules/forms/base/views/directiveViews/field/dropdown.html b/public/form_modules/forms/base/views/directiveViews/field/dropdown.html index 21151b22..b3ac8087 100755 --- a/public/form_modules/forms/base/views/directiveViews/field/dropdown.html +++ b/public/form_modules/forms/base/views/directiveViews/field/dropdown.html @@ -15,19 +15,17 @@
- + diff --git a/public/modules/forms/admin/views/adminTabs/configure.html b/public/modules/forms/admin/views/adminTabs/configure.html index f4a971ff..e8b52e02 100644 --- a/public/modules/forms/admin/views/adminTabs/configure.html +++ b/public/modules/forms/admin/views/adminTabs/configure.html @@ -1,2 +1,4 @@ + + \ No newline at end of file diff --git a/public/modules/forms/base/css/form.css b/public/modules/forms/base/css/form.css index 03537d98..a3e97b4e 100644 --- a/public/modules/forms/base/css/form.css +++ b/public/modules/forms/base/css/form.css @@ -224,13 +224,13 @@ form .row.field { font-size:0.8em; } - form .row.field.dropdown > .field-input input { + form .dropdown > .field-input input { min-height: 34px; border-width: 0 0 2px 0; border-radius: 5px; } - form .row.field.dropdown > .field-input input:focus { + form .dropdown > .field-input input:focus { border: none; } diff --git a/public/modules/forms/tests/unit/controllers/admin-form.client.controller.test.js b/public/modules/forms/tests/unit/controllers/admin-form.client.controller.test.js index d49d8914..99a1c438 100644 --- a/public/modules/forms/tests/unit/controllers/admin-form.client.controller.test.js +++ b/public/modules/forms/tests/unit/controllers/admin-form.client.controller.test.js @@ -10,7 +10,8 @@ $httpBackend, $stateParams, $location, - $state; + $state, + $timeout; var sampleUser = { firstName: 'Full', @@ -175,7 +176,7 @@ // The injector ignores leading and trailing underscores here (i.e. _$httpBackend_). // This allows us to inject a service but then attach it to a variable // with the same name as the service. - beforeEach(inject(function($controller, $rootScope, _$state_, _$location_, _$stateParams_, _$httpBackend_, CurrentForm, Forms) { + beforeEach(inject(function($controller, $rootScope, _$state_, _$location_, _$stateParams_, _$httpBackend_, CurrentForm, Forms, _$timeout_) { // Set a new global scope scope = $rootScope.$new(); @@ -187,6 +188,7 @@ $httpBackend = _$httpBackend_; $location = _$location_; $state = _$state_; + $timeout = _$timeout_; $httpBackend.whenGET(/\.html$/).respond(''); $httpBackend.whenGET('/users/me/').respond(''); @@ -197,60 +199,70 @@ }; })); - it('AdminFormController should fetch current Form when instantiated', function() { - // Run controller functionality - var controller = createAdminFormController(); + it('AdminFormController should fetch current Form when instantiated', inject(function($timeout) { + $timeout(function() { + // Run controller functionality + var controller = createAdminFormController(); - // Test scope value - expect(scope.myform).toEqualData(sampleForm); - }); - - it('$scope.removeCurrentForm() with valid form data should send a DELETE request with the id of form', inject(function($uibModal) { - var controller = createAdminFormController(); - - //Set $state transition - $state.expectTransitionTo('listForms'); - - // Set DELETE response - $httpBackend.expect('DELETE', /^(\/forms\/)([0-9a-fA-F]{24})$/).respond(200, sampleForm); - - //Run controller functionality - scope.openDeleteModal(); - scope.removeCurrentForm(); - - $httpBackend.flush(); - $state.ensureAllTransitionsHappened(); + // Test scope value + expect(scope.myform).toEqualData(sampleForm); + }); })); - it('$scope.update() should send a PUT request with the id of form', function() { - var controller = createAdminFormController(); + it('$scope.removeCurrentForm() with valid form data should send a DELETE request with the id of form', inject(function($timeout, $uibModal) { + $timeout(function() { + var controller = createAdminFormController(); - //Set PUT response - $httpBackend.expect('PUT', /^(\/forms\/)([0-9a-fA-F]{24})$/).respond(200, sampleForm); + //Set $state transition + $state.expectTransitionTo('listForms'); - //Run controller functionality - scope.update(false, sampleForm, false, false); + // Set DELETE response + $httpBackend.expect('DELETE', /^(\/forms\/)([0-9a-fA-F]{24})$/).respond(200, sampleForm); - $httpBackend.flush(); - }); + //Run controller functionality + scope.openDeleteModal(); + scope.removeCurrentForm(); - it('$scope.openDeleteModal() should open scope.deleteModal', function() { - var controller = createAdminFormController(); + $httpBackend.flush(); + $state.ensureAllTransitionsHappened(); + }); + })); - //Run controller functionality - scope.openDeleteModal(); - expect(scope.deleteModal.opened).toEqual(true); - }); + it('$scope.update() should send a PUT request with the id of form', inject(function($timeout) { + $timeout(function() { + var controller = createAdminFormController(); - it('$scope.cancelDeleteModal() should close $scope.deleteModal', inject(function($uibModal) { - var controller = createAdminFormController(); + //Set PUT response + $httpBackend.expect('PUT', /^(\/forms\/)([0-9a-fA-F]{24})$/).respond(200, sampleForm); - //Run controller functionality - scope.openDeleteModal(); + //Run controller functionality + scope.update(false, sampleForm, false, false); - //Run controller functionality - scope.cancelDeleteModal(); - expect( scope.deleteModal.opened ).toEqual(false); + $httpBackend.flush(); + }); + })); + + it('$scope.openDeleteModal() should open scope.deleteModal', inject(function($timeout) { + $timeout(function() { + var controller = createAdminFormController(); + + //Run controller functionality + scope.openDeleteModal(); + expect(scope.deleteModal.opened).toEqual(true); + }); + })); + + it('$scope.cancelDeleteModal() should close $scope.deleteModal', inject(function($uibModal, $timeout) { + $timeout(function() { + var controller = createAdminFormController(); + + //Run controller functionality + scope.openDeleteModal(); + + //Run controller functionality + scope.cancelDeleteModal(); + expect( scope.deleteModal.opened ).toEqual(false); + }); })); }); }());