mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-12 07:05:09 +00:00
2a02f5311d
* "eslint-config-wikimedia": "0.26.0" * "grunt-eslint": "24.3.0" * "grunt-stylelint": "0.19.0" * "stylelint-config-wikimedia": "0.16.1" Including auto fixes. Change-Id: Iadacfc781a48675022144bb8c9489073d0bc19e3
35 lines
895 B
JavaScript
35 lines
895 B
JavaScript
'use strict';
|
|
|
|
const Page = require( 'wdio-mediawiki/Page' ),
|
|
Util = require( 'wdio-mediawiki/Util' );
|
|
|
|
class CitePage extends Page {
|
|
getReference( num ) {
|
|
return $$( '#mw-content-text .reference' )[ num - 1 ];
|
|
}
|
|
|
|
getCiteMultiBacklink( num ) {
|
|
return $( '.references li:nth-of-type(' + num + ') .mw-cite-up-arrow-backlink' );
|
|
}
|
|
|
|
getCiteSingleBacklink( num ) {
|
|
return $( '.references li:nth-of-type(' + num + ') .mw-cite-backlink a' );
|
|
}
|
|
|
|
getCiteSubBacklink( num ) {
|
|
return $( '.mw-cite-backlink sup:nth-of-type(' + num + ') a' );
|
|
}
|
|
|
|
async scriptsReady() {
|
|
await Util.waitForModuleState( 'ext.cite.ux-enhancements' );
|
|
}
|
|
|
|
async getFragmentFromLink( linkElement ) {
|
|
// the href includes the full url so slice the fragment from it
|
|
const href = await linkElement.getAttribute( 'href' );
|
|
return href.slice( href.indexOf( '#' ) + 1 );
|
|
}
|
|
}
|
|
|
|
module.exports = new CitePage();
|