mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-06 01:16:13 +00:00
feat(actions): implement adaptive auto-refresh for workflow runs list (#38329)
### Description This PR implements an optimized, adaptive client-side auto-refresh mechanism for the Gitea Actions workflow runs list page. It allows users to see workflow progress updates dynamically without having to reload the page. Fixes https://github.com/go-gitea/gitea/issues/37457 --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import {
|
||||
createElementFromAttrs,
|
||||
createElementFromHTML,
|
||||
queryElemChildren,
|
||||
querySingleVisibleElem,
|
||||
createElementFromAttrs, createElementFromHTML,
|
||||
queryElemChildren, querySingleVisibleElem,
|
||||
protectMorphElements, recoverMorphElements,
|
||||
toggleElem,
|
||||
} from './dom.ts';
|
||||
|
||||
@@ -54,3 +53,19 @@ test('toggleElem', () => {
|
||||
toggleElem(el.children, true);
|
||||
expect(el.outerHTML).toEqual('<div><div class="">a</div><div class="">b</div></div>');
|
||||
});
|
||||
|
||||
test('protectMorphElements', () => {
|
||||
const el = createElementFromHTML('<div><span data-morph-protect="">foo</span></div>');
|
||||
const protectedElems = protectMorphElements(el);
|
||||
|
||||
const span = el.querySelector('span')!;
|
||||
const spanMorphProtectId = span.getAttribute('data-morph-protect');
|
||||
expect(spanMorphProtectId).toBeTruthy();
|
||||
expect(el.outerHTML).toEqual(`<div><span data-morph-protect="${spanMorphProtectId}">foo</span></div>`);
|
||||
span.textContent = 'bar';
|
||||
span.classList.add('new-class');
|
||||
expect(el.outerHTML).toEqual(`<div><span data-morph-protect="${spanMorphProtectId}" class="new-class">bar</span></div>`);
|
||||
|
||||
recoverMorphElements(el, protectedElems);
|
||||
expect(el.outerHTML).toEqual('<div><span data-morph-protect="">foo</span></div>');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user