From 98864a7ce3c8733ad03ec29fab4f8de9df040f2f Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Wed, 7 Jun 2017 10:12:23 +0100 Subject: [PATCH] eventLogging: Add missing properties to "tapped settings cog" event When there's an interaction, then the "tapped settings cog" event should have the same properties set as the other interaction-specific events. This was discovered while QAing T164256. Bug: T164256 Change-Id: I4749b52656203c7e0c42ae742556ee996eee322a --- resources/dist/index.js | Bin 34108 -> 34125 bytes resources/dist/index.js.map | Bin 269219 -> 269309 bytes src/reducers/eventLogging.js | 4 +- .../node-qunit/reducers/eventLogging.test.js | 44 ++++++++++++++++-- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/resources/dist/index.js b/resources/dist/index.js index 645e97b623120b373e95fc4ec1f127f5ddf563db..dd19b6fe03a094e1ca84d228e1618cd9028fff06 100644 GIT binary patch delta 28 kcmdnf#dNldX@h0N$&Lx?oBJd7=>Pz09tjix diff --git a/resources/dist/index.js.map b/resources/dist/index.js.map index a5a3e948e7cdbb2dfbc4a67e994328983498f212..b03c9a67cf539652ffa1ac07cebd3392b0c6d143 100644 GIT binary patch delta 135 zcmZ3yUEuF_fe8sB7N*9@=4okZi6(|g1{P_lre-OolOHllZS31pGx; delta 200 zcmeynU10Hcfe8sB21y2KMoB4&rY5E-=1CUDi53=VlOHllZS31p!{hJh?C7cE@95~L zQ{J3XyFI0r@s;EB%~{N1(?u(oti RO4BbqVB+1*QOW#u5dgsOMC||o diff --git a/src/reducers/eventLogging.js b/src/reducers/eventLogging.js index 91a74841d..0b8065755 100644 --- a/src/reducers/eventLogging.js +++ b/src/reducers/eventLogging.js @@ -280,9 +280,9 @@ module.exports = function ( state, action ) { case actionTypes.SETTINGS_SHOW: return nextState( state, { - event: { + event: createEvent( state.interaction, { action: 'tapped settings cog' - } + } ) } ); default: diff --git a/tests/node-qunit/reducers/eventLogging.test.js b/tests/node-qunit/reducers/eventLogging.test.js index d121f0ea6..f6bf0392c 100644 --- a/tests/node-qunit/reducers/eventLogging.test.js +++ b/tests/node-qunit/reducers/eventLogging.test.js @@ -584,9 +584,39 @@ QUnit.test( 'PREVIEW_DWELL', function ( assert ) { } ); QUnit.test( 'SETTINGS_SHOW should enqueue a "tapped settings cog" event', function ( assert ) { - var state = { - interaction: {} - }; + var initialState = { + interaction: {} + }, + state, + token = '0123456789'; + + state = eventLogging( initialState, { + type: 'SETTINGS_SHOW' + } ); + + // Note well that this is a valid event. The "tapped settings cog" event is + // also logged as a result of clicking the footer link. + assert.deepEqual( + state.event, + { + action: 'tapped settings cog', + linkInteractionToken: undefined, + namespaceIdHover: undefined, + pageTitleHover: undefined + }, + 'It shouldn\'t fail if there\'s no interaction.' + ); + + // --- + + state = eventLogging( initialState, { + type: 'LINK_DWELL', + el: this.link, + title: 'Foo', + namespaceID: 1, + token: token, + timestamp: Date.now() + } ); state = eventLogging( state, { type: 'SETTINGS_SHOW' @@ -595,8 +625,12 @@ QUnit.test( 'SETTINGS_SHOW should enqueue a "tapped settings cog" event', functi assert.deepEqual( state.event, { - action: 'tapped settings cog' - } + action: 'tapped settings cog', + linkInteractionToken: token, + namespaceIdHover: 1, + pageTitleHover: 'Foo' + }, + 'It should include the interaction information if there\'s an interaction.' ); } );