forked from bluesmoon/boomerang
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
History: Option to disable hard navigation in favor of BOOMR.page_rea…
…dy()
- Loading branch information
1 parent
46c6f62
commit cd5ab8d
Showing
7 changed files
with
118 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<%= header %> | ||
<%= boomerangScript %> | ||
|
||
<script src="support/function-bind-polyfill.js" type="text/javascript"></script> | ||
|
||
<script> | ||
window.imgs = [500]; | ||
|
||
window.html5_mode = false; | ||
|
||
window.call_page_ready = true; | ||
|
||
// view a widget then come back so debugging (F5) is easier | ||
window.nav_routes = ["/widgets/1", "/"]; | ||
|
||
// disable the React hook and use window.history (via auto:true) | ||
window.reactDisableBoomerangHook = true; | ||
</script> | ||
|
||
<div id="root"></div> | ||
<script> | ||
BOOMR_test.init({ | ||
testAfterOnBeacon: 3, | ||
History: { | ||
disableHardNav: true, | ||
enabled: true, | ||
auto: true | ||
}, | ||
autorun: false | ||
}); | ||
</script> | ||
<script src="108-hard-nav-disable.js"></script> | ||
|
||
<script src="support/app.js"></script> | ||
<%= footer %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*eslint-env mocha*/ | ||
/*global BOOMR_test,describe,it,assert*/ | ||
|
||
describe("e2e/12-react/108-hard-nav-disable", function() { | ||
var tf = BOOMR.plugins.TestFramework; | ||
var t = BOOMR_test; | ||
|
||
var pathName = window.location.pathname; | ||
|
||
it("Should pass basic beacon validation", function(done) { | ||
t.validateBeaconWasSent(done); | ||
}); | ||
|
||
it("Should have sent three beacons", function() { | ||
assert.equal(tf.beacons.length, 3); | ||
}); | ||
|
||
it("Should have first beacon be navigation beacon", function() { | ||
var b = tf.beacons[0]; | ||
if (t.isNavigationTimingSupported()) { | ||
assert.equal(b["rt.start"], "navigation"); | ||
} | ||
else { | ||
assert.equal(b["rt.start"], "none"); | ||
} | ||
assert.isUndefined(b["http.initiator"]); | ||
}); | ||
|
||
it("Should have a t_done close to 'timestamp - navigationStart'", function() { | ||
var b = tf.beacons[0]; | ||
if (t.isNavigationTimingSupported()) { | ||
var navStToBoomrTDoneDelta = window.boomr_t_done - window.performance.timing.navigationStart; | ||
assert.closeTo(navStToBoomrTDoneDelta, b.t_done, 100); | ||
} | ||
}); | ||
|
||
it("Second beacon should be soft navigation beacon", function() { | ||
var b = tf.beacons[1]; | ||
assert.equal(b["http.initiator"], "spa"); | ||
}); | ||
|
||
it("Third beacon should be soft navigation beacon", function() { | ||
var b = tf.beacons[2]; | ||
assert.equal(b["http.initiator"], "spa"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,5 +26,5 @@ | |
document.getElementById("content").appendChild(node); | ||
}, 100); | ||
</script> | ||
<%= footer %> | ||
|
||
<%= footer %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters