diff --git a/assets/components/LogViewer/EventSource.spec.ts b/assets/components/LogViewer/EventSource.spec.ts index 52c7ee1b..9a1d9d24 100644 --- a/assets/components/LogViewer/EventSource.spec.ts +++ b/assets/components/LogViewer/EventSource.spec.ts @@ -103,7 +103,7 @@ describe("", () => { test("renders loading correctly", async () => { const wrapper = createLogEventSource(); - expect(wrapper.html()).toMatchSnapshot(); + expect(wrapper.find("ul.animate-pulse").exists()).toBe(true); }); test("should connect to EventSource", async () => { diff --git a/assets/components/LogViewer/EventSource.vue b/assets/components/LogViewer/EventSource.vue index e22c68f8..2d7c2451 100644 --- a/assets/components/LogViewer/EventSource.vue +++ b/assets/components/LogViewer/EventSource.vue @@ -1,12 +1,13 @@ @@ -29,6 +30,8 @@ const color = computed(() => { }); const noLogs = computed(() => messages.value.length === 0); +const waitingForMoreLog = refAutoReset(false, 3000); +watchImmediate(loading, () => (waitingForMoreLog.value = true)); defineExpose({ clear: () => (messages.value = []), @@ -41,4 +44,8 @@ const fetchMore = async () => { loadingMore.value = false; } }; + +const shuffle = (items: any[]) => { + return items.sort(() => Math.random() - 0.5); +}; diff --git a/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap b/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap index 9d65c971..4afebbac 100644 --- a/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap +++ b/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap @@ -60,29 +60,6 @@ exports[` > render html correctly > should render messag " `; -exports[` > renders loading correctly 1`] = ` -"
-
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    Loading... -
-
" -`; - exports[` > should parse messages 1`] = ` SimpleLogEntry { "_message": "This is a message.",