From 76d6d54cd5932d0d272a455b26977cb6fd35f964 Mon Sep 17 00:00:00 2001 From: David Baldwynn Date: Sun, 29 Oct 2017 11:54:40 -0700 Subject: [PATCH] got edit-submissions-form directive tests to pass --- app/models/form.server.model.js | 1 - package.json | 2 +- public/dist/form_populate_template_cache.js | 18 +- .../header.client.controller.test.js | 29 + .../modules/forms/admin/config/i18n/german.js | 1 - .../edit-submissions-form.client.directive.js | 117 +++- .../services/form-fields.client.service.js | 1 - .../admin-form.client.controller.test.js | 18 +- .../list-forms.client.controller.test.js | 34 +- ...-form-submissions.client.directive.test.js | 62 +- .../edit-form.client.directive.test.js | 18 + tests/client/mockData.js | 588 ++++++++++++++++++ 12 files changed, 807 insertions(+), 82 deletions(-) create mode 100644 tests/client/mockData.js diff --git a/app/models/form.server.model.js b/app/models/form.server.model.js index b20d1a9e..0262c881 100644 --- a/app/models/form.server.model.js +++ b/app/models/form.server.model.js @@ -71,7 +71,6 @@ var VisitorDataSchema = new Schema({ userAgent: { type: String } - }); var formSchemaOptions = { diff --git a/package.json b/package.json index 3700f6b0..c1e2f083 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "grunt-usemin": "^3.1.1", "grunt-wiredep": "^3.0.1", "istanbul": "^0.4.0", - "jasmine-core": "^2.4.1", + "jasmine-core": "^2.6", "karma": "~0.13.14", "karma-chrome-launcher": "~0.2.1", "karma-coverage": "~0.5.3", diff --git a/public/dist/form_populate_template_cache.js b/public/dist/form_populate_template_cache.js index e89e3c03..3e094dc7 100644 --- a/public/dist/form_populate_template_cache.js +++ b/public/dist/form_populate_template_cache.js @@ -1,4 +1,4 @@ -angular.module('TellForm-Form.form_templates', []).run(['$templateCache', function($templateCache) { +angular.module('TellForm-Form.form_templates', []).run(['$templateCache', function ($templateCache) { "use strict"; $templateCache.put("form_modules/forms/base/views/form-not-found.client.view.html", "

{{ 'FORM_404_HEADER' | translate }}

{{ 'FORM_404_BODY' | translate }}
"); @@ -10,26 +10,26 @@ angular.module('TellForm-Form.form_templates', []).run(['$templateCache', functi $templateCache.put("form_modules/forms/base/views/directiveViews/entryPage/startPage.html", "

{{pageData.introTitle}}

{{pageData.introParagraph}}

"); $templateCache.put("form_modules/forms/base/views/directiveViews/field/date.html", - "

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

{{field.description}}

"); + "

{{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", - "

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


{{field.description}}


"); + "

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


{{field.description}}


"); $templateCache.put("form_modules/forms/base/views/directiveViews/field/radio.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/rating.html", - "

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

{{field.description}}

"); + "

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

{{field.description}}

"); $templateCache.put("form_modules/forms/base/views/directiveViews/field/statement.html", "

{{field.title}}

{{field.description}}

{{field.description}}


"); $templateCache.put("form_modules/forms/base/views/directiveViews/field/textarea.html", - "

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

{{ 'NEWLINE' | translate }}

{{field.description}}

{{ 'ADD_NEW_LINE_INSTR' | translate }}
{{ 'ENTER' | translate }}
"); $templateCache.put("form_modules/forms/base/views/directiveViews/field/textfield.html", - "

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

{{field.description}}

{{ 'ENTER' | translate }}
"); + "

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

{{field.description}}

{{ 'ENTER' | translate }}
"); $templateCache.put("form_modules/forms/base/views/directiveViews/field/yes_no.html", - "

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

{{field.description}}


"); + "

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

{{field.description}}


"); $templateCache.put("form_modules/forms/base/views/directiveViews/form/submit-form.client.view.html", "

{{myform.startPage.introTitle}}

{{myform.startPage.introParagraph}}

{{ 'COMPLETING_NEEDED' | translate:translateAdvancementData }}
{{ 'ENTER' | translate }}

{{ 'ADVANCEMENT' | translate:translateAdvancementData }}

{{ 'FORM_SUCCESS' | translate }}

{{myform.endPage.title}}

{{myform.endPage.paragraph}}

"); }]); diff --git a/public/modules/core/tests/unit/controllers/header.client.controller.test.js b/public/modules/core/tests/unit/controllers/header.client.controller.test.js index 76ee4fb4..f2cebdc1 100755 --- a/public/modules/core/tests/unit/controllers/header.client.controller.test.js +++ b/public/modules/core/tests/unit/controllers/header.client.controller.test.js @@ -6,9 +6,38 @@ var scope, HeaderController; + var sampleUser = { + firstName: 'Full', + lastName: 'Name', + email: 'test@test.com', + username: 'test@test.com', + language: 'en', + password: 'password', + provider: 'local', + roles: ['user'], + _id: 'ed873933b1f1dea0ce12fab9' + }; + // Load the main application module beforeEach(module(ApplicationConfiguration.applicationModuleName)); + //Mock Authentication Service + beforeEach(module(function($provide) { + $provide.service('Auth', function() { + return { + ensureHasCurrentUser: function() { + return sampleUser; + }, + isAuthenticated: function() { + return true; + }, + getUserState: function() { + return true; + } + }; + }); + })); + beforeEach(inject(function($controller, $rootScope) { scope = $rootScope.$new(); diff --git a/public/modules/forms/admin/config/i18n/german.js b/public/modules/forms/admin/config/i18n/german.js index 0ea8d351..77d40107 100644 --- a/public/modules/forms/admin/config/i18n/german.js +++ b/public/modules/forms/admin/config/i18n/german.js @@ -84,7 +84,6 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid ADD_OPTION: 'Option hinzufügen', NUM_OF_STEPS: 'Anzahl der Schritte', CLICK_FIELDS_FOOTER: 'Klicken Sie auf Felder, um sie hier hinzuzufügen', - FORM: 'Formular', IF_THIS_FIELD: 'Wenn dieses Feld', IS_EQUAL_TO: 'ist gleich', IS_NOT_EQUAL_TO: 'ist nicht gleich', diff --git a/public/modules/forms/admin/directives/edit-submissions-form.client.directive.js b/public/modules/forms/admin/directives/edit-submissions-form.client.directive.js index de630bfa..e405da62 100644 --- a/public/modules/forms/admin/directives/edit-submissions-form.client.directive.js +++ b/public/modules/forms/admin/directives/edit-submissions-form.client.directive.js @@ -10,13 +10,33 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope', myform: '=' }, controller: function($scope){ - $scope.table = { masterChecker: false, rows: [] }; - var getSubmissions = function(){ + $scope.deletionInProgress = false; + $scope.waitingForDeletion = false; + + //Waits until deletionInProgress is false before running getSubmissions + $scope.$watch("deletionInProgress",function(newVal, oldVal){ + if(newVal === oldVal) return; + + if(newVal === false && $scope.waitingForDeletion) { + $scope.getSubmissions(); + $scope.waitingForDeletion = false; + } + }); + + $scope.handleSubmissionsRefresh = function(){ + if(!$scope.deletionInProgress) { + $scope.getSubmissions(); + } else { + $scope.waitingForDeletion = true; + } + }; + + $scope.getSubmissions = function(cb){ $http({ method: 'GET', url: '/forms/'+$scope.myform._id+'/submissions' @@ -36,10 +56,19 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope', } $scope.table.rows = submissions; - }); + + if(cb && typeof cb === 'function'){ + cb(); + } + }, function errorCallback(err){ + console.error(err); + if(cb && typeof cb === 'function'){ + cb(err); + } + }); }; - var getVisitors = function(){ + $scope.getVisitors = function(){ $http({ method: 'GET', url: '/forms/'+$scope.myform._id+'/visitors' @@ -52,8 +81,23 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope', }); }; - getSubmissions(); - getVisitors(); + $scope.handleSubmissionsRefresh(); + $scope.getVisitors(); + + //Fetch submissions and visitor data every 1.67 min + var updateSubmissions = $interval($scope.handleSubmissionsRefresh, 100000); + var updateVisitors = $interval($scope.getVisitors, 1000000); + + //Prevent $intervals from running after directive is destroyed + $scope.$on('$destroy', function() { + if (updateSubmissions) { + $interval.cancel($scope.updateSubmissions); + } + + if (updateVisitors) { + $interval.cancel($scope.updateVisitors); + } + }); /* ** Analytics Functions @@ -72,14 +116,48 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope', return (totalTime/numSubmissions).toFixed(0); })(); - var updateFields = $interval(getSubmissions, 100000); - var updateFields = $interval(getVisitors, 1000000); + $scope.DeviceStatistics = (function(){ + var newStatItem = function(){ + return { + visits: 0, + responses: 0, + completion: 0, + average_time: 0, + total_time: 0 + }; + }; - $scope.$on('$destroy', function() { - if (updateFields) { - $interval.cancel($scope.updateFields); + var stats = { + desktop: newStatItem(), + tablet: newStatItem(), + phone: newStatItem(), + other: newStatItem() + }; + + if($scope.myform.analytics && $scope.myform.analytics.visitors) { + var visitors = $scope.myform.analytics.visitors; + for (var i = 0; i < visitors.length; i++) { + var visitor = visitors[i]; + var deviceType = visitor.deviceType; + + stats[deviceType].visits++; + + if (visitor.isSubmitted) { + stats[deviceType].total_time = stats[deviceType].total_time + visitor.timeElapsed; + stats[deviceType].responses++; + } + + if(stats[deviceType].visits) { + stats[deviceType].completion = 100*(stats[deviceType].responses / stats[deviceType].visits).toFixed(2); + } + + if(stats[deviceType].responses){ + stats[deviceType].average_time = (stats[deviceType].total_time / stats[deviceType].responses).toFixed(0); + } + } } - }); + return stats; + })(); /* ** Table Functions @@ -109,25 +187,24 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope', //Delete selected submissions of Form $scope.deleteSelectedSubmissions = function(){ + $scope.deletionInProgress = true; var delete_ids = _.chain($scope.table.rows).filter(function(row){ return !!row.selected; }).pluck('_id').value(); - $http({ url: '/forms/'+$scope.myform._id+'/submissions', + return $http({ url: '/forms/'+$scope.myform._id+'/submissions', method: 'DELETE', data: {deleted_submissions: delete_ids}, headers: {'Content-Type': 'application/json;charset=utf-8'} }).success(function(data, status){ + $scope.deletionInProgress = true; //Remove deleted ids from table - var tmpArray = []; - for(var i=0; i<$scope.table.rows.length; i++){ - if(!$scope.table.rows[i].selected){ - tmpArray.push($scope.table.rows[i]); - } - } - $scope.table.rows = tmpArray; + $scope.table.rows = $scope.table.rows.filter(function(field){ + return !field.selected; + }); }) .error(function(err){ + $scope.deletionInProgress = true; console.error(err); }); }; diff --git a/public/modules/forms/admin/services/form-fields.client.service.js b/public/modules/forms/admin/services/form-fields.client.service.js index d6dae5eb..dd1d7dec 100644 --- a/public/modules/forms/admin/services/form-fields.client.service.js +++ b/public/modules/forms/admin/services/form-fields.client.service.js @@ -4,7 +4,6 @@ angular.module('forms').service('FormFields', [ '$rootScope', '$translate', '$window', function($rootScope, $translate, $window) { $translate.use($window.user.language); - console.log($translate.instant('SHORT_TEXT')); this.types = [ { 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 ba92adaf..b94d75b7 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 @@ -58,7 +58,7 @@ }; var newFakeModal = function(){ - var result = { + var modal = { opened: true, close: function( item ) { //The user clicked OK on the modal dialog, call the stored confirm callback with the selected item @@ -67,12 +67,19 @@ dismiss: function( type ) { //The user clicked cancel on the modal dialog, call the stored cancel callback this.opened = false; + }, + result: { + then: function (cb) { + if(cb && typeof cb === 'function'){ + cb(); + } + } } }; - return result; + return modal; }; - //Mock Users Service + //Mock myForm Service beforeEach(module(function($provide) { $provide.service('myForm', function($q) { return sampleForm; @@ -159,7 +166,6 @@ }); })); - //Mock $uibModal beforeEach(inject(function($uibModal) { var modal = newFakeModal(); @@ -199,7 +205,7 @@ expect(scope.myform).toEqualData(sampleForm); }); - it('$scope.removeCurrentForm() with valid form data should send a DELETE request with the id of form', function() { + 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 @@ -214,7 +220,7 @@ $httpBackend.flush(); $state.ensureAllTransitionsHappened(); - }); + })); it('$scope.update() should send a PUT request with the id of form', function() { var controller = createAdminFormController(); diff --git a/public/modules/forms/tests/unit/controllers/list-forms.client.controller.test.js b/public/modules/forms/tests/unit/controllers/list-forms.client.controller.test.js index 6f591280..2190264b 100644 --- a/public/modules/forms/tests/unit/controllers/list-forms.client.controller.test.js +++ b/public/modules/forms/tests/unit/controllers/list-forms.client.controller.test.js @@ -86,7 +86,6 @@ }); })); - // 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. @@ -106,25 +105,13 @@ // Initialize the Forms controller. createListFormsController = function(){ - return $controller('ListFormsController', { $scope: scope }); + return $controller('ListFormsController', { + $scope: scope, + myForms: sampleFormList + }); }; })); - it('$scope.findAll() should query all User\'s Forms', inject(function() { - - var controller = createListFormsController(); - - // Set GET response - $httpBackend.expectGET(/^(\/forms)$/).respond(200, sampleFormList); - - // Run controller functionality - scope.findAll(); - $httpBackend.flush(); - - // Test scope value - expect( scope.myforms ).toEqualData(sampleFormList); - })); - it('$scope.duplicateForm() should duplicate a Form', inject(function() { var dupSampleForm = sampleFormList[2], @@ -135,12 +122,6 @@ var controller = createListFormsController(); - // Set GET response - $httpBackend.expectGET(/^(\/forms)$/).respond(200, sampleFormList); - // Run controller functionality - scope.findAll(); - $httpBackend.flush(); - // Set GET response $httpBackend.expect('POST', '/forms').respond(200, dupSampleForm); // Run controller functionality @@ -164,13 +145,6 @@ var controller = createListFormsController(); - // Set GET response - $httpBackend.expectGET(/^(\/forms)$/).respond(200, sampleFormList); - - // Run controller functionality - scope.findAll(); - $httpBackend.flush(); - // Set GET response $httpBackend.expect('DELETE', /^(\/forms\/)([0-9a-fA-F]{24})$/).respond(200, delSampleForm); diff --git a/public/modules/forms/tests/unit/directives/edit-form-submissions.client.directive.test.js b/public/modules/forms/tests/unit/directives/edit-form-submissions.client.directive.test.js index d1418c2e..75ac6b0d 100644 --- a/public/modules/forms/tests/unit/directives/edit-form-submissions.client.directive.test.js +++ b/public/modules/forms/tests/unit/directives/edit-form-submissions.client.directive.test.js @@ -2,7 +2,7 @@ (function() { // Forms Controller Spec - describe('EditSubmissions Directive-Controller Tests', function() { + describe('EditFormSubmissions Directive-Controller Tests', function() { // Initialize global variables var el, scope, controller, $httpBackend; @@ -10,13 +10,25 @@ firstName: 'Full', lastName: 'Name', email: 'test@test.com', - username: 'test@test.com', + username: 'test1234', password: 'password', provider: 'local', roles: ['user'], _id: 'ed873933b1f1dea0ce12fab9' }; + var sampleVisitors = [{ + socketId: '33b1f1dea0ce12fab9ed8739', + referrer: 'https://tellform.com/examples', + lastActiveField: 'ed873933b0ce121f1deafab9', + timeElapsed: 100000, + isSubmitted: true, + language: 'en', + ipAddr: '192.168.1.1', + deviceType: 'desktop', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4' + }] + var sampleForm = { title: 'Form Title', admin: 'ed873933b1f1dea0ce12fab9', @@ -27,7 +39,18 @@ {fieldType:'checkbox', title:'hockey', fieldOptions: [], fieldValue: '', required: true, disabled: false, deletePreserved: false, _id: 'ed8317393deab0ce121ffab9'} ], analytics: { - visitors: [] + visitors: sampleVisitors, + conversionRate: 80.5, + fields: [ + { + dropoffViews: 0, + responses: 1, + totalViews: 1, + continueRate: 100, + dropoffRate: 0, + field: {fieldType:'textfield', title:'First Name', fieldOptions: [], fieldValue: '', required: true, disabled: false, deletePreserved: false, _id: 'ed873933b0ce121f1deafab9'} + } + ] }, submissions: [], startPage: { @@ -61,7 +84,8 @@ ], admin: sampleUser, form: sampleForm, - timeElapsed: 10.33 + timeElapsed: 10.33, + selected: false }, { form_fields: [ @@ -71,7 +95,8 @@ ], admin: sampleUser, form: sampleForm, - timeElapsed: 2.33 + timeElapsed: 2.33, + selected: false }, { form_fields: [ @@ -81,7 +106,8 @@ ], admin: sampleUser, form: sampleForm, - timeElapsed: 11.11 + timeElapsed: 11.11, + selected: false }]; // The $resource service augments the response object with methods for updating and deleting the resource. @@ -118,10 +144,12 @@ $httpBackend.whenGET(/^(\/forms\/)([0-9a-fA-F]{24})$/).respond(200, sampleForm); $httpBackend.whenGET('/forms').respond(200, sampleForm); $httpBackend.whenGET(/^(\/forms\/)([0-9a-fA-F]{24})$/).respond(200, sampleForm); - //Instantiate directive. + $httpBackend.whenGET(/^(\/forms\/)([0-9a-fA-F]{24})\/submissions$/).respond(200, sampleSubmissions); + $httpBackend.whenGET(/^(\/forms\/)([0-9a-fA-F]{24})\/visitors$/).respond(200, sampleVisitors); + + //Instantiate directive. var tmp_scope = $rootScope.$new(); tmp_scope.myform = sampleForm; - tmp_scope.myform.submissions = sampleSubmissions; tmp_scope.user = sampleUser; //gotacha: Controller and link functions will execute. @@ -141,6 +169,7 @@ it('$scope.toggleAllCheckers should toggle all checkboxes in table', function(){ //Run Controller Logic to Test + scope.table.rows = sampleSubmissions; scope.table.masterChecker = true; scope.toggleAllCheckers(); @@ -151,6 +180,7 @@ }); it('$scope.isAtLeastOneChecked should return true when at least one checkbox is selected', function(){ + scope.table.rows = sampleSubmissions; scope.table.masterChecker = true; scope.toggleAllCheckers(); @@ -161,16 +191,22 @@ }); it('$scope.deleteSelectedSubmissions should delete all submissions that are selected', function(){ + $httpBackend.expect('GET', /^(\/forms\/)([0-9a-fA-F]{24})(\/submissions)$/).respond(200, sampleSubmissions); scope.table.masterChecker = true; - scope.toggleAllCheckers(); + scope.getSubmissions(function(err){ + scope.toggleAllCheckers(); - $httpBackend.expect('DELETE', /^(\/forms\/)([0-9a-fA-F]{24})(\/submissions)$/).respond(200); + $httpBackend.expect('DELETE', /^(\/forms\/)([0-9a-fA-F]{24})(\/submissions)$/).respond(200); - //Run Controller Logic to Test - scope.deleteSelectedSubmissions(); + //Run Controller Logic to Test + scope.deleteSelectedSubmissions().then(function(){ + expect(scope.table.rows.length).toEqual(0); + }); + expect(err).not.toBeDefined(); + }); $httpBackend.flush(); - expect(scope.table.rows.length).toEqual(0); + }); }); diff --git a/public/modules/forms/tests/unit/directives/edit-form.client.directive.test.js b/public/modules/forms/tests/unit/directives/edit-form.client.directive.test.js index fe7e2452..aa1710ca 100644 --- a/public/modules/forms/tests/unit/directives/edit-form.client.directive.test.js +++ b/public/modules/forms/tests/unit/directives/edit-form.client.directive.test.js @@ -62,6 +62,24 @@ beforeEach(module('module-templates')); beforeEach(module('stateMock')); + //Mock FormFields Service + beforeEach(module(function($provide) { + $provide.service('FormFields', function() { + return { + types: [ + { + name : 'textfield', + value : 'Short Text' + }, + { + name : 'email', + value : 'Email' + } + ] + }; + }); + })); + beforeEach(inject(function($compile, $controller, $rootScope, _$httpBackend_) { //Instantiate directive. var tmp_scope = $rootScope.$new(); diff --git a/tests/client/mockData.js b/tests/client/mockData.js new file mode 100644 index 00000000..4b37219b --- /dev/null +++ b/tests/client/mockData.js @@ -0,0 +1,588 @@ +module.exports = { + sampleUser: { + "_id": "598cb79e43859500277bc804", + "lastModified": "2017-10-06T05:36:28.394Z", + "email": "test@test.com", + "username": "test1234", + "salt": null, + "__v": 0, + "resetPasswordExpires": "2017-10-06T06:36:28.391Z", + "resetPasswordToken": "2d95c01d79fb06c73691577cd82e5cce2ff616f1", + "created": "2017-08-10T19:44:30.601Z", + "language": "en", + "roles": ["user"], + "provider": "local", + "passwordHash": null, + "lastName": "Full", + "firstName": "Name" + }, + + sampleForm1: { + "_id": "59d25a9d413a7a3106878556", + "lastModified": "2017-10-19T00:46:24.056Z", + "title": "Form Title", + "created": "2017-10-02T15:26:21.221Z", + "admin": this.sampleUser, + "design": { + "colors": { + "buttonTextColor": "#333", + "buttonColor": "#fff", + "answerColor": "#333", + "questionColor": "#333", + "backgroundColor": "#fff" + } + }, + "isLive": true, + "hideFooter": false, + "endPage": { + "buttons": [], + "buttonText": "Go back to Form", + "title": "Thank you for filling out the form", + "showEnd": false + }, + "startPage": { + "buttons": [], + "introButtonText": "Start", + "introTitle": "Welcome to Form", + "showStart": false + }, + "submissions": [], + "form_fields": [{ + "globalId": "hSsZT02ICgcdvLTrbwCyYjl19qG9gQdAzO7ZDF2Esj4", + "lastModified": "2017-10-19T00:46:24.053Z", + "title": "First Name", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "expressionString": "field == static", + "jumpTo": "59e7f5d242a56fca5bf79365", + "valueB": "hello", + "_id": "59e7f5c442a56fca5bf7935e", + "enabled": true, + "id": "59e7f5c442a56fca5bf7935e" + }, + "_id": "59e7f5c442a56fca5bf7935d", + "created": "2017-10-19T00:45:56.855Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, { + "globalId": "N2DthDVEJfXvNU4JsYyax6PrCbHzump8QTnyc1hnAVR", + "lastModified": "2017-10-19T00:46:24.054Z", + "title": "nascar", + "fieldType": "checkbox", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5c842a56fca5bf79361", + "enabled": false, + "id": "59e7f5c842a56fca5bf79361" + }, + "_id": "59e7f5c842a56fca5bf79360", + "created": "2017-10-19T00:46:00.484Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, { + "globalId": "7vnFgEhKCZWwb6rR29Lat7mePmBK05fDTashc3modje", + "lastModified": "2017-10-19T00:46:24.055Z", + "title": "hockey", + "fieldType": "checkbox", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5d242a56fca5bf79366", + "enabled": false, + "id": "59e7f5d242a56fca5bf79366" + }, + "_id": "59e7f5d242a56fca5bf79365", + "created": "2017-10-19T00:46:10.619Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }], + "analytics": { + "visitors": [], + "fields": [{ + "field": { + "globalId": "hSsZT02ICgcdvLTrbwCyYjl19qG9gQdAzO7ZDF2Esj4", + "lastModified": "2017-10-19T00:46:24.053Z", + "title": "Short Text3", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "expressionString": "field == static", + "jumpTo": "59e7f5d242a56fca5bf79365", + "valueB": "hello", + "_id": "59e7f5c442a56fca5bf7935e", + "enabled": true, + "id": "59e7f5c442a56fca5bf7935e" + }, + "_id": "59e7f5c442a56fca5bf7935d", + "created": "2017-10-19T00:45:56.855Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, + "dropoffRate": 0, + "continueRate": 0, + "totalViews": 0, + "responses": 0, + "dropoffViews": 0 + }, { + "field": { + "globalId": "N2DthDVEJfXvNU4JsYyax6PrCbHzump8QTnyc1hnAVR", + "lastModified": "2017-10-19T00:46:24.054Z", + "title": "Short Text4", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5c842a56fca5bf79361", + "enabled": false, + "id": "59e7f5c842a56fca5bf79361" + }, + "_id": "59e7f5c842a56fca5bf79360", + "created": "2017-10-19T00:46:00.484Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, + "dropoffRate": 0, + "continueRate": 0, + "totalViews": 0, + "responses": 0, + "dropoffViews": 0 + }, { + "field": { + "globalId": "7vnFgEhKCZWwb6rR29Lat7mePmBK05fDTashc3modje", + "lastModified": "2017-10-19T00:46:24.055Z", + "title": "Short Text5", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5d242a56fca5bf79366", + "enabled": false, + "id": "59e7f5d242a56fca5bf79366" + }, + "_id": "59e7f5d242a56fca5bf79365", + "created": "2017-10-19T00:46:10.619Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, + "dropoffRate": 0, + "continueRate": 0, + "totalViews": 0, + "responses": 0, + "dropoffViews": 0 + }], + "conversionRate": 0, + "submissions": 0, + "views": 0 + }, + "language": "en", + "id": "59d25a9d413a7a3106878556" + }, + + sampleForm2: { + "_id": "52f6d0f87f5a407a384220e3", + "lastModified": "2017-10-19T00:46:24.056Z", + "title": "Form Title2", + "created": "2017-10-02T15:26:21.221Z", + "admin": this.sampleUser, + "design": { + "colors": { + "buttonTextColor": "#333", + "buttonColor": "#fff", + "answerColor": "#333", + "questionColor": "#333", + "backgroundColor": "#fff" + } + }, + "isLive": true, + "hideFooter": false, + "endPage": { + "buttons": [], + "buttonText": "Go back to Form", + "title": "Thank you for filling out the form", + "showEnd": false + }, + "startPage": { + "buttons": [], + "introButtonText": "Start", + "introTitle": "Welcome to Form", + "showStart": false + }, + "submissions": [], + "form_fields": [{ + "globalId": "hSsZT02ICgcdvLTrbwCyYjl19qG9gQdAzO7ZDF2Esj4", + "lastModified": "2017-10-19T00:46:24.053Z", + "title": "First Name", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "expressionString": "field == static", + "jumpTo": "59e7f5d242a56fca5bf79365", + "valueB": "hello", + "_id": "59e7f5c442a56fca5bf7935e", + "enabled": true, + "id": "59e7f5c442a56fca5bf7935e" + }, + "_id": "59e7f5c442a56fca5bf7935d", + "created": "2017-10-19T00:45:56.855Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, { + "globalId": "N2DthDVEJfXvNU4JsYyax6PrCbHzump8QTnyc1hnAVR", + "lastModified": "2017-10-19T00:46:24.054Z", + "title": "nascar", + "fieldType": "checkbox", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5c842a56fca5bf79361", + "enabled": false, + "id": "59e7f5c842a56fca5bf79361" + }, + "_id": "59e7f5c842a56fca5bf79360", + "created": "2017-10-19T00:46:00.484Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, { + "globalId": "7vnFgEhKCZWwb6rR29Lat7mePmBK05fDTashc3modje", + "lastModified": "2017-10-19T00:46:24.055Z", + "title": "hockey", + "fieldType": "checkbox", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5d242a56fca5bf79366", + "enabled": false, + "id": "59e7f5d242a56fca5bf79366" + }, + "_id": "59e7f5d242a56fca5bf79365", + "created": "2017-10-19T00:46:10.619Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }], + "analytics": { + "visitors": [], + "fields": [{ + "field": { + "globalId": "hSsZT02ICgcdvLTrbwCyYjl19qG9gQdAzO7ZDF2Esj4", + "lastModified": "2017-10-19T00:46:24.053Z", + "title": "Short Text3", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "expressionString": "field == static", + "jumpTo": "59e7f5d242a56fca5bf79365", + "valueB": "hello", + "_id": "59e7f5c442a56fca5bf7935e", + "enabled": true, + "id": "59e7f5c442a56fca5bf7935e" + }, + "_id": "59e7f5c442a56fca5bf7935d", + "created": "2017-10-19T00:45:56.855Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, + "dropoffRate": 0, + "continueRate": 0, + "totalViews": 0, + "responses": 0, + "dropoffViews": 0 + }, { + "field": { + "globalId": "N2DthDVEJfXvNU4JsYyax6PrCbHzump8QTnyc1hnAVR", + "lastModified": "2017-10-19T00:46:24.054Z", + "title": "Short Text4", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5c842a56fca5bf79361", + "enabled": false, + "id": "59e7f5c842a56fca5bf79361" + }, + "_id": "59e7f5c842a56fca5bf79360", + "created": "2017-10-19T00:46:00.484Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, + "dropoffRate": 0, + "continueRate": 0, + "totalViews": 0, + "responses": 0, + "dropoffViews": 0 + }, { + "field": { + "globalId": "7vnFgEhKCZWwb6rR29Lat7mePmBK05fDTashc3modje", + "lastModified": "2017-10-19T00:46:24.055Z", + "title": "Short Text5", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5d242a56fca5bf79366", + "enabled": false, + "id": "59e7f5d242a56fca5bf79366" + }, + "_id": "59e7f5d242a56fca5bf79365", + "created": "2017-10-19T00:46:10.619Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, + "dropoffRate": 0, + "continueRate": 0, + "totalViews": 0, + "responses": 0, + "dropoffViews": 0 + }], + "conversionRate": 0, + "submissions": 0, + "views": 0 + }, + "language": "en", + "id": "59d25a9d413a7a3106878556" + }, + + sampleForm3: { + "_id": "2fab9ed873937f0e1dea0ce1", + "lastModified": "2017-10-19T00:46:24.056Z", + "title": "Form Title3", + "created": "2017-10-02T15:26:21.221Z", + "admin": this.sampleUser, + "design": { + "colors": { + "buttonTextColor": "#333", + "buttonColor": "#fff", + "answerColor": "#333", + "questionColor": "#333", + "backgroundColor": "#fff" + } + }, + "isLive": true, + "hideFooter": false, + "endPage": { + "buttons": [], + "buttonText": "Go back to Form", + "title": "Thank you for filling out the form", + "showEnd": false + }, + "startPage": { + "buttons": [], + "introButtonText": "Start", + "introTitle": "Welcome to Form", + "showStart": false + }, + "submissions": [], + "form_fields": [{ + "globalId": "hSsZT02ICgcdvLTrbwCyYjl19qG9gQdAzO7ZDF2Esj4", + "lastModified": "2017-10-19T00:46:24.053Z", + "title": "First Name", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "expressionString": "field == static", + "jumpTo": "59e7f5d242a56fca5bf79365", + "valueB": "hello", + "_id": "59e7f5c442a56fca5bf7935e", + "enabled": true, + "id": "59e7f5c442a56fca5bf7935e" + }, + "_id": "59e7f5c442a56fca5bf7935d", + "created": "2017-10-19T00:45:56.855Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, { + "globalId": "N2DthDVEJfXvNU4JsYyax6PrCbHzump8QTnyc1hnAVR", + "lastModified": "2017-10-19T00:46:24.054Z", + "title": "nascar", + "fieldType": "checkbox", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5c842a56fca5bf79361", + "enabled": false, + "id": "59e7f5c842a56fca5bf79361" + }, + "_id": "59e7f5c842a56fca5bf79360", + "created": "2017-10-19T00:46:00.484Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, { + "globalId": "7vnFgEhKCZWwb6rR29Lat7mePmBK05fDTashc3modje", + "lastModified": "2017-10-19T00:46:24.055Z", + "title": "hockey", + "fieldType": "checkbox", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5d242a56fca5bf79366", + "enabled": false, + "id": "59e7f5d242a56fca5bf79366" + }, + "_id": "59e7f5d242a56fca5bf79365", + "created": "2017-10-19T00:46:10.619Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }], + "analytics": { + "visitors": [], + "fields": [{ + "field": { + "globalId": "hSsZT02ICgcdvLTrbwCyYjl19qG9gQdAzO7ZDF2Esj4", + "lastModified": "2017-10-19T00:46:24.053Z", + "title": "Short Text3", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "expressionString": "field == static", + "jumpTo": "59e7f5d242a56fca5bf79365", + "valueB": "hello", + "_id": "59e7f5c442a56fca5bf7935e", + "enabled": true, + "id": "59e7f5c442a56fca5bf7935e" + }, + "_id": "59e7f5c442a56fca5bf7935d", + "created": "2017-10-19T00:45:56.855Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, + "dropoffRate": 0, + "continueRate": 0, + "totalViews": 0, + "responses": 0, + "dropoffViews": 0 + }, { + "field": { + "globalId": "N2DthDVEJfXvNU4JsYyax6PrCbHzump8QTnyc1hnAVR", + "lastModified": "2017-10-19T00:46:24.054Z", + "title": "Short Text4", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5c842a56fca5bf79361", + "enabled": false, + "id": "59e7f5c842a56fca5bf79361" + }, + "_id": "59e7f5c842a56fca5bf79360", + "created": "2017-10-19T00:46:00.484Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, + "dropoffRate": 0, + "continueRate": 0, + "totalViews": 0, + "responses": 0, + "dropoffViews": 0 + }, { + "field": { + "globalId": "7vnFgEhKCZWwb6rR29Lat7mePmBK05fDTashc3modje", + "lastModified": "2017-10-19T00:46:24.055Z", + "title": "Short Text5", + "fieldType": "textfield", + "fieldValue": "", + "logicJump": { + "_id": "59e7f5d242a56fca5bf79366", + "enabled": false, + "id": "59e7f5d242a56fca5bf79366" + }, + "_id": "59e7f5d242a56fca5bf79365", + "created": "2017-10-19T00:46:10.619Z", + "validFieldTypes": ["textfield", "date", "email", "link", "legal", "url", "textarea", "statement", "welcome", "thankyou", "file", "dropdown", "scale", "rating", "radio", "checkbox", "hidden", "yes_no", "natural", "stripe", "number"], + "deletePreserved": false, + "disabled": false, + "required": true, + "fieldOptions": [], + "description": "", + "isSubmission": false + }, + "dropoffRate": 0, + "continueRate": 0, + "totalViews": 0, + "responses": 0, + "dropoffViews": 0 + }], + "conversionRate": 0, + "submissions": 0, + "views": 0 + }, + "language": "en", + "id": "59d25a9d413a7a3106878556" + }, + + sampleFormList: [this.sampleForm1, this.sampleForm2, this.sampleForm3], +} \ No newline at end of file