CB-6964 ported manual tests

Fixed up style

Fixed typo in addEventListener
This commit is contained in:
Staci Cooper 2014-07-16 13:51:46 -04:00
parent fe2b8fb5db
commit fa1bcac78a

View File

@ -56,3 +56,43 @@ exports.defineAutoTests = function() {
}); });
}); });
}; };
/******************************************************************************/
/******************************************************************************/
/******************************************************************************/
exports.defineManualTests = function (contentEl, createActionButton) {
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 onEvent(e) {
eventOutput('Event of type: ' + e.type);
printNetwork();
}
/******************************************************************************/
var html = '<div id="info">' +
'<b>Results:</b><br>' +
'<span id="results"></span>' +
'</div><div id="actions"></div>';
document.addEventListener("online", onEvent, false);
document.addEventListener("offline", onEvent, false);
contentEl.innerHTML = html;
createActionButton('Show Network Connection', function () {
printNetwork();
}, 'actions');
createActionButton('Clear Log', function () {
document.getElementById('results').innerHTML = '';
}, 'actions');
};