reducers: Store interaction tokens

Consider the user repeatedly dwelling on and abandoning a link. Testing
whether or not the element has changed before modifying state is not
sufficient. Fortunately, we already generate a unique token and include
it in the LINK_DWELL action for use in the eventLogging reducer - the
so-called "interaction token".

Change-Id: Iae9544055f7eccb4f7f071797eb360bc3456861a
This commit is contained in:
Sam Smith 2017-01-08 13:34:51 +00:00
parent f26768afe8
commit 46cd38849e
2 changed files with 6 additions and 1 deletions

View file

@ -14,6 +14,7 @@
enabled: undefined,
activeLink: undefined,
activeEvent: undefined,
activeToken: '',
shouldShow: false,
isUserDwelling: false
};
@ -32,6 +33,7 @@
return nextState( state, {
activeLink: action.el,
activeEvent: action.event,
activeToken: action.token,
// When the user dwells on a link with their keyboard, a preview is
// renderered, and then dwells on another link, the LINK_ABANDON_END

View file

@ -17,6 +17,7 @@
enabled: undefined,
activeLink: undefined,
activeEvent: undefined,
activeToken: '',
shouldShow: false,
isUserDwelling: false
}
@ -61,7 +62,8 @@
var action = {
type: 'LINK_DWELL',
el: this.el,
event: {}
event: {},
token: '1234567890'
};
assert.deepEqual(
@ -69,6 +71,7 @@
{
activeLink: action.el,
activeEvent: action.event,
activeToken: action.token,
shouldShow: false
},
'It should set active link and event as well as interaction info and hide the preview.'