Spun out of T288367
List of steps to reproduce (step by step, including full links if applicable):
- Visit https://en.wikipedia.org/wiki/Main_Page?useskinversion=2
- Open up developer console and run the following gadget code:
mw.util.addPortletLink('p-cactions', '#test', 'Test link')- Click the more menu
What happens?:
A link is created, but the resulting HTML is inconsistent with other menu items, leading to an inconsistent font-size
What should have happened instead?:
The resulting item should have been wrapped in a span.
The options in Skin->defaultLinkOptions should be known to the addPortletLink method in a similar way to Skin::makeLink
e.g.
var portletOptions = mw.config.get('wgSkinPortletLinkOptions' );
...
link = document.createElement( 'a' );
link.href = href;
if ( portletOptions['text-wrapper'] ) {
wrapper = document.createElement( portletOptions['text-wrapper'] );
wrapper.textContent = text;
link.appendChild( wrapper );
} else {
link.textContent = text;
}Acceptance criteria
- The mw-list-item class should always be on the LI element
- The mw-list-item-js class should be on LI elements that have been added with addPortletLink
- The JS should build list items based on the text-wrapper option
QA
- Use addPortletLink in the the developer console to test, i.e. mw.util.addPortletLink('p-cactions', '#test', 'Test link')
- Ensure portlet links have the correct classes as specified by the AC above
- Ensure that portlet links added by addPortletLink have the same markup as other portlet links generated by the server
- Update the "text-wrapper" option in skin.json and ensure the portlet links are still wrapped correctly, i.e.
"text-wrapper": {
"tag": "div"
}or
"text-wrapper": [{
"tag": "div"
},{
"tag": "span"
}]QA Results - Beta
| AC | Status | Details |
|---|---|---|
| 1 | ✅ | T289163#7452746 |
| 2 | ✅ | T289163#7452746 |
| 3 | ✅ | T289163#7452746 |
| 4 | ✅ | T289163#7452746 |
QA Results - Prod
| AC | Status | Details |
|---|---|---|
| 1 | ✅ | T289163#7452759 |
| 2 | ✅ | T289163#7452759 |
| 3 | ✅ | T289163#7452759 |
| 4 | ⬜ | T289163#7452759 |









