Skip to content

Commit

Permalink
Merge pull request YahooArchive#34 from lognormal/page-group-order
Browse files Browse the repository at this point in the history
Page group order tests and .eslint changes
  • Loading branch information
nicjansma committed Apr 2, 2015
2 parents d2a807c + 45a435c commit f11bfc2
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 12 deletions.
9 changes: 5 additions & 4 deletions .eslintrc
@@ -1,6 +1,6 @@
{
"env": {
"browser": true
"browser":true
},
"globals": {
"BOOMR":true,
Expand All @@ -22,9 +22,10 @@
"no-console":0,
"no-delete-var":0,
"no-underscore-dangle":0,
"no-multi-spaces": 0,
"no-multi-spaces":0,
"dot-notation":[2, {"allowKeywords": false}],
"space-unary-ops": 0,
"key-spacing": 0
"space-unary-ops":0,
"key-spacing":0,
"no-empty":2
}
}
8 changes: 7 additions & 1 deletion boomerang.js
Expand Up @@ -124,6 +124,7 @@ if (!BOOMR.plugins) { BOOMR.plugins = {}; }
}
}
catch(ignore) {
// empty
}

try {
Expand All @@ -138,6 +139,7 @@ if (!BOOMR.plugins) { BOOMR.plugins = {}; }
}
}
catch(ignore) {
// empty
}

if (!createCustomEvent && d.createEventObject) {
Expand Down Expand Up @@ -687,6 +689,7 @@ boomr = {
try {
form.submit();
} catch (ignore) {
// empty
}

if (urls.length) {
Expand Down Expand Up @@ -866,7 +869,10 @@ boomr = {
};
}
}
catch(ignore) { }
catch(ignore) {
// empty
}

return Date.now || function() { return new Date().getTime(); };
}()),

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -22,7 +22,7 @@
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-uglify": "^0.6.0",
"grunt-eslint": "*",
"grunt-eslint": "^10.0.0",
"grunt-filesize": "0.0.7",
"grunt-karma": "^0.9.0",
"grunt-protractor-runner": "^1.2.1",
Expand Down
6 changes: 3 additions & 3 deletions plugins/navtiming.js
Expand Up @@ -88,7 +88,7 @@ var impl = {

BOOMR.addVar(data);

try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) {}
try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) { /* empty */ }

this.complete = true;
BOOMR.sendBeacon();
Expand Down Expand Up @@ -142,7 +142,7 @@ var impl = {

BOOMR.addVar(data);

try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) {}
try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) { /* empty */ }
}

// XXX Inconsistency warning. msFirstPaint above is in milliseconds while
Expand All @@ -159,7 +159,7 @@ var impl = {

BOOMR.addVar(data);

try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) {}
try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) { /* empty */ }
}
}

Expand Down
3 changes: 1 addition & 2 deletions plugins/page-params.js
Expand Up @@ -579,8 +579,7 @@ Handler.prototype = {
return null;
}
}
catch(ignore) {
}
catch(ignore) { /* empty */ }

BOOMR.addError(e, "PageVars.findResource");
return null;
Expand Down
2 changes: 1 addition & 1 deletion plugins/restiming.js
Expand Up @@ -160,7 +160,7 @@ function getNavStartTime(frame) {
}
catch(e)
{
// swallow all access exceptions
// empty
}

return navStart;
Expand Down
38 changes: 38 additions & 0 deletions tests/page-templates/04-page-params/01-page-group-order.html
@@ -0,0 +1,38 @@
<%= header %>
<%= boomerangSnippet %>
<div class="cart-container" style="display: none">
<div id="cart-total">$444.44</div>
</div>
<script src="01-page-group-order.js" type="text/javascript"></script>
<script>
page_group_var = 111;
page_group_fn = function() {
return 222;
}
page_group_fn_2 = function() {
return 333;
}

BOOMR_test.init({
testAfterOnBeacon: true,
PageParams: {
pageGroups: [
{
type: "Regexp",
parameter1: "/no-match/",
parameter2: "No Match"
},
{
// this one should be the match (111)
type: "Custom",
parameter1: "page_group_var"
},
{
type: "Custom",
parameter1: "page_group_fn"
}
]
}
});
</script>
<%= footer %>
16 changes: 16 additions & 0 deletions tests/page-templates/04-page-params/01-page-group-order.js
@@ -0,0 +1,16 @@
/*eslint-env mocha*/
/*global BOOMR_test,assert*/

describe("e2e/04-page-params/00-page-groups", function() {
var tf = BOOMR.plugins.TestFramework;
var t = BOOMR_test;

it("Should pass basic beacon validation", function(done) {
t.validateBeaconWasSent(done);
});

it("Should set the Page Group to 111", function() {
var b = tf.lastBeacon();
assert.equal(b["h.pg"], 111);
});
});

0 comments on commit f11bfc2

Please sign in to comment.