Repository: adobe/react-spectrum
File: packages/@react-spectrum/table/test/Table.test.js (JavaScript)

Code before:
        checkRowSelection(rows.slice(11), false);
      });

      it('should extend a selection with Ctrl + Shift + End', function () {
        let onSelectionChange = jest.fn();
        let tree = renderTable({onSelectionChange});

        checkSelectAll(tree, 'unchecked');

        let rows = tree.getAllByRole('row');
        checkRowSelection(rows.slice(1), false);
        pressWithKeyboard(getCell(tree, 'Baz 10'));

        onSelectionChange.mockReset();
        fireEvent.keyDown(getCell(tree, 'Baz 10'), {key: 'End', shiftKey: true, ctrlKey: true});

        let expected = [];
        for (let i = 10; i <= 30; i++) {
          expected.push('Foo ' + i);
        }

        checkSelection(onSelectionChange, expected);
      });

      // Skip the pagedown/up ones when we aren't mocking client height since those rely on math to calculate where to move focus
      it.skip('should extend a selection with Shift + PageDown', function () {
        let onSelectionChange = jest.fn();
        let tree = renderTable({onSelectionChange});

        checkSelectAll(tree, 'unchecked');

        let rows = tree.getAllByRole('row');
        checkRowSelection(rows.slice(1), false);
        pressWithKeyboard(getCell(tree, 'Baz 10'));

        onSelectionChange.mockReset();
        fireEvent.keyDown(getCell(tree, 'Baz 10'), {key: 'PageDown', shiftKey: true});

        let expected = [];
        for (let i = 10; i <= 34; i++) {
          expected.push('Foo ' + i);
        }

        checkSelection(onSelectionChange, expected);
      });

      it.skip('should extend a selection with Shift + PageUp', function () {
        let onSelectionChange = jest.fn();
        let tree = renderTable({onSelectionChange});

        checkSelectAll(tree, 'unchecked');

Review comment (suggestion):
Is the path forward that these tests need height defined or we tell people they have to mock a height to do these, since you're saying when there is no height value to use for calculations these won't work.

Code after:
        checkSelection(onSelectionChange, [
          'Foo 1', 'Foo 2', 'Foo 3', 'Foo 4', 'Foo 5',
          'Foo 6', 'Foo 7', 'Foo 8', 'Foo 9', 'Foo 10'
        ]);

        checkRowSelection(rows.slice(1, 11), true);
        checkRowSelection(rows.slice(11), false);
      });

      it('should extend a selection with Ctrl + Shift + End', function () {
        let onSelectionChange = jest.fn();
        let tree = renderTable({onSelectionChange});

        checkSelectAll(tree, 'unchecked');

        let rows = tree.getAllByRole('row');
        checkRowSelection(rows.slice(1), false);
        pressWithKeyboard(getCell(tree, 'Baz 10'));

        onSelectionChange.mockReset();
        fireEvent.keyDown(getCell(tree, 'Baz 10'), {key: 'End', shiftKey: true, ctrlKey: true});

        let expected = [];
        for (let i = 10; i <= 100; i++) {
          expected.push('Foo ' + i);
        }

        checkSelection(onSelectionChange, expected);
      });

      it('should extend a selection with Shift + PageDown', function () {
        let onSelectionChange = jest.fn();
        let tree = renderTable({onSelectionChange});

        checkSelectAll(tree, 'unchecked');

        let rows = tree.getAllByRole('row');
        checkRowSelection(rows.slice(1), false);
        pressWithKeyboard(getCell(tree, 'Baz 10'));

        onSelectionChange.mockReset();
        fireEvent.keyDown(getCell(tree, 'Baz 10'), {key: 'PageDown', shiftKey: true});

        let expected = [];
        for (let i = 10; i <= 34; i++) {
          expected.push('Foo ' + i);
        }

        checkSelection(onSelectionChange, expected);
      });