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.
**AC**In WikibaseLexeme the javascript tests do not use the same source of truth for vue templates as the production code.
* only one definition is used per template (i.e.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**, production for testing)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 (allows us to close T197228)may already be done but should be checked)
### Info
- Extensions involved: Wikibase, WikibaseLexeme
**Info**- Currently templates can be found in various places, e.g.
* Currently templates can be found in various places, e.g. - `src/Presentation/View/*`
** `src/View/*` - `tests/jasmine/*` `getTemplate()`
** `tests/jasmine/LanguageAndLexicalCategoryWidget.spec.js` `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
** `tests/qunit/jquery.wikibase.lexemeformview.tests.js` `getRepresentationWidgetTemplate()`- https://github.com/wikimedia/mediawiki-extensions-WikibaseLexeme/blob/6aac433df2db00aad47c8a782109a684730c94c9/tests/jasmine/LemmaWidget.spec.js#L166-L204
[ResourceLoader templates](https://www.mediawiki.org/wiki/Manual:HTML_templates#mw.template_(client-side)) could be used to load the templates from files on the client side.
>>! In T198455#5782277, @Jakob_WMDE wrote:
> I believe that this is achievable with [ResourceLoader HTML templates](https://www.mediawiki.org/wiki/Manual:HTML_templates#mw.template_(client-side)). We can extract the vue templates into individual files, and then share them between the PHP and JS code. It looks like MediaWiki currently expects this type of template to be mustache templates, but also provides a mechanism to provide alternative formats via [custom template compilers](https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/resources/src/mediawiki.template.mustache.js).
this ticket probably also allows us to close T197228