1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-06 02:27:20 +00:00

Fix dropdown delegating and some UI problems (#34014)

The old logic is incomplete. See the comment for the improved logic.

Fix #34011

And more fixes:

1. use empty "alt" for images, otherwise the width is not right when the
image fails to load
2. remove the "dropdown icon" patch, because it has been clearly done in
"dropdown.js" now
3. remove the "dropdown filtered item" patch, added a clear callback,
and improve the logic
4. fix global init when a node is removed and added back gain (eg: the
"cherry pick" dialog with a dropdown)
This commit is contained in:
wxiaoguang
2025-03-26 10:51:22 +08:00
committed by GitHub
parent 2089401653
commit d28a7f9fea
6 changed files with 64 additions and 47 deletions

View File

@ -23,7 +23,27 @@ test('hideScopedEmptyDividers-simple', () => {
`);
});
test('hideScopedEmptyDividers-hidden1', () => {
test('hideScopedEmptyDividers-items-all-filtered', () => {
const container = createElementFromHTML(`<div>
<div class="any"></div>
<div class="divider"></div>
<div class="item filtered">a</div>
<div class="item filtered">b</div>
<div class="divider"></div>
<div class="any"></div>
</div>`);
hideScopedEmptyDividers(container);
expect(container.innerHTML).toEqual(`
<div class="any"></div>
<div class="divider hidden transition"></div>
<div class="item filtered">a</div>
<div class="item filtered">b</div>
<div class="divider"></div>
<div class="any"></div>
`);
});
test('hideScopedEmptyDividers-hide-last', () => {
const container = createElementFromHTML(`<div>
<div class="item">a</div>
<div class="divider" data-scope="b"></div>
@ -37,7 +57,7 @@ test('hideScopedEmptyDividers-hidden1', () => {
`);
});
test('hideScopedEmptyDividers-hidden2', () => {
test('hideScopedEmptyDividers-scoped-items', () => {
const container = createElementFromHTML(`<div>
<div class="item" data-scope="">a</div>
<div class="divider" data-scope="b"></div>