Skip to content

Conversation

halocline
Copy link
Collaborator

@halocline halocline commented Apr 18, 2024

What does this PR do?

Closes #7207 by ensuring that a search event returns to page 1 of matched search results.

Where should the reviewer start?

DataSearch.js

What testing has been done on this PR?

  • Storybook
  • Added Jest tests

How should this be manually tested?

import React from 'react';
import { Data, DataTable, Pagination } from 'grommet';

const data = [
  {
    name: 'aa',
    enabled: true,
    rating: 2.3,
    sub: { note: 'ZZ' },
    tags: ['qa', 'staging', 'prod'],
  },
  {
    name: 'bb',
    enabled: false,
    rating: 4.3,
    sub: { note: 'YY' },
    tags: ['qa', 'staging'],
  },
  { name: 'cc', sub: {}, tags: ['qa'] },
  { name: 'dd' },
];

const properties = {
  name: { label: 'Name' },
};

const view = {
  step: 2,
  page: 1,
  search: '',
};

const columns = [
  { property: 'name', header: 'Name', size: 'small', primary: true },
];

// eslint-disable-next-line arrow-body-style
export const TEMP = () => {
  return (
    <Data
      data={data}
      properties={properties}
      view={view}
      toolbar
    >
      <DataTable columns={columns} />
      <Pagination />
    </Data>
  );
};

TEMP.storyName = 'TEMP';

TEMP.args = {
  full: true,
};

export default {
  title: 'Data/Data/TEMP',
};

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

#7207 Reported by Namratha

What are the relevant issues?

#7207

Screenshots (if appropriate)

Do the grommet docs need to be updated?

No.

Should this PR be mentioned in the release notes?

Yes.

Is this change backwards compatible or is it a breaking change?

Backwards compatible.

Signed-off-by: Matt Glissmann <mdglissmann@gmail.com>
@taysea taysea merged commit 06ec4f4 into master Apr 19, 2024
@taysea taysea deleted the data-search-page-reset branch April 19, 2024 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When using Data with Pagination a search event should return to page 1 of results
3 participants