diff --git a/web_src/fomantic/build/components/dropdown.js b/web_src/fomantic/build/components/dropdown.js index 3f78151ece7..473a554882c 100644 --- a/web_src/fomantic/build/components/dropdown.js +++ b/web_src/fomantic/build/components/dropdown.js @@ -49,7 +49,7 @@ $.fn.dropdown = function(parameters) { var settings = ( $.isPlainObject(parameters) ) ? $.extend(true, {}, $.fn.dropdown.settings, parameters) - : $.extend({}, $.fn.dropdown.settings), + : $.extend({}, $.fn.dropdown.settings, {templates: {...$.fn.dropdown.settings.templates}}), // GITEA-PATCH: copy "templates" so per-dropdown changes never reach the defaults className = settings.className, message = settings.message, diff --git a/web_src/js/modules/fomantic/dropdown.test.ts b/web_src/js/modules/fomantic/dropdown.test.ts index 4ea51b3d2ce..8eea7c0eb35 100644 --- a/web_src/js/modules/fomantic/dropdown.test.ts +++ b/web_src/js/modules/fomantic/dropdown.test.ts @@ -1,8 +1,12 @@ import '../../../fomantic/build/fomantic.js'; +import {initGiteaFomantic} from '../fomantic.ts'; import {createElementFromHTML} from '../../utils/dom.ts'; import {hideScopedEmptyDividers} from './dropdown.ts'; -test('dropdown-item-literal-text', () => { +initGiteaFomantic(); + +test('dropdown-item-literal-text-and-default-templates-untouched', () => { + const defaultTemplates = {...$.fn.dropdown.settings.templates}; // a "choice" workflow_dispatch input can offer the string "false" as an option. // jQuery `.data()` would coerce `data-text="false"` to the boolean `false`, which then renders as empty text. const $dropdown = $(`