الفرق بين المراجعتين لصفحة: «ميدياويكي:Gadget-decodesummary-tests.js»
dfghjk>Admin ط (۱ نسخه واردشده) |
(لا فرق)
|
مراجعة ١٩:٢٦، ٢٢ يونيو ٢٠٢٣
window.QUnit = { config: { autostart: false } };
$.getScript('/w/index.php?title=MediaWiki:Gadget-decodesummary.js&action=raw&ctype=text/javascript')
.then(function() {
mw.loader.load('/w/resources/lib/qunitjs/qunit.css', 'text/css');
$.getScript('/w/resources/lib/qunitjs/qunit.js')
.then(runTests, function () { console.log('failed to load QUnit'); })
}, function() {
console.log('Failed to load MediaWiki:Gadget-decodesummary.js');
});
function runTests() {
QUnit.test('decodeSummarySpecial', testSpecialLink);
QUnit.start();
}
function testSpecialLink(assert) {
var server = mw.config.get('wgServer');
assert.equal(
decodeSummarySpecial('https://en.wikipedia.org/w/index.php?title=User:Dalba/sandbox&oldid=880424776'),
'[[en:Special:Permalink/880424776]]',
'en permalink'
);
assert.equal(
decodeSummarySpecial(server + '/w/index.php?title=User:Dalba/sandbox&oldid=880424776'),
'[[Special:Permalink/880424776]]',
'permalink on this site'
);
assert.equal(
decodeSummarySpecial("https://fa.wikipedia.org/w/index.php?title=کاربر:Dalba/صفحه_تمرین&diff=25354187&oldid=25354181"),
'[[Special:Diff/25354181/25354187]]',
'normal diff link'
);
assert.equal(
decodeSummarySpecial("https://fa.wikipedia.org/w/index.php?title=کاربر:Dalba/صفحه_تمرین&oldid=25354181&diff=25354187"),
'[[Special:Diff/25354181/25354187]]',
'the order of oldid and diff fragments are reversed'
);
assert.equal(
decodeSummarySpecial('&oldid=25354181&diff=25354187'),
'[[Special:Diff/25354181/25354187]]',
'short notation for a diff'
);
assert.equal(
decodeSummarySpecial("https://fa.wikipedia.org/w/index.php?title=کاربر:Dalba/صفحه_تمرین&diff=25354187"),
'[[Special:Diff/25354187]]',
'diff without oldid'
);
assert.equal(
decodeSummarySpecial("https://fa.wikipedia.org/w/index.php?title=کاربر:Dalba/صفحه_تمرین&diff=25354187&oldid=prev"),
'[[Special:Diff/prev/25354187]]',
'diff=N&oldid=prev'
);
assert.equal(
decodeSummarySpecial('https://meta.wikimedia.org/w/index.php?title=Wikimedia_France/Micro-financement/Demande/Naissance_de_la_sculpture_gothique&curid=10757892&diff=prev&oldid=18802320'),
'[[meta:Special:Diff/18802320]]',
'meta diff=prev'
);
assert.equal(
decodeSummarySpecial('https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&curid=3252662&diff=880148014&oldid=880126419'),
'[[en:Special:Diff/880126419/880148014]]',
'enwiki diff link'
);
assert.equal(
decodeSummarySpecial('https://meta.wikimedia.org/w/index.php?title=Wikimedia_France/Micro-financement/Demande/Naissance_de_la_sculpture_gothique&curid=10757892&diff=18815382&oldid=18802320'),
'[[meta:Special:Diff/18802320/18815382]]',
'meta diff link'
);
assert.equal(
decodeSummarySpecial('https://fa.wikipedia.org/w/index.php?title=کاربر:Dalba/صفحه_تمرین&action=edit'),
'https://fa.wikipedia.org/w/index.php?title=کاربر:Dalba/صفحه_تمرین&action=edit',
'no more summarizing is possible'
);
assert.equal(
decodeSummarySpecial('https://de.wikipedia.org/wiki/Special:Watchlist'),
'[[de:Special:Watchlist]]',
'simple title on dewiki'
);
assert.equal(
decodeSummarySpecial(server + '/wiki/Special:Watchlist'),
'[[Special:Watchlist]]',
'simple title on this site'
);
}