mirror of
https://github.com/NetEase/tango.git
synced 2026-09-01 15:03:03 +08:00
dbbd1dddc7
* fix: update interfaces * test: update * fix: test if code has expression wrapper * fix: parse code to expression node * fix: update long text style in variableTree --------- Co-authored-by: wwsun <ww.sww@outlook.com>
26 lines
1.4 KiB
TypeScript
26 lines
1.4 KiB
TypeScript
import { isTangoVariable, isWrappedByExpressionContainer } from '../src/helpers';
|
|
|
|
describe('assert', () => {
|
|
it('isTangoVariable', () => {
|
|
expect(isTangoVariable('tango.stores.app.name')).toBeTruthy();
|
|
expect(isTangoVariable('tango.stores?.app?.name')).toBeTruthy();
|
|
expect(isTangoVariable('tango.stores.app?.name')).toBeTruthy();
|
|
// expect(isTangoVariable('tango.copyToClipboard')).toBeTruthy();
|
|
});
|
|
|
|
it('isWrappedByExpressionContainer', () => {
|
|
expect(isWrappedByExpressionContainer('{this.foo}')).toBeTruthy();
|
|
expect(isWrappedByExpressionContainer('{!false}')).toBeTruthy();
|
|
expect(isWrappedByExpressionContainer('{[]}')).toBeTruthy();
|
|
expect(isWrappedByExpressionContainer('{{ foo: "bar" }}')).toBeTruthy();
|
|
expect(isWrappedByExpressionContainer('{[{ foo: "bar" }]}')).toBeTruthy();
|
|
expect(isWrappedByExpressionContainer('{123}')).toBeTruthy();
|
|
expect(isWrappedByExpressionContainer('{"hello"}')).toBeTruthy();
|
|
expect(isWrappedByExpressionContainer('{ foo: "bar" }')).toBeFalsy();
|
|
expect(isWrappedByExpressionContainer('{ type: tango.stores?.homePage?.tabKey }')).toBeFalsy();
|
|
expect(isWrappedByExpressionContainer('{ type: tango.stores.homePage.tabKey }')).toBeFalsy();
|
|
expect(isWrappedByExpressionContainer('{ foo: "bar" }')).toBeFalsy();
|
|
expect(isWrappedByExpressionContainer('{ color: tango.stores.app.color }')).toBeFalsy();
|
|
});
|
|
});
|