Skip to content

Commit 93077ef

Browse files
committed
Use window.alert instead of disabling eslint warning
1 parent d54c740 commit 93077ef

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

tests/tests.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
186186
iab = cordova.InAppBrowser.open(url, target, params, callbacks);
187187
}
188188
if (!iab) {
189-
alert('open returned ' + iab); // eslint-disable-line no-undef
189+
window.alert('open returned ' + iab);
190190
return;
191191
}
192192

@@ -196,22 +196,22 @@ exports.defineManualTests = function (contentEl, createActionButton) {
196196
// Verify that event.url gets updated on redirects.
197197
if (e.type === 'loadstart') {
198198
if (e.url === lastLoadStartURL) {
199-
alert('Unexpected: loadstart fired multiple times for the same URL.'); // eslint-disable-line no-undef
199+
window.alert('Unexpected: loadstart fired multiple times for the same URL.');
200200
}
201201
lastLoadStartURL = e.url;
202202
}
203203
// Verify the right number of loadstart events were fired.
204204
if (e.type === 'loadstop' || e.type === 'loaderror') {
205205
if (e.url !== lastLoadStartURL) {
206-
alert('Unexpected: ' + e.type + ' event.url != loadstart\'s event.url'); // eslint-disable-line no-undef
206+
window.alert('Unexpected: ' + e.type + ' event.url != loadstart\'s event.url');
207207
}
208208
if (numExpectedRedirects === 0 && counts.loadstart !== 1) {
209209
// Do allow a loaderror without a loadstart (e.g. in the case of an invalid URL).
210210
if (!(e.type === 'loaderror' && counts.loadstart === 0)) {
211-
alert('Unexpected: got multiple loadstart events. (' + counts.loadstart + ')'); // eslint-disable-line no-undef
211+
window.alert('Unexpected: got multiple loadstart events. (' + counts.loadstart + ')');
212212
}
213213
} else if (numExpectedRedirects > 0 && counts.loadstart < (numExpectedRedirects + 1)) {
214-
alert('Unexpected: should have got at least ' + (numExpectedRedirects + 1) + ' loadstart events, but got ' + counts.loadstart); // eslint-disable-line no-undef
214+
window.alert('Unexpected: should have got at least ' + (numExpectedRedirects + 1) + ' loadstart events, but got ' + counts.loadstart);
215215
}
216216
wasReset = true;
217217
numExpectedRedirects = 0;
@@ -221,9 +221,9 @@ exports.defineManualTests = function (contentEl, createActionButton) {
221221
if (e.type === 'exit') {
222222
var numStopEvents = counts.loadstop + counts.loaderror;
223223
if (numStopEvents === 0 && !wasReset) {
224-
alert('Unexpected: browser closed without a loadstop or loaderror.'); // eslint-disable-line no-undef
224+
window.alert('Unexpected: browser closed without a loadstop or loaderror.');
225225
} else if (numStopEvents > 1) {
226-
alert('Unexpected: got multiple loadstop/loaderror events.'); // eslint-disable-line no-undef
226+
window.alert('Unexpected: got multiple loadstop/loaderror events.');
227227
}
228228
}
229229
}
@@ -252,10 +252,10 @@ exports.defineManualTests = function (contentEl, createActionButton) {
252252
var iab = doOpen(url, '_blank', 'location=yes');
253253
var callback = function (results) {
254254
if (results && results.length === 0) {
255-
alert('Results verified'); // eslint-disable-line no-undef
255+
window.alert('Results verified');
256256
} else {
257257
console.log(results);
258-
alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results)); // eslint-disable-line no-undef
258+
window.alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));
259259
}
260260
};
261261
if (cssUrl) {
@@ -276,10 +276,10 @@ exports.defineManualTests = function (contentEl, createActionButton) {
276276
iab.addEventListener('loadstop', function (event) {
277277
iab.executeScript({ file: jsUrl }, useCallback && function (results) {
278278
if (results && results.length === 0) {
279-
alert('Results verified'); // eslint-disable-line no-undef
279+
window.alert('Results verified');
280280
} else {
281281
console.log(results);
282-
alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results)); // eslint-disable-line no-undef
282+
window.alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));
283283
}
284284
});
285285
});
@@ -292,22 +292,22 @@ exports.defineManualTests = function (contentEl, createActionButton) {
292292
'})()';
293293
iab.executeScript({ code: code }, useCallback && function (results) {
294294
if (results && results.length === 1 && results[0] === 'abc') {
295-
alert('Results verified'); // eslint-disable-line no-undef
295+
window.alert('Results verified');
296296
} else {
297297
console.log(results);
298-
alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results)); // eslint-disable-line no-undef
298+
window.alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results));
299299
}
300300
});
301301
});
302302
}
303303
}
304304
var hiddenwnd = null;
305-
var loadlistener = function (event) { alert('background window loaded '); }; // eslint-disable-line no-undef
305+
var loadlistener = function (event) { window.alert('background window loaded '); };
306306
function openHidden (url, startHidden) {
307307
var shopt = (startHidden) ? 'hidden=yes' : '';
308308
hiddenwnd = cordova.InAppBrowser.open(url, 'random_string', shopt);
309309
if (!hiddenwnd) {
310-
alert('cordova.InAppBrowser.open returned ' + hiddenwnd); // eslint-disable-line no-undef
310+
window.alert('cordova.InAppBrowser.open returned ' + hiddenwnd);
311311
return;
312312
}
313313
if (startHidden) hiddenwnd.addEventListener('loadstop', loadlistener);
@@ -712,14 +712,14 @@ exports.defineManualTests = function (contentEl, createActionButton) {
712712
});
713713
ref.addEventListener('customscheme', function (e) {
714714
if (e && e.url === 'custom://test') {
715-
alert('Results verified'); // eslint-disable-line no-undef
715+
window.alert('Results verified');
716716
} else {
717-
alert('Got: ' + e.url); // eslint-disable-line no-undef
717+
window.alert('Got: ' + e.url);
718718
}
719719
ref.close();
720720
});
721721
ref.addEventListener('loaderror', function (e) {
722-
alert('Load error: ' + e.message + '\nYou may need to set the AllowedSchemes preference'); // eslint-disable-line no-undef
722+
window.alert('Load error: ' + e.message + '\nYou may need to set the AllowedSchemes preference');
723723
ref.close();
724724
});
725725
}, 'openCustomscheme');

0 commit comments

Comments
 (0)