User:Evad37/Covery/sandbox.js: Difference between revisions

Content deleted Content added
Rm mediawiki.RegExp
Fix onFileSelectChange handler; lint error fixes
Line 1:
/* jshint esversion: 6, laxbreak: true, undef: true, eqnull: true, maxerr: 999 */
/* globals console, document, File, FileReader, fetch, window, $, mw, OO */
// <nowiki>
var setupCovery = function setupCovery() {
Line 164 ⟶ 166:
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext('2d');
ctx.drawImage(origImg, 0, 0, width, height);
 
Line 591 ⟶ 593:
};
 
CoveryDialog.prototype.onFileSelectChange = function(filefiles) {
var file = files && files[0];
if (!file || !file.name) {
return;
}
this.onFileChosen(file, file.name, this.fileSelect, this.urlInput);
};
Line 971 ⟶ 977:
function(data) {
if (data && data.sucess) {
window.___location.reload();
}
},
Line 1,059 ⟶ 1,065:
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Evad37/qunit-2.8.0.css&action=raw&ctype=text/css', 'text/css');
$.getScript('https://en.wikipedia.org/w/index.php?title=User:Evad37/qunit-2.8.0.js&action=raw&ctype=text/javascript', function() {
/* globals QUnit */
QUnit.module('Get parameters from a template');
QUnit.test('Single unnamed param', function(assert) {
Line 1,620 ⟶ 1,627:
'{{infobox video game franchise}}'
];
infoboxesExpectedToPass.forEach(infobox => {
for (let infobox of infoboxesExpectedToPass) {
QUnit.test(infobox, function(assert) {
let infoboxObject = getInfoboxTemplate(infobox);
Line 1,626 ⟶ 1,633:
assert.deepEqual(checkedInfobox, infoboxObject, infobox + ' passes check');
});
});
QUnit.module('Infobox check (expected fail)');
var infoboxesExpectedToFail = [
Line 1,636 ⟶ 1,643:
'{{infobox foo}}'
];
infoboxesExpectedToFail.forEach(infobox => {
for (let infobox of infoboxesExpectedToFail) {
QUnit.test(infobox, function(assert) {
let infoboxObject = getInfoboxTemplate(infobox);
Line 1,643 ⟶ 1,650:
}, infobox + ' throws an error');
});
});
 
QUnit.module('Make infobox wikitext');