In WikibaseLexeme the javascript tests do not use the same source of truth for vue templates as the production code.
This can lead to issues and incidents if the templates are changed and the tests are not updated.
The full process in production is: PHP code (SSR) spits out a component from a template which is they hydrated by the client side JS. So if the JS tests are not using the same templates as PHP, then bad things can happen.
As a programmer, I want one canonical definition per vue template in order to make tests more realistic and avoid mistakes caused by templates out-of-sync with the code working on them.
Acceptance criteria
- only one definition is used per template for both production and testing
- templates are shipped in a way that ensures they match the frontend code they were checked in with (may already be done but should be checked)
Info
- Extensions involved: Wikibase, WikibaseLexeme
- Currently templates can be found in various places, e.g.
- src/Presentation/View/*
- tests/jasmine/* getTemplate()
- tests/qunit/* getRepresentationWidgetTemplate()
A concrete example would be:
- https://github.com/wikimedia/mediawiki-extensions-WikibaseLexeme/blob/a05b29ced086d9414d82ef90ff822b0f5152e52e/src/Presentation/View/LexemeView.php#L309-L361
- https://github.com/wikimedia/mediawiki-extensions-WikibaseLexeme/blob/6aac433df2db00aad47c8a782109a684730c94c9/tests/jasmine/LemmaWidget.spec.js#L166-L204
ResourceLoader templates could be used to load the templates from files on the client side.
this ticket probably also allows us to close T197228