mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-14 11:15:08 +00:00
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:
parent
f26768afe8
commit
46cd38849e
|
@ -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
|
||||
|
|
|
@ -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.'
|
||||
|
|
Loading…
Reference in a new issue