CB-12895 : added eslint and removed eslint

This commit is contained in:
Audrey So
2017-06-12 11:15:35 -07:00
parent f9643daba0
commit 78691e43e1
11 changed files with 174 additions and 183 deletions
+22 -22
View File
@@ -19,17 +19,17 @@
*
*/
/* jshint jasmine: true */
/* eslint-env jasmine */
/* global Connection */
exports.defineAutoTests = function () {
describe('Network (navigator.connection)', function () {
it("network.spec.1 should exist", function () {
it('network.spec.1 should exist', function () {
expect(navigator.network && navigator.network.connection).toBeDefined();
expect(navigator.connection).toBeDefined();
});
it("network.spec.2 should be set to a valid value", function () {
it('network.spec.2 should be set to a valid value', function () {
var validValues = {
'unknown': 1,
'ethernet': 1,
@@ -43,19 +43,19 @@ exports.defineAutoTests = function () {
expect(validValues[navigator.connection.type]).toBe(1);
});
it("network.spec.3 should have the same value in deprecated and non-deprecated apis", function () {
it('network.spec.3 should have the same value in deprecated and non-deprecated apis', function () {
expect(navigator.network.connection.type).toBe(navigator.connection.type);
});
it("network.spec.4 should define constants for connection status", function () {
expect(Connection.UNKNOWN).toBe("unknown");
expect(Connection.ETHERNET).toBe("ethernet");
expect(Connection.WIFI).toBe("wifi");
expect(Connection.CELL_2G).toBe("2g");
expect(Connection.CELL_3G).toBe("3g");
expect(Connection.CELL_4G).toBe("4g");
expect(Connection.NONE).toBe("none");
expect(Connection.CELL).toBe("cellular");
it('network.spec.4 should define constants for connection status', function () {
expect(Connection.UNKNOWN).toBe('unknown');
expect(Connection.ETHERNET).toBe('ethernet');
expect(Connection.WIFI).toBe('wifi');
expect(Connection.CELL_2G).toBe('2g');
expect(Connection.CELL_3G).toBe('3g');
expect(Connection.CELL_4G).toBe('4g');
expect(Connection.NONE).toBe('none');
expect(Connection.CELL).toBe('cellular');
});
});
};
@@ -65,17 +65,17 @@ exports.defineAutoTests = function () {
/******************************************************************************/
exports.defineManualTests = function (contentEl, createActionButton) {
function eventOutput(s) {
var el = document.getElementById("results");
el.innerHTML = el.innerHTML + s + "<br>";
function eventOutput (s) {
var el = document.getElementById('results');
el.innerHTML = el.innerHTML + s + '<br>';
}
function printNetwork() {
eventOutput("navigator.connection.type=" + navigator.connection.type);
eventOutput("navigator.network.connection.type=" + navigator.network.connection.type);
function printNetwork () {
eventOutput('navigator.connection.type=' + navigator.connection.type);
eventOutput('navigator.network.connection.type=' + navigator.network.connection.type);
}
function onEvent(e) {
function onEvent (e) {
eventOutput('Event of type: ' + e.type);
printNetwork();
}
@@ -90,8 +90,8 @@ exports.defineManualTests = function (contentEl, createActionButton) {
' The result will be unknown, ethernet, wifi, 2g, 3g, 4g, none, or cellular. Make sure it matches what the device is connected to.' +
'</p> <div id="actions"></div>';
document.addEventListener("online", onEvent, false);
document.addEventListener("offline", onEvent, false);
document.addEventListener('online', onEvent, false);
document.addEventListener('offline', onEvent, false);
contentEl.innerHTML = html;
createActionButton('Show Network Connection', function () {