From 03e600559d874aa2c7cd95a9ee89b02e360a9906 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Sat, 21 May 2022 21:28:19 +0900 Subject: [PATCH] refs #3301 Rewrite organisms/Toot with composition API --- spec/renderer/unit/utils/tootParser.spec.ts | 18 +- src/renderer/components/organisms/Toot.vue | 613 +++++++++--------- .../Contents/SideBar/TootDetail.ts | 12 +- src/renderer/store/organisms/Toot.ts | 23 +- src/renderer/utils/tootParser.d.ts | 17 - src/renderer/utils/tootParser.js | 83 --- src/renderer/utils/tootParser.ts | 108 +++ 7 files changed, 451 insertions(+), 423 deletions(-) delete mode 100644 src/renderer/utils/tootParser.d.ts delete mode 100644 src/renderer/utils/tootParser.js create mode 100644 src/renderer/utils/tootParser.ts diff --git a/spec/renderer/unit/utils/tootParser.spec.ts b/spec/renderer/unit/utils/tootParser.spec.ts index 599845fd..5e6e49ee 100644 --- a/spec/renderer/unit/utils/tootParser.spec.ts +++ b/spec/renderer/unit/utils/tootParser.spec.ts @@ -32,7 +32,8 @@ I released Whalebird version 2.4.1. In version 2.4.0, Whalebird supports streami `).window.document const target = doc.getElementById('tag') it('should find', () => { - const res = findTag(target) + expect(target).not.toBeNull() + const res = findTag(target!) expect(res).toEqual('whalebird') }) }) @@ -48,7 +49,8 @@ I released Whalebird version 2.4.1. In version 2.4.0, Whalebird supports streami `).window.document const target = doc.getElementById('tag') it('should find', () => { - const res = findTag(target) + expect(target).not.toBeNull() + const res = findTag(target!) expect(res).toEqual('whalebird') }) }) @@ -65,7 +67,8 @@ describe('findAccount', () => { `).window.document const target = doc.getElementById('user') it('should find', () => { - const res = findAccount(target) + expect(target).not.toBeNull() + const res = findAccount(target!) expect(res).not.toBeNull() expect(res!.username).toEqual('@h3_poteto') expect(res!.acct).toEqual('@h3_poteto@social.mikutter.hachune.net') @@ -81,7 +84,8 @@ describe('findAccount', () => { `).window.document const target = doc.getElementById('user') it('should find', () => { - const res = findAccount(target) + expect(target).not.toBeNull() + const res = findAccount(target!) expect(res).not.toBeNull() expect(res!.username).toEqual('@h3poteto') expect(res!.acct).toEqual('@h3poteto@pleroma.io') @@ -97,7 +101,8 @@ describe('findAccount', () => { `).window.document const target = doc.getElementById('status') it('should not find', () => { - const res = findAccount(target) + expect(target).not.toBeNull() + const res = findAccount(target!) expect(res).toBeNull() }) }) @@ -111,7 +116,8 @@ describe('findAccount', () => { `).window.document const target = doc.getElementById('status') it('should not find', () => { - const res = findAccount(target) + expect(target).not.toBeNull() + const res = findAccount(target!) expect(res).toBeNull() }) }) diff --git a/src/renderer/components/organisms/Toot.vue b/src/renderer/components/organisms/Toot.vue index da86d5f0..64d19e69 100644 --- a/src/renderer/components/organisms/Toot.vue +++ b/src/renderer/components/organisms/Toot.vue @@ -219,27 +219,38 @@ -