jenkins-bot has submitted this change and it was merged.

Change subject: Don't change address bar in QUnit in Chrome
......................................................................


Don't change address bar in QUnit in Chrome

Cleanup epoch code and tests
(mock the window.history object to avoid the address bar changing
in Chrome)

Change-Id: Ibde7a26d16db73a339641247499ac843806bd4b8
(cherry picked from commit 2790b3702076a43d5d6939735c44afc1eb54c1ee)
---
M javascripts/externals/epoch.js
M tests/javascripts/externals/test_epoch.js
2 files changed, 6 insertions(+), 11 deletions(-)

Approvals:
  JGonera: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/javascripts/externals/epoch.js b/javascripts/externals/epoch.js
index 9111bcf..6eb106c 100644
--- a/javascripts/externals/epoch.js
+++ b/javascripts/externals/epoch.js
@@ -3,12 +3,11 @@
                bind: function() {},
                trigger: function() {}
        },
-       enabled: false,
-       history: window.history
+       enabled: false
 };
 
 ( function( H, $ ) {
-       var lastState, currentState, h = H.history;
+       var lastState, currentState, h = window.history;
 
        function isBrowserSupported( ua ) {
                // http://caniuse.com/history
diff --git a/tests/javascripts/externals/test_epoch.js 
b/tests/javascripts/externals/test_epoch.js
index 6b3eafb..1ef932e 100644
--- a/tests/javascripts/externals/test_epoch.js
+++ b/tests/javascripts/externals/test_epoch.js
@@ -1,17 +1,13 @@
 ( function( H, $ ) {
-       var _h;
        QUnit.module( 'epoch.js', {
                setup: function() {
-                       _h = H.history;
-                       H.history = {
-                               state: {},
-                               replaceState: function() {},
-                               pushState: function() {}
-                       };
+                       sinon.stub( window.history, 'pushState' );
+                       sinon.stub( window.history, 'replaceState' );
                        H._enable();
                },
                teardown: function() {
-                       H.history = _h;
+                       window.history.replaceState.restore();
+                       window.history.pushState.restore();
                }
        } );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/91537
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibde7a26d16db73a339641247499ac843806bd4b8
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Robmoen <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to