The project shipped a black-and-white theme that was only half converted: the login page looked right, the message page was halfway, and the settings page had not been started. This finishes the move to the CYBER reference in prototype_reference/. Colors now come from a single token source (styles/variables.scss), where every semantic color is declared twice: once as OKLCH for the CSS, and once as an RGB triple so translucent variants can be built as rgba(var(--*-rgb), alpha). Cyan is the system itself, amber means the user has to intervene, green means the machine is working, and red only ever means something broke. The RGB triples are derived from the OKLCH values so the two declarations cannot drift apart. Pages adopt the .cy-* shell classes from the reference (view, panel, kpis, tabs, grid, table, field) instead of ad-hoc markup, which is what makes 19 of 26 views consistent. The remaining seven are deliberately bespoke: chat streams, the kanban board, the workflow canvas, the terminal, and the missing-agent screen. The chart palette and the kanban column colors move into single-source modules so they cannot drift either. A new guard test rejects raw hex colors, named colors, and literal RGB triples anywhere in the client source, with an explicit exemption list for the places that genuinely cannot read a CSS variable. The existing chat semantics spec keeps the chat chain honest. No behavior changes: no logic, no i18n keys, no data structures, and the /chat-run event contract is untouched.
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
// @vitest-environment jsdom
|
||
import { describe, expect, it } from 'vitest'
|
||
import { mount } from '@vue/test-utils'
|
||
import Fixture from './fixtures/script-setup-let-assignment.vue'
|
||
|
||
/**
|
||
* 验证 `<script setup>` 里的 `let` 绑定在模板内联语句里到底能不能写。
|
||
*
|
||
* known-issues #3 认为「编译只对 ref 做解包,let 绑定在模板内联语句里不可写,
|
||
* 这个重置很可能不生效」。这个结论需要运行时证据,不能只靠读编译产物 ——
|
||
* compileScript 会为 `setup-let` 绑定生成一对 getter/setter 放进 __returned__,
|
||
* 模板里的 `$setup.x = v` 走 setter,会写回闭包变量。
|
||
*
|
||
* 判据必须有区分度:先把 counter 推到非 0,再内联复位后读取。
|
||
* 若复位不生效,读到的是 1;复位生效则读到 0。
|
||
*/
|
||
describe('script setup let binding assignment', () => {
|
||
it('resets the counter before the follow-up call reads it', async () => {
|
||
const wrapper = mount(Fixture)
|
||
|
||
await wrapper.find('.bump').trigger('click')
|
||
expect((wrapper.vm as any).observed).toEqual([1])
|
||
|
||
await wrapper.find('.reset-read').trigger('click')
|
||
|
||
// 内联赋值先把 counter 置 0,read() 再读到它 —— 读到 0 说明赋值确实生效
|
||
expect((wrapper.vm as any).observed).toEqual([1, 0])
|
||
})
|
||
})
|