@dxos/plugin-sheet 0.7.2-main.f1adc9f → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/lib/browser/{SheetContainer-DBDIZU6U.mjs → SheetContainer-YAMIOFC6.mjs} +3 -4
  2. package/dist/lib/browser/{SheetContainer-DBDIZU6U.mjs.map → SheetContainer-YAMIOFC6.mjs.map} +3 -3
  3. package/dist/lib/browser/{chunk-IXA5HC36.mjs → chunk-QHQFM7LV.mjs} +22 -48
  4. package/dist/lib/browser/{chunk-IXA5HC36.mjs.map → chunk-QHQFM7LV.mjs.map} +4 -4
  5. package/dist/lib/browser/index.mjs +13 -8
  6. package/dist/lib/browser/index.mjs.map +3 -3
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/node/{SheetContainer-3373SORI.cjs → SheetContainer-BSDHHYXE.cjs} +15 -16
  9. package/dist/lib/node/{SheetContainer-3373SORI.cjs.map → SheetContainer-BSDHHYXE.cjs.map} +3 -3
  10. package/dist/lib/node/{chunk-TS6IBEPZ.cjs → chunk-J5ZFWMOD.cjs} +10 -34
  11. package/dist/lib/node/{chunk-TS6IBEPZ.cjs.map → chunk-J5ZFWMOD.cjs.map} +4 -4
  12. package/dist/lib/node/index.cjs +15 -10
  13. package/dist/lib/node/index.cjs.map +3 -3
  14. package/dist/lib/node/meta.json +1 -1
  15. package/dist/lib/node-esm/{SheetContainer-CH2RYBXJ.mjs → SheetContainer-T47T2NYJ.mjs} +3 -4
  16. package/dist/lib/node-esm/{SheetContainer-CH2RYBXJ.mjs.map → SheetContainer-T47T2NYJ.mjs.map} +3 -3
  17. package/dist/lib/node-esm/{chunk-7F3BRKP7.mjs → chunk-6GSTEN7N.mjs} +22 -48
  18. package/dist/lib/node-esm/{chunk-7F3BRKP7.mjs.map → chunk-6GSTEN7N.mjs.map} +4 -4
  19. package/dist/lib/node-esm/index.mjs +13 -8
  20. package/dist/lib/node-esm/index.mjs.map +3 -3
  21. package/dist/lib/node-esm/meta.json +1 -1
  22. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  23. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  24. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +0 -1
  25. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
  26. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +0 -2
  27. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  29. package/dist/types/src/components/index.d.ts +0 -1
  30. package/dist/types/src/components/index.d.ts.map +1 -1
  31. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  32. package/package.json +37 -39
  33. package/src/SheetPlugin.tsx +13 -5
  34. package/src/components/GridSheet/GridSheet.stories.tsx +0 -2
  35. package/src/components/GridSheet/GridSheet.tsx +3 -12
  36. package/src/components/SheetContainer/SheetContainer.stories.tsx +2 -44
  37. package/src/components/Toolbar/Toolbar.tsx +1 -7
  38. package/src/components/index.ts +0 -1
  39. package/src/integrations/thread-ranges.ts +0 -2
  40. package/dist/types/src/components/SheetObjectSettings.d.ts +0 -7
  41. package/dist/types/src/components/SheetObjectSettings.d.ts.map +0 -1
  42. package/dist/types/src/testing/playwright/playwright.config.d.ts +0 -3
  43. package/dist/types/src/testing/playwright/playwright.config.d.ts.map +0 -1
  44. package/dist/types/src/testing/playwright/sheet-manager.d.ts +0 -24
  45. package/dist/types/src/testing/playwright/sheet-manager.d.ts.map +0 -1
  46. package/dist/types/src/testing/playwright/sheet.spec.d.ts +0 -2
  47. package/dist/types/src/testing/playwright/sheet.spec.d.ts.map +0 -1
  48. package/src/components/SheetObjectSettings.tsx +0 -38
  49. package/src/testing/playwright/playwright.config.ts +0 -18
  50. package/src/testing/playwright/sheet-manager.ts +0 -91
  51. package/src/testing/playwright/sheet.spec.ts +0 -78
@@ -13,7 +13,7 @@ import { SpaceAction } from '@dxos/plugin-space';
13
13
  import { getSpace, isEchoObject } from '@dxos/react-client/echo';
14
14
  import { Icon } from '@dxos/react-ui';
15
15
 
16
- import { ComputeGraphContextProvider, SheetContainer, SheetObjectSettings } from './components';
16
+ import { ComputeGraphContextProvider, RangeList, SheetContainer } from './components';
17
17
  import { type ComputeGraphRegistry } from './compute-graph';
18
18
  import { compareIndexPositions, createSheet } from './defs';
19
19
  import { computeGraphFacet } from './extensions';
@@ -144,18 +144,26 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
144
144
  surface: {
145
145
  component: ({ data, role }) => {
146
146
  const space = isEchoObject(data.object) ? getSpace(data.object) : undefined;
147
+ if (!space) {
148
+ return null;
149
+ }
150
+
147
151
  switch (role) {
148
152
  case 'article':
149
153
  case 'section':
150
- if (space && data.object instanceof SheetType) {
154
+ if (data.object instanceof SheetType) {
151
155
  return <SheetContainer space={space} sheet={data.object} role={role} />;
152
156
  }
153
- break;
157
+
158
+ return null;
154
159
  case 'complementary--settings':
155
160
  if (data.subject instanceof SheetType) {
156
- return <SheetObjectSettings sheet={data.subject} />;
161
+ return {
162
+ node: <RangeList sheet={data.subject} />,
163
+ };
157
164
  }
158
- break;
165
+
166
+ return null;
159
167
  }
160
168
 
161
169
  return null;
@@ -2,8 +2,6 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta } from '@storybook/react';
8
6
  import React from 'react';
9
7
 
@@ -335,30 +335,21 @@ export const GridSheet = () => {
335
335
  <DropdownMenu.VirtualTrigger virtualRef={contextMenuAnchorRef} />
336
336
  <DropdownMenu.Content side={contextMenuAxis === 'col' ? 'bottom' : 'right'} sideOffset={4} collisionPadding={8}>
337
337
  <DropdownMenu.Viewport>
338
- <DropdownMenu.Item
339
- onClick={() => handleAxisMenuAction('insert-before')}
340
- data-testid={`grid.${contextMenuAxis}.insert-before`}
341
- >
338
+ <DropdownMenu.Item onClick={() => handleAxisMenuAction('insert-before')}>
342
339
  <Icon
343
340
  size={5}
344
341
  icon={contextMenuAxis === 'col' ? 'ph--columns-plus-left--regular' : 'ph--rows-plus-top--regular'}
345
342
  />
346
343
  <span>{t(`add ${contextMenuAxis} before label`)}</span>
347
344
  </DropdownMenu.Item>
348
- <DropdownMenu.Item
349
- onClick={() => handleAxisMenuAction('insert-after')}
350
- data-testid={`grid.${contextMenuAxis}.insert-after`}
351
- >
345
+ <DropdownMenu.Item onClick={() => handleAxisMenuAction('insert-after')}>
352
346
  <Icon
353
347
  size={5}
354
348
  icon={contextMenuAxis === 'col' ? 'ph--columns-plus-right--regular' : 'ph--rows-plus-bottom--regular'}
355
349
  />
356
350
  <span>{t(`add ${contextMenuAxis} after label`)}</span>
357
351
  </DropdownMenu.Item>
358
- <DropdownMenu.Item
359
- onClick={() => handleAxisMenuAction('drop')}
360
- data-testid={`grid.${contextMenuAxis}.drop`}
361
- >
352
+ <DropdownMenu.Item onClick={() => handleAxisMenuAction('drop')}>
362
353
  <Icon size={5} icon='ph--backspace--regular' />
363
354
  <span>{t(`delete ${contextMenuAxis} label`)}</span>
364
355
  </DropdownMenu.Item>
@@ -2,40 +2,18 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta } from '@storybook/react';
8
6
  import React from 'react';
9
7
 
10
- import { type Intent, IntentProvider } from '@dxos/app-framework';
11
- import { useSpace, create } from '@dxos/react-client/echo';
8
+ import { useSpace } from '@dxos/react-client/echo';
12
9
  import { withClientProvider } from '@dxos/react-client/testing';
13
10
  import { withTheme, withLayout } from '@dxos/storybook-utils';
14
11
 
15
12
  import { SheetContainer } from './SheetContainer';
16
13
  import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
17
14
  import translations from '../../translations';
18
- import { SheetAction, SheetType } from '../../types';
15
+ import { SheetType } from '../../types';
19
16
  import { useComputeGraph } from '../ComputeGraph';
20
- import { RangeList } from '../RangeList';
21
-
22
- // TODO(thure via wittjosiah): stories/components should be written such that the dependency on intents is external and provided via callback and then the story can implement it differently.
23
- const storybookIntentValue = create({
24
- dispatch: async (intents: Intent | Intent[]) => {
25
- const intent = Array.isArray(intents) ? intents[0] : intents;
26
- switch (intent.action) {
27
- case SheetAction.DROP_AXIS: {
28
- if (!intent.undo) {
29
- const { model, axis, axisIndex } = intent.data as SheetAction.DropAxis;
30
- model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
31
- }
32
- }
33
- }
34
- },
35
- undo: async () => ({}),
36
- history: [],
37
- registerResolver: () => () => {},
38
- });
39
17
 
40
18
  export const Basic = () => {
41
19
  const space = useSpace();
@@ -48,26 +26,6 @@ export const Basic = () => {
48
26
  return <SheetContainer space={space} sheet={sheet} role='article' ignoreAttention />;
49
27
  };
50
28
 
51
- export const Spec = () => {
52
- const space = useSpace();
53
- const graph = useComputeGraph(space);
54
- const sheet = useTestSheet(space, graph, { cells: { A1: { value: 'Ready' } } });
55
- if (!sheet || !space) {
56
- return null;
57
- }
58
-
59
- return (
60
- <IntentProvider value={storybookIntentValue}>
61
- <div role='none' className='grid grid-rows-[66%_33%] grid-cols-1'>
62
- <SheetContainer space={space} sheet={sheet} role='article' ignoreAttention />
63
- <div role='none' data-testid='grid.range-list'>
64
- <RangeList sheet={sheet} />
65
- </div>
66
- </div>
67
- </IntentProvider>
68
- );
69
- };
70
-
71
29
  const meta: Meta = {
72
30
  title: 'plugins/plugin-sheet/SheetContainer',
73
31
  component: SheetContainer,
@@ -225,13 +225,7 @@ const Alignment = () => {
225
225
  onValueChange={(value: AlignValue) => onAction?.({ key: alignKey, value })}
226
226
  >
227
227
  {alignmentOptions.map(({ value, icon }) => (
228
- <ToolbarItem
229
- itemType='toggleGroupItem'
230
- key={value}
231
- value={value}
232
- icon={icon}
233
- data-testid={`grid.toolbar.${alignKey}.${value}`}
234
- >
228
+ <ToolbarItem itemType='toggleGroupItem' key={value} value={value} icon={icon}>
235
229
  {t('toolbar action label', {
236
230
  key: t(`range key ${alignKey} label`),
237
231
  value: t(`range value ${value} label`),
@@ -8,6 +8,5 @@ export * from './ComputeGraph';
8
8
  export * from './GridSheet';
9
9
  export * from './RangeList';
10
10
  export * from './SheetContext';
11
- export * from './SheetObjectSettings';
12
11
 
13
12
  export const SheetContainer = lazy(() => import('./SheetContainer'));
@@ -43,8 +43,6 @@ export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null
43
43
  // TODO(Zan): Everywhere we refer to the cursor in a thread context should change to `anchor`.
44
44
  const range = parseThreadAnchorAsCellRange(data.cursor);
45
45
  range && grid?.setFocus({ ...range.to, plane: 'grid' }, true);
46
-
47
- return { data: true };
48
46
  }
49
47
  }
50
48
  },
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { type SheetType } from '../types';
3
- export type SheetObjectSettingsProps = {
4
- sheet: SheetType;
5
- };
6
- export declare const SheetObjectSettings: ({ sheet }: SheetObjectSettingsProps) => React.JSX.Element;
7
- //# sourceMappingURL=SheetObjectSettings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SheetObjectSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/SheetObjectSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,mBAAmB,cAAe,wBAAwB,sBAqBtE,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const _default: import("@playwright/test").PlaywrightTestConfig<{}, {}>;
2
- export default _default;
3
- //# sourceMappingURL=playwright.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"playwright.config.d.ts","sourceRoot":"","sources":["../../../../../src/testing/playwright/playwright.config.ts"],"names":[],"mappings":";AASA,wBAQG"}
@@ -1,24 +0,0 @@
1
- import { type Locator, type Page } from '@playwright/test';
2
- import { DxGridManager } from '@dxos/lit-grid/testing';
3
- import { type DxGridPosition, type DxGridAxis } from '@dxos/react-ui-grid';
4
- /**
5
- * Test helper for managing dx-grid interactions and assertions in Playwright tests.
6
- * Provides utilities for cell selection, grid navigation, virtualization checks and event handling.
7
- */
8
- export declare class SheetManager {
9
- constructor(page: Page, grid?: Locator);
10
- grid: DxGridManager;
11
- page: Page;
12
- ready(): Promise<void>;
13
- fill(text: string): Promise<void>;
14
- press(key: string): Promise<void>;
15
- commit(key: string): Promise<void>;
16
- cellByText(text: string): Locator;
17
- setFocusedCellValue(text: string, commitKey: string): Promise<void>;
18
- selectRange(start: DxGridPosition, end: DxGridPosition): Promise<void>;
19
- deleteAxis(axis: DxGridAxis, position: number): Promise<void>;
20
- toolbarAction(key: string, value: string): Locator;
21
- cellEditor(): Locator;
22
- rangeInList(a1Coords: string): Locator;
23
- }
24
- //# sourceMappingURL=sheet-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sheet-manager.d.ts","sourceRoot":"","sources":["../../../../../src/testing/playwright/sheet-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE3E;;;GAGG;AACH,qBAAa,YAAY;gBACX,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,OAAO;IAKtC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IAEL,KAAK;IAKL,IAAI,CAAC,IAAI,EAAE,MAAM;IAOjB,KAAK,CAAC,GAAG,EAAE,MAAM;IAOjB,MAAM,CAAC,GAAG,EAAE,MAAM;IAMxB,UAAU,CAAC,IAAI,EAAE,MAAM;IAIjB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IASnD,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,cAAc;IAWtD,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM;IAQnD,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIxC,UAAU;IAIV,WAAW,CAAC,QAAQ,EAAE,MAAM;CAG7B"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=sheet.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sheet.spec.d.ts","sourceRoot":"","sources":["../../../../../src/testing/playwright/sheet.spec.ts"],"names":[],"mappings":""}
@@ -1,38 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { SPACE_PLUGIN } from '@dxos/plugin-space/meta';
8
- import { Input, useTranslation } from '@dxos/react-ui';
9
-
10
- import { RangeList } from './RangeList';
11
- import { type SheetType } from '../types';
12
-
13
- export type SheetObjectSettingsProps = {
14
- sheet: SheetType;
15
- };
16
-
17
- export const SheetObjectSettings = ({ sheet }: SheetObjectSettingsProps) => {
18
- const { t } = useTranslation(SPACE_PLUGIN);
19
-
20
- // TODO(burdon): Standardize forms.
21
- return (
22
- <>
23
- <div role='form' className='flex flex-col w-full p-2 gap-1'>
24
- <Input.Root>
25
- <Input.Label>{t('name label')}</Input.Label>
26
- <Input.TextInput
27
- placeholder={t('name placeholder')}
28
- value={sheet.name ?? ''}
29
- onChange={(event) => {
30
- sheet.name = event.target.value;
31
- }}
32
- />
33
- </Input.Root>
34
- </div>
35
- <RangeList sheet={sheet} />
36
- </>
37
- );
38
- };
@@ -1,18 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { nxE2EPreset } from '@nx/playwright/preset';
6
- import { defineConfig } from '@playwright/test';
7
-
8
- import { e2ePreset } from '@dxos/test-utils/playwright';
9
-
10
- export default defineConfig({
11
- ...nxE2EPreset(__filename, { testDir: __dirname }),
12
- ...e2ePreset(__dirname),
13
- webServer: {
14
- command: 'pnpm -w nx storybook stories',
15
- port: 9009,
16
- reuseExistingServer: !process.env.CI,
17
- },
18
- });
@@ -1,91 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { type Locator, type Page } from '@playwright/test';
6
-
7
- import { DxGridManager } from '@dxos/lit-grid/testing';
8
- import { type DxGridPosition, type DxGridAxis } from '@dxos/react-ui-grid';
9
-
10
- /**
11
- * Test helper for managing dx-grid interactions and assertions in Playwright tests.
12
- * Provides utilities for cell selection, grid navigation, virtualization checks and event handling.
13
- */
14
- export class SheetManager {
15
- constructor(page: Page, grid?: Locator) {
16
- this.grid = new DxGridManager(page, grid);
17
- this.page = page;
18
- }
19
-
20
- grid: DxGridManager;
21
- page: Page;
22
-
23
- async ready() {
24
- await this.grid.ready();
25
- return this.cellByText('Ready').waitFor({ state: 'visible' });
26
- }
27
-
28
- async fill(text: string) {
29
- // TODO(thure): Do these timeouts help with test flakiness?
30
- await this.page.waitForTimeout(200);
31
- await this.cellEditor().fill(text);
32
- await this.page.waitForTimeout(200);
33
- }
34
-
35
- async press(key: string) {
36
- // TODO(thure): Does these timeouts help with test flakiness?
37
- await this.page.waitForTimeout(200);
38
- await this.page.keyboard.press(key);
39
- await this.page.waitForTimeout(200);
40
- }
41
-
42
- async commit(key: string) {
43
- // TODO(thure): Why do we need to wait? Enter is ignored otherwise…
44
- await this.page.waitForTimeout(500);
45
- await this.press(key);
46
- }
47
-
48
- cellByText(text: string) {
49
- return this.grid.grid.getByText(text);
50
- }
51
-
52
- async setFocusedCellValue(text: string, commitKey: string) {
53
- const mode = await this.grid.mode();
54
- if (mode === 'browse') {
55
- await this.commit('Enter');
56
- }
57
- await this.fill(text);
58
- await this.commit(commitKey);
59
- }
60
-
61
- async selectRange(start: DxGridPosition, end: DxGridPosition) {
62
- const startCell = this.grid.cell(start.col, start.row, start.plane);
63
- const endCell = this.grid.cell(end.col, end.row, end.plane);
64
- const startBox = await startCell.boundingBox();
65
- const endBox = await endCell.boundingBox();
66
- await startCell.dragTo(endCell, {
67
- sourcePosition: { x: startBox!.width / 2, y: startBox!.height / 2 },
68
- targetPosition: { x: endBox!.width / 2, y: endBox!.height / 2 },
69
- });
70
- }
71
-
72
- async deleteAxis(axis: DxGridAxis, position: number) {
73
- const col = axis === 'row' ? 0 : position;
74
- const row = axis === 'row' ? position : 0;
75
- const plane = axis === 'row' ? 'frozenColsStart' : 'frozenRowsStart';
76
- await this.grid.cell(col, row, plane).click({ button: 'right' });
77
- await this.page.getByTestId(`grid.${axis}.drop`).click();
78
- }
79
-
80
- toolbarAction(key: string, value: string) {
81
- return this.page.getByTestId(`grid.toolbar.${key}.${value}`);
82
- }
83
-
84
- cellEditor() {
85
- return this.page.getByTestId('grid.cell-editor').getByRole('textbox');
86
- }
87
-
88
- rangeInList(a1Coords: string) {
89
- return this.page.getByTestId('grid.range-list').getByText(a1Coords);
90
- }
91
- }
@@ -1,78 +0,0 @@
1
- //
2
- // Copyright 2021 DXOS.org
3
- //
4
-
5
- import { expect, test, type Page } from '@playwright/test';
6
-
7
- import { faker } from '@dxos/random';
8
- import { setupPage, storybookUrl } from '@dxos/test-utils/playwright';
9
-
10
- import { SheetManager } from './sheet-manager';
11
-
12
- test.describe('plugin-sheet', () => {
13
- let page: Page;
14
- let sheet: SheetManager;
15
-
16
- test.beforeEach(async ({ browser }) => {
17
- const setup = await setupPage(browser, {
18
- url: storybookUrl('plugins-plugin-sheet-sheetcontainer--spec'),
19
- });
20
- page = setup.page;
21
- sheet = new SheetManager(page);
22
- await sheet.ready();
23
- });
24
-
25
- test.afterEach(async () => {
26
- await page.close();
27
- });
28
-
29
- test('basic interactions', async () => {
30
- // Cell editor should initially be hidden
31
- await expect(sheet.cellEditor()).not.toBeVisible();
32
- // Click on cell to focus it
33
- await sheet.grid.cell(0, 0, 'grid').click();
34
- // Cell editor should still be hidden
35
- await expect(sheet.cellEditor()).not.toBeVisible();
36
- // Click again to edit it
37
- await sheet.grid.cell(0, 0, 'grid').click();
38
- // Confirm editor displays
39
- await expect(sheet.cellEditor()).toBeVisible();
40
- // Type in a value and press enter
41
- const testString = faker.string.uuid();
42
- await sheet.setFocusedCellValue(testString, 'Enter');
43
- // Expect that value to now show in the grid
44
- await expect(sheet.cellByText(testString)).toBeVisible();
45
- });
46
-
47
- test('functions, row deletion, indexed positions', async () => {
48
- const firstNumber = 123;
49
- const secondNumber = 789;
50
- const thirdNumber = 567;
51
- // Input numbers
52
- await sheet.grid.cell(0, 2, 'grid').click();
53
- await sheet.setFocusedCellValue(`${firstNumber}`, 'Enter');
54
- await sheet.setFocusedCellValue(`${secondNumber}`, 'Enter');
55
- await sheet.setFocusedCellValue(`${thirdNumber}`, 'Enter');
56
-
57
- // Test range input
58
- await sheet.press('Enter');
59
- await sheet.fill('=SUM(');
60
- await sheet.selectRange({ col: 0, row: 2, plane: 'grid' }, { col: 0, row: 4, plane: 'grid' });
61
- await sheet.press(')');
62
- await sheet.commit('Enter');
63
- // Check sum
64
- await expect(sheet.grid.cell(0, 5, 'grid')).toHaveText(`${firstNumber + secondNumber + thirdNumber}`);
65
- // Delete row of second number
66
- await sheet.deleteAxis('row', 3);
67
- // Check sum again, it should be one cell up and reflect the updated range.
68
- await expect(sheet.grid.cell(0, 4, 'grid')).toHaveText(`${firstNumber + thirdNumber}`);
69
- });
70
-
71
- test('ranges', async () => {
72
- await sheet.selectRange({ col: 1, row: 0, plane: 'grid' }, { col: 1, row: 1, plane: 'grid' });
73
- await sheet.toolbarAction('alignment', 'center').click();
74
- expect(await sheet.grid.cell(1, 0, 'grid')).toHaveAttribute('class', /text-center/);
75
- expect(await sheet.grid.cell(1, 1, 'grid')).toHaveAttribute('class', /text-center/);
76
- await expect(sheet.rangeInList('B1:B2')).toBeVisible();
77
- });
78
- });