gristlabs_grist-core/test/client/lib/nameUtils.ts
George Gevoian 3112433a58 (core) Add dropdown conditions
Summary:
Dropdown conditions let you specify a predicate formula that's used to filter
choices and references in their respective autocomplete dropdown menus.

Test Plan: Python and browser tests (WIP).

Reviewers: jarek, paulfitz

Reviewed By: jarek

Subscribers: dsagal, paulfitz

Differential Revision: https://phab.getgrist.com/D4235
2024-04-26 16:57:55 -04:00

31 lines
1.1 KiB
TypeScript

import {checkName} from 'app/client/lib/nameUtils';
import {assert} from 'chai';
describe("nameUtils", function() {
describe("isValidName", function() {
it("should detect invalid name", function() {
assert.equal(checkName('santa'), true);
assert.equal(checkName('_santa'), true);
assert.equal(checkName("O'Neil"), true);
assert.equal(checkName("Emily"), true);
assert.equal(checkName("santa(2)"), true);
assert.equal(checkName("Dr. noname"), true);
assert.equal(checkName("santa-klaus"), true);
assert.equal(checkName("Noémie"), true);
assert.equal(checkName("张伟"), true);
assert.equal(checkName(',,__()'), false);
assert.equal(checkName('<foo>'), false);
assert.equal(checkName('<foo>'), false);
assert.equal(checkName('(bar)'), false);
assert.equal(checkName('foo <baz>'), false);
assert.equal(checkName('-foo'), false);
assert.equal(checkName("'foo"), false);
assert.equal(checkName(' Bob'), false);
assert.equal(checkName('='), false);
assert.equal(checkName('santa='), false);
});
});
});