(core) Fixing multicolumn bug on a card view

Summary:
Fixing bug on a card view. Type selector was always showing
'mixed type' value.

Test Plan: Updated

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3704
This commit is contained in:
Jarosław Sadziński 2022-11-14 12:30:50 +01:00
parent ccbdeb71e5
commit 955fdf4ae7
3 changed files with 38 additions and 3 deletions

View File

@ -193,7 +193,11 @@ export class RightPanel extends Disposable {
const selectedColumns = owner.autoDispose(ko.computed(() => {
const vsi = this._gristDoc.viewModel.activeSection?.().viewInstance();
return vsi && vsi.selectedColumns ? vsi.selectedColumns() : null;
if (vsi && vsi.selectedColumns) {
return vsi.selectedColumns();
}
const field = fieldBuilder()?.field;
return field ? [field] : [];
}));
const isMultiSelect = owner.autoDispose(ko.pureComputed(() => {

View File

@ -61,6 +61,18 @@ describe('MultiColumn', function() {
}
});
it('should not work on card view', async () => {
await gu.changeWidget('Card');
await gu.openColumnPanel();
assert.notEqual(await gu.getType(), "Mixed types");
await gu.openColumnPanel();
// Should be able to change type.
await gu.getDetailCell('Test1', 1);
await gu.enterCell("aa");
await gu.setType("Integer", {apply: true});
assert.equal(await gu.getType(), "Integer");
});
it('should undo color change', async () => {
// This is test for a bug, colors were not saved when "click outside" was done by clicking
// one of the cells.

View File

@ -1103,6 +1103,13 @@ export async function selectWidget(
await waitForServer();
}
export async function changeWidget(type: string) {
await openWidgetPanel();
await driver.findContent('.test-right-panel button', /Change Widget/).click();
await selectWidget(type);
await waitForServer();
}
/**
* Toggle elem if not selected. Expects elem to be clickable and to have a class ending with
* -selected when selected.
@ -1329,6 +1336,14 @@ export async function openWidgetPanel() {
await driver.find('.test-right-tab-pagewidget').click();
}
/**
* Opens a Creator Panel on Widget/Table settings tab.
*/
export async function openColumnPanel() {
await toggleSidePanel('right', 'open');
await driver.find('.test-right-tab-field').click();
}
/**
* Moves a column from a hidden to visible section.
* Needs a visible Creator panel.
@ -1521,13 +1536,17 @@ export async function deleteColumn(col: IColHeader|string) {
/**
* Sets the type of the currently selected field to value.
*/
export async function setType(type: RegExp|string, options: {skipWait?: boolean} = {}) {
export async function setType(type: RegExp|string, options: {skipWait?: boolean, apply?: boolean} = {}) {
await toggleSidePanel('right', 'open');
await driver.find('.test-right-tab-field').click();
await driver.find('.test-fbuilder-type-select').click();
type = typeof type === 'string' ? exactMatch(type) : type;
await driver.findContentWait('.test-select-menu .test-select-row', type, 500).click();
if (!options.skipWait) { await waitForServer(); }
if (!options.skipWait || options.apply) { await waitForServer(); }
if (options.apply) {
await driver.findWait('.test-type-transform-apply', 1000).click();
await waitForServer();
}
}
/**