Page MenuHomePhabricator

jsduck: @example for mediawiki.widgets not working
Closed, DeclinedPublic

Description

The live examples for mw.widgets.DateInputWidget.js and DateTimeInputWidget.js aren’t working. This is because their respective files aren’t loaded in maintenance/jsduck/eg-iframe.html. The DateInputWidget for example would need:

<script src="modules/lib/moment/moment.js"></script>
<script src="modules/src/mediawiki.widgets/mw.widgets.CalendarWidget.js"></script>
<script src="modules/src/mediawiki.widgets/mw.widgets.DateInputWidget.js"></script>

It would also need its styles, which are in Less, so will need to converted first, in the postdoc npm script.

The same would apply to mw.widgets.CategoryCapsuleItemWidget and others (once examples are added to them).


Apart from these, there are only two other @examples in MediaWiki core, which are in mediawiki/mediawiki.js which is being included. All of OOUI is also included in eg-iframe.html so that examples in CoreUpstreamOOUI continue to work.

Event Timeline

Do we want to add grunt-contrib-less to core to do this, is there another way? We'd probably also need mw.message for the labels inside the widget to work properly. This is what the preview looks like after only adding the scripts:

Screen Shot 2017-06-26 at 11.02.50 AM.png (421×842 px, 58 KB)

Just came to report this myself:

Uncaught ReferenceError: require is not defined
https://doc.wikimedia.org/mediawiki-core/master/js/modules/src/mediawiki.base/mediawiki.base.js:27
Uncaught TypeError: Cannot read property 'DateInputWidget' of undefined

Change 589768 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] ooui: Fix ButtonWidget jsduck demo

https://gerrit.wikimedia.org/r/589768

Change 589768 merged by jenkins-bot:
[mediawiki/core@master] ooui: Fix ButtonWidget jsduck demo

https://gerrit.wikimedia.org/r/589768

Jdlrobson subscribed.

please use jsdoc rather than fixing this (see T138401)