diff --git a/pwuniapp/common/icons.js b/pwuniapp/common/icons.js index 69e879c..8a79841 100644 --- a/pwuniapp/common/icons.js +++ b/pwuniapp/common/icons.js @@ -45,6 +45,18 @@ export const ICONS = { `), + heart: svgToUri(` + + + + `), + + heartFilled: svgToUri(` + + + + `), + close: svgToUri(` diff --git a/pwuniapp/pages/community/index.vue b/pwuniapp/pages/community/index.vue index b54e2ab..b2a1177 100644 --- a/pwuniapp/pages/community/index.vue +++ b/pwuniapp/pages/community/index.vue @@ -110,7 +110,7 @@ - + {{ post.likes }} diff --git a/server/tests/content-security.spec.ts b/server/tests/content-security.spec.ts index c9c92ec..092d7db 100644 --- a/server/tests/content-security.spec.ts +++ b/server/tests/content-security.spec.ts @@ -917,6 +917,34 @@ describe('ContentSecurityService & Compliance Architecture (TDD 微信内容安 expect(emojiRegex.test(content)).toBe(false); }); }); + + describe('21. 友圈广场点赞图标与矢量图标库完整性验证 (pwuniapp/common/icons.js & pages/community/index.vue)', () => { + const iconsPath = path.join(rootDir, 'pwuniapp', 'common', 'icons.js'); + const communityPath = path.join(rootDir, 'pwuniapp', 'pages', 'community', 'index.vue'); + + it('icons.js 必须完整导出 heart (未点赞) 与 heartFilled (已点赞高亮) 矢量图标', () => { + expect(fs.existsSync(iconsPath)).toBe(true); + const content = fs.readFileSync(iconsPath, 'utf-8'); + expect(content).toContain('heart: svgToUri'); + expect(content).toContain('heartFilled: svgToUri'); + expect(content).toContain('#94A3B8'); + expect(content).toContain('#EF4444'); + }); + + it('友圈广场页面点赞按钮必须正确绑定 heartFilled 与 heart 图标', () => { + expect(fs.existsSync(communityPath)).toBe(true); + const content = fs.readFileSync(communityPath, 'utf-8'); + expect(content).toContain(':src="post.liked ? ICONS.heartFilled : ICONS.heart"'); + }); + + it('icons.js 与友圈广场页面严禁包含任何系统 Emoji 违规字符', () => { + const iconsContent = fs.readFileSync(iconsPath, 'utf-8'); + const communityContent = fs.readFileSync(communityPath, 'utf-8'); + const emojiRegex = /(?:\p{Extended_Pictographic}|\p{Emoji_Presentation}|[\u2600-\u27BF])/u; + expect(emojiRegex.test(iconsContent)).toBe(false); + expect(emojiRegex.test(communityContent)).toBe(false); + }); + }); });