(core) Adding font options to the style picker

Summary:
Redesigning color picker:
- Single color palette (no light/dark switch)
- Ability to remove color (new empty button)

New font options in the color picker.
Font options are available on:
- Default cell style
- Conditional rules styles
- Choice/ChoiceList editor and token field
- Filters for Choice/ChoiceList columns

Design document:
https://www.figma.com/file/bRTsb47VIOVBfJPj0qF3C9/Grist-Updates?node-id=415%3A8135

Test Plan: new and updated tests

Reviewers: georgegevoian, alexmojaki

Reviewed By: georgegevoian, alexmojaki

Subscribers: alexmojaki

Differential Revision: https://phab.getgrist.com/D3335
This commit is contained in:
Jarosław Sadziński
2022-04-07 16:58:16 +02:00
parent 98ac2f7e5b
commit 34708cd348
28 changed files with 711 additions and 270 deletions

View File

@@ -1601,6 +1601,28 @@ export function session(): Session {
return Session.default;
}
/**
* Sets font style in opened color picker.
*/
export async function setFont(type: 'bold'|'underline'|'italic'|'strikethrough', onOff: boolean|number) {
const optionToClass = {
bold: '.test-font-option-FontBold',
italic: '.test-font-option-FontItalic',
underline: '.test-font-option-FontUnderline',
strikethrough: '.test-font-option-FontStrikethrough',
};
async function clickFontOption() {
await driver.find(optionToClass[type]).click();
}
async function isFontOption() {
return (await driver.findAll(`${optionToClass[type]}[class*=-selected]`)).length === 1;
}
const current = await isFontOption();
if (onOff && !current || !onOff && current) {
await clickFontOption();
}
}
// Set the value of an `<input type="color">` element to `color` and trigger the `change`
// event. Accepts `color` to be of following forms `rgb(120, 10, 3)` or '#780a03'.
export async function setColor(colorInputEl: WebElement, color: string) {