Add trailing newline and run 'npm run format'

This commit is contained in:
Peter deHaan 2017-07-31 08:32:55 -07:00
parent 78b7bea284
commit 40d6d1d4e6
No known key found for this signature in database
GPG Key ID: F0FC6C01C6305097
2 changed files with 21 additions and 17 deletions

View File

@ -3,7 +3,7 @@ window.Raven.config(window.dsn).install();
window.dsn = undefined; window.dsn = undefined;
const testPilotGA = require('testpilot-ga'); const testPilotGA = require('testpilot-ga');
const {gcmCompliant, sendEvent} = require('./utils'); const { gcmCompliant, sendEvent } = require('./utils');
window.analytics = new testPilotGA({ window.analytics = new testPilotGA({
an: 'Firefox Send', an: 'Firefox Send',
ds: 'web', ds: 'web',
@ -11,20 +11,24 @@ window.analytics = new testPilotGA({
}); });
const isSender = !location.pathname.includes('/download'); const isSender = !location.pathname.includes('/download');
const ec = isSender ? 'sender' : 'recipient';
const ua = navigator.userAgent.toLowerCase();
gcmCompliant().catch(err => { gcmCompliant().catch(err => {
sendEvent(isSender ? 'sender' : 'recipient', 'unsupported', { sendEvent(ec, 'unsupported', {
cd6: err cd6: err
}).then(() => { }).then(() => {
location.replace('/unsupported/gcm'); location.replace('/unsupported/gcm');
}); });
}); });
if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && if (
parseInt(navigator.userAgent.toLowerCase().match(/firefox\/*([^\n\r]*)\./)[1]) <= 49) { ua.indexOf('firefox') > -1 &&
sendEvent(isSender ? 'sender' : 'recipient', 'unsupported', { parseInt(ua.match(/firefox\/*([^\n\r]*)\./)[1], 10) <= 49
cd6: new Error('Firefox is outdated.') ) {
}).then(() => { sendEvent(ec, 'unsupported', {
location.replace('/unsupported/outdated'); cd6: new Error('Firefox is outdated.')
}); }).then(() => {
} location.replace('/unsupported/outdated');
});
}

View File

@ -2,9 +2,7 @@ const webdriver = require('selenium-webdriver');
const path = require('path'); const path = require('path');
const until = webdriver.until; const until = webdriver.until;
const driver = new webdriver.Builder() const driver = new webdriver.Builder().forBrowser('firefox').build();
.forBrowser('firefox')
.build();
driver.get(path.join('file:///', __dirname, '/frontend.test.html')); driver.get(path.join('file:///', __dirname, '/frontend.test.html'));
driver.wait(until.titleIs('Mocha Tests')); driver.wait(until.titleIs('Mocha Tests'));
@ -15,8 +13,10 @@ driver.getTitle().then(title => {
if (title === '0') { if (title === '0') {
console.log('Frontend tests have passed.'); console.log('Frontend tests have passed.');
} else { } else {
throw new Error('Frontend tests are failing. ' + throw new Error(
'Please open the frontend.test.html file in a browser.'); 'Frontend tests are failing. ' +
'Please open the frontend.test.html file in a browser.'
);
} }
}) });
}) });