Phuedx has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/331337 )
Change subject: reducers: Store interaction tokens
......................................................................
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
---
M resources/ext.popups/reducers/preview.js
M tests/qunit/ext.popups/reducers/preview.test.js
2 files changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups
refs/changes/37/331337/1
diff --git a/resources/ext.popups/reducers/preview.js
b/resources/ext.popups/reducers/preview.js
index 098af59..ee6ee19 100644
--- a/resources/ext.popups/reducers/preview.js
+++ b/resources/ext.popups/reducers/preview.js
@@ -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
diff --git a/tests/qunit/ext.popups/reducers/preview.test.js
b/tests/qunit/ext.popups/reducers/preview.test.js
index 4b7794a..7729477 100644
--- a/tests/qunit/ext.popups/reducers/preview.test.js
+++ b/tests/qunit/ext.popups/reducers/preview.test.js
@@ -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.'
--
To view, visit https://gerrit.wikimedia.org/r/331337
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae9544055f7eccb4f7f071797eb360bc3456861a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: mpga
Gerrit-Owner: Phuedx <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits