mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Fixing couple of bugs in collapsed section layout
Summary: The previous implementation for collapsing sections involved disposing of a view instance (Grid or Chart component). This caused numerous bugs with linking sections as the implementation is located in the BaseView.js. Now the view instance is kept and attached to a dom in a hidden div, so it can respond and function as a normal rendered section. It is also passed from between collapsed and main layout, when sections are dragged or moved using section's menu commands (`collapse` and `add to main page`) It also implies that the ViewLayout must still be rendered when a section is maximized (as it is responsible for the view instance), so the dom, and some logic for rendering it, had to be changed. Test Plan: New and updated Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3826
This commit is contained in:
@@ -103,8 +103,8 @@ export interface IColsSelect<T = WebElement> {
|
||||
* TODO It would be nice if mocha-webdriver allowed exact string match in findContent() (it now
|
||||
* supports a substring match, but we still need a helper for an exact match).
|
||||
*/
|
||||
export function exactMatch(value: string): RegExp {
|
||||
return new RegExp(`^${escapeRegExp(value)}$`);
|
||||
export function exactMatch(value: string, flags?: string): RegExp {
|
||||
return new RegExp(`^${escapeRegExp(value)}$`, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,8 +230,11 @@ export function getSection(sectionOrTitle: string|WebElement): WebElement|WebEle
|
||||
/**
|
||||
* Click into a section without disrupting cursor positions.
|
||||
*/
|
||||
export async function selectSectionByTitle(title: string) {
|
||||
export async function selectSectionByTitle(title: string|RegExp) {
|
||||
try {
|
||||
if (typeof title === 'string') {
|
||||
title = new RegExp("^" + escapeRegExp(title) + "$", 'i');
|
||||
}
|
||||
// .test-viewsection is a special 1px width element added for tests only.
|
||||
await driver.findContent(`.test-viewsection-title`, title).find(".test-viewsection-blank").click();
|
||||
} catch (e) {
|
||||
@@ -408,6 +411,13 @@ export function getDetailCell(colOrOptions: string|ICellSelect, rowNum?: number,
|
||||
return new WebElementPromise(driver, getVisibleDetailCells(options).then((elems) => elems[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a cell on a single card page.
|
||||
*/
|
||||
export function getCardCell(col: string, section?: string) {
|
||||
return getDetailCell({col, rowNum: 1, section});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the cell containing the cursor in the active section, works for both Grid and Detail.
|
||||
@@ -2546,6 +2556,8 @@ export async function setRefShowColumn(col: string) {
|
||||
await waitForServer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns "Data from table" setting value of a reference column.
|
||||
*/
|
||||
@@ -2562,6 +2574,19 @@ export async function setRefTable(table: string) {
|
||||
await waitForServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes "Select by" of the current section.
|
||||
*/
|
||||
export async function selectBy(table: string|RegExp) {
|
||||
await toggleSidePanel('right', 'open');
|
||||
await driver.find('.test-right-tab-pagewidget').click();
|
||||
await driver.find('.test-config-data').click();
|
||||
await driver.find('.test-right-select-by').click();
|
||||
table = typeof table === 'string' ? exactMatch(table) : table;
|
||||
await driver.findContentWait('.test-select-menu li', table, 200).click();
|
||||
await waitForServer();
|
||||
}
|
||||
|
||||
// Add column to sort.
|
||||
export async function addColumnToSort(colName: RegExp|string) {
|
||||
await driver.find(".test-sort-config-add").click();
|
||||
|
||||
Reference in New Issue
Block a user