From 6880e66bca0baf2c5ccc17b4125ed0aeec6bc491 Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Wed, 18 Feb 2015 19:33:26 +0200 Subject: [PATCH] Remove store_on_contact from dialogue state models. --- .../js/src/apps/dialogue/states/states.js | 5 --- .../test/apps/dialogue/states/states.test.js | 32 ------------------- .../js/test/apps/dialogue/testHelpers.js | 5 --- 3 files changed, 42 deletions(-) diff --git a/go/base/static/js/src/apps/dialogue/states/states.js b/go/base/static/js/src/apps/dialogue/states/states.js index be68462b9..9bbc720e5 100644 --- a/go/base/static/js/src/apps/dialogue/states/states.js +++ b/go/base/static/js/src/apps/dialogue/states/states.js @@ -139,7 +139,6 @@ 'change .type': 'onTypeChange', 'change .name': 'onNameChange', 'click .name-extras': 'onNameExtras', - 'change .store-on-contact': 'onStoreOnContact' }, resetModal: new ConfirmView({ @@ -191,10 +190,6 @@ this.nameExtras.toggle(); }, - onStoreOnContact: function(e) { - this.model.set('store_on_contact', this.$('.store-on-contact').prop('checked')); - }, - // Keep a backup to restore the model for when the user cancels the edit backupModel: function() { this.modelBackup = this.model.toJSON(); diff --git a/go/base/static/js/test/apps/dialogue/states/states.test.js b/go/base/static/js/test/apps/dialogue/states/states.test.js index a122c2460..bd4ff6b18 100644 --- a/go/base/static/js/test/apps/dialogue/states/states.test.js +++ b/go/base/static/js/test/apps/dialogue/states/states.test.js @@ -123,7 +123,6 @@ describe("go.apps.dialogue.states", function() { entry_endpoint: {'uuid':'endpoint6'}, exit_endpoint: {'uuid':'endpoint7'}, user_defined_store_as: false, - store_on_contact: false, ordinal: 3 }); @@ -138,7 +137,6 @@ describe("go.apps.dialogue.states", function() { entry_endpoint: {'uuid':'endpoint6'}, exit_endpoint: {'uuid':'endpoint7'}, user_defined_store_as: false, - store_on_contact: false, ordinal: 3 }); @@ -147,19 +145,6 @@ describe("go.apps.dialogue.states", function() { }); }); - describe(".render", function() { - it("should mark whether the user's answer should be stored on the contact", - function() { - state.model.set('store_on_contact', true); - state.render(); - assert(state.$('.store-on-contact').prop('checked')); - - state.model.set('store_on_contact', false); - state.render(); - assert(!state.$('.store-on-contact').prop('checked')); - }); - }); - describe(".cancel", function() { it("should change the model back to its old state", function() { assert.deepEqual(state.model.toJSON(), { @@ -170,7 +155,6 @@ describe("go.apps.dialogue.states", function() { entry_endpoint: {'uuid':'endpoint6'}, exit_endpoint: {'uuid':'endpoint7'}, user_defined_store_as: false, - store_on_contact: false, ordinal: 3 }); @@ -185,7 +169,6 @@ describe("go.apps.dialogue.states", function() { entry_endpoint: {'uuid':'endpoint6'}, exit_endpoint: {'uuid':'endpoint7'}, user_defined_store_as: false, - store_on_contact: false, ordinal: 3 }); }); @@ -284,7 +267,6 @@ describe("go.apps.dialogue.states", function() { entry_endpoint: {'uuid':'endpoint6'}, exit_endpoint: {'uuid':'endpoint7'}, user_defined_store_as: false, - store_on_contact: false, ordinal: 3 }); @@ -299,7 +281,6 @@ describe("go.apps.dialogue.states", function() { entry_endpoint: {'uuid':'endpoint6'}, exit_endpoint: {'uuid':'endpoint7'}, user_defined_store_as: false, - store_on_contact: false, ordinal: 3 }); }); @@ -318,19 +299,6 @@ describe("go.apps.dialogue.states", function() { assert.equal(state.modeName, 'preview'); }); }); - - describe("when '.store-on-contact' changes", function() { - it("should set its model's 'store_on_contact' attr accordingly", - function() { - assert.equal(state.model.get('store_on_contact'), false); - - editMode.$('.store-on-contact') - .prop('checked', true) - .change(); - - assert.equal(state.model.get('store_on_contact'), true); - }); - }); }); describe(".DialogueStatePreviewView", function() { diff --git a/go/base/static/js/test/apps/dialogue/testHelpers.js b/go/base/static/js/test/apps/dialogue/testHelpers.js index e2e1c701c..e2ad15456 100644 --- a/go/base/static/js/test/apps/dialogue/testHelpers.js +++ b/go/base/static/js/test/apps/dialogue/testHelpers.js @@ -38,7 +38,6 @@ store_as: 'message-1', text: 'What is your favourite colour?', user_defined_store_as: false, - store_on_contact: false, entry_endpoint: {uuid: 'endpoint0'}, choice_endpoints: [{ value: 'red', @@ -57,7 +56,6 @@ type: 'freetext', store_as: 'message-2', user_defined_store_as: false, - store_on_contact: false, entry_endpoint: {uuid: 'endpoint3'}, exit_endpoint: {uuid: 'endpoint4'}, text: 'What is your name?' @@ -67,7 +65,6 @@ type: 'end', store_as: 'ending-1', user_defined_store_as: false, - store_on_contact: false, entry_endpoint: {uuid: 'endpoint5'}, text: 'Thank you for taking our survey' }, { @@ -75,7 +72,6 @@ name: 'Dummy Message 1', type: 'dummy', user_defined_store_as: false, - store_on_contact: false, store_as: 'dummy-message-1', entry_endpoint: {uuid: 'endpoint6'}, exit_endpoint: {uuid: 'endpoint7'} @@ -85,7 +81,6 @@ type: 'group', group: {key: 'group1'}, user_defined_store_as: false, - store_on_contact: false, store_as: 'message-5', entry_endpoint: {uuid: 'endpoint8'}, exit_endpoint: {uuid: 'endpoint9'}