Skip to content

Commit

Permalink
drop sorting
Browse files Browse the repository at this point in the history
drop sort

drop sorting from tests
  • Loading branch information
vraja-pro committed Jan 15, 2025
1 parent 423ee4a commit 0c89765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/js/src/dashboard/components/dashboard-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const DashboardTable = ( { title, columns, data } ) => {
{ title }
</Title>
<div className="yst-overflow-auto">
<table className="yst-site-kit-widget-table">
<Table variant="minimal">
<Table.Head className="yst-bg-white yst-mt-2 yst-border-b-slate-300 yst-border-b yst-border-t-0">
<Table.Row>
<Table.Header>{ "" }</Table.Header>
Expand Down Expand Up @@ -67,7 +67,7 @@ export const DashboardTable = ( { title, columns, data } ) => {
</Table.Row>
) ) }
</Table.Body>
</table>
</Table>
</div>
</Paper>
);
Expand Down
13 changes: 2 additions & 11 deletions packages/js/tests/dashboard/components/dashboard-table.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { render, screen, fireEvent } from "../../test-utils.js";
import { render, screen } from "../../test-utils.js";
import "@testing-library/jest-dom";
import { DashboardTable } from "../../../src/dashboard/components/dashboard-table.js";
import { SCORE_META } from "../../../src/dashboard/scores/score-meta.js";

describe( "DashboardTable", () => {
const columns = [
{ name: "landing-page", label: "Landing page" },
{ name: "clicks", label: "Clicks", sortable: true },
{ name: "clicks", label: "Clicks" },
{ name: "impressions", label: "Impressions" },
{ name: "ctr", label: "CTR" },
{ name: "average-position", label: "Average position" },
Expand Down Expand Up @@ -41,13 +41,4 @@ describe( "DashboardTable", () => {
expect( rowElement ).toHaveTextContent( SCORE_META[ row[ 5 ] ].label );
} );
} );

it( "sorts the table correctly when a sortable column header is clicked", () => {
render( <DashboardTable title="Test Table" columns={ columns } data={ data } /> );
const clicksHeader = screen.getByText( "Clicks" );
fireEvent.click( clicksHeader );
const sortedData = data.sort( ( a, b ) => a[ 1 ] - b[ 1 ] );
const firstRow = screen.getAllByRole( "row" )[ 1 ];
expect( firstRow ).toHaveTextContent( sortedData[ 0 ][ 0 ] );
} );
} );

0 comments on commit 0c89765

Please sign in to comment.